@lerna/publish
Version:
Publish packages in the current project
105 lines (103 loc) • 4.05 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var cli_exports = {};
__export(cli_exports, {
lernaCLI: () => lernaCLI
});
module.exports = __toCommonJS(cli_exports);
var import_dedent = __toESM(require("dedent"));
var import_npmlog = __toESM(require("npmlog"));
var import_os = __toESM(require("os"));
var import_yargs = __toESM(require("yargs/yargs"));
function lernaCLI(argv, cwd) {
const cli = (0, import_yargs.default)(argv, cwd);
return globalOptions(cli).usage("Usage: $0 <command> [options]").demandCommand(1, "A command is required. Pass --help to see all available commands and options.").recommendCommands().strict().fail((msg, err) => {
const actual = err || new Error(msg);
if (actual.name !== "ValidationError" && !actual.pkg) {
if (/Did you mean/.test(actual.message)) {
import_npmlog.default.error("lerna", `Unknown command "${cli.parsed.argv._[0]}"`);
}
import_npmlog.default.error("lerna", actual.message);
}
cli.exit(actual.exitCode > 0 ? actual.exitCode : 1, actual);
}).alias("h", "help").alias("v", "version").wrap(cli.terminalWidth()).epilogue(import_dedent.default`
When a command fails, all logs are written to lerna-debug.log in the current working directory.
For more information, check out the docs at https://lerna.js.org/docs/introduction
`);
}
function globalOptions(argv) {
const opts = {
loglevel: {
defaultDescription: "info",
describe: "What level of logs to report.",
type: "string"
},
concurrency: {
defaultDescription: import_os.default.cpus().length,
describe: "How many processes to use when lerna parallelizes tasks.",
type: "number",
requiresArg: true
},
"reject-cycles": {
describe: "Fail if a cycle is detected among dependencies.",
type: "boolean"
},
"no-progress": {
describe: "Disable progress bars. (Always off in CI)",
type: "boolean"
},
progress: {
// proxy for --no-progress
hidden: true,
type: "boolean"
},
"no-sort": {
describe: "Do not sort packages topologically (dependencies before dependents).",
type: "boolean"
},
sort: {
// proxy for --no-sort
hidden: true,
type: "boolean"
},
"max-buffer": {
describe: "Set max-buffer (in bytes) for subcommand execution",
type: "number",
requiresArg: true
}
};
const globalKeys = Object.keys(opts).concat(["help", "version"]);
return argv.options(opts).group(globalKeys, "Global Options:").option("ci", {
hidden: true,
type: "boolean"
});
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
lernaCLI
});