@lerna/publish
Version:
Publish packages in the current project
44 lines (43 loc) • 1.21 kB
JavaScript
var import_core = require("@lerna/core");
module.exports = function factory(argv) {
return new ChangedCommand(argv);
};
class ChangedCommand extends import_core.Command {
result;
get otherCommandConfigs() {
return ["version", "publish"];
}
initialize() {
if (this.options.conventionalGraduate) {
this.options.conventionalCommits = true;
if (this.options.forcePublish) {
this.logger.warn("option", "--force-publish superseded by --conventional-graduate");
}
}
const updates = (0, import_core.collectUpdates)(
this.packageGraph.rawPackageList,
this.packageGraph,
this.execOpts,
this.options
);
this.result = (0, import_core.listableFormat)(
updates.map((node) => node.pkg),
this.options
);
if (this.result.count === 0) {
this.logger.info("", "No changed packages found");
process.exitCode = 1;
return false;
}
}
execute() {
(0, import_core.output)(this.result.text);
this.logger.success(
"found",
"%d %s ready to publish",
this.result.count,
this.result.count === 1 ? "package" : "packages"
);
}
}
module.exports.ChangedCommand = ChangedCommand;