Skip to content

Instantly share code, notes, and snippets.

@ewnd9
Created July 30, 2019 17:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ewnd9/dfcdbf67e7099da12a3973f89d48ed81 to your computer and use it in GitHub Desktop.
Save ewnd9/dfcdbf67e7099da12a3973f89d48ed81 to your computer and use it in GitHub Desktop.
Getting update manifest for lerna programmatically
import VersionCommand from '@lerna/version';
(async () => {
const info = await getUpdated();
console.log(info);
})()
async function getUpdated() {
const Package = require('@lerna/package');
const restore = (() => {
const orig = Package.prototype.serialize;
Package.prototype.serialize = () => Promise.resolve();
return () => {
Package.prototype.serialize = orig;
};
})();
const ret = await new Promise(onResolved => {
new VersionCommand({
gitTagVersion: false,
push: false,
changelog: false,
yes: true,
conventionalCommits: true,
json: true,
onResolved,
});
});
restore();
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment