beesbuild
Version:
构建工具链
79 lines (78 loc) • 4.93 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 stdin_exports = {};
__export(stdin_exports, {
publish: () => publish
});
module.exports = __toCommonJS(stdin_exports);
var import_commander = require("commander");
var scripts = __toESM(require("../scripts/index.cjs"));
var import_boolean_parser = require("../boolean-parser.cjs");
var variables = __toESM(require("../variables.cjs"));
var import_utils = require("./utils.cjs");
const publish = program => {
if (!(program instanceof import_commander.Command)) {
program = (0, import_utils.init)(variables).end();
}
program.command("publish").description("\u4E00\u5065\u81EA\u52A8\u53D1\u5305\u5DE5\u5177").addArgument(new import_commander.Argument("[increment]", '\u9012\u589E "major", "minor", "patch", \u6216 "pre*" \u7248\u672C\uFF1B\u6216\u6307\u5B9A\u7248\u672C [\u9ED8\u8BA4: "patch"]').default("none").choices(variables.VERSION_STEPS)).addOption(new import_commander.Option("-i, --increment <increment>", '\u9012\u589E "major", "minor", "patch", \u6216 "pre*" \u7248\u672C\uFF1B\u6216\u6307\u5B9A\u7248\u672C').default("none").choices(variables.VERSION_STEPS)).addOption(new import_commander.Option("--access <access>", "\u544A\u8BC9\u6CE8\u518C\u4E2D\u5FC3\u53D1\u5E03\u7684\u5305\u5E94\u8BE5\u662F\u516C\u5F00\u7684\u8FD8\u662F\u53D7\u9650\u5236\u7684\u3002").default("").choices(["public", "restricted"])).option("--pre-release-id, --preReleaseId <preReleaseId>", `\u521B\u5EFA\u9884\u53D1\u5E03\uFF1A\u60A8\u60F3\u8981\u63D0\u4F9B\u7684\u8F6F\u4EF6\u7248\u672C\uFF0C\u540C\u65F6 \u5B83\u8FD8\u6CA1\u6709\u5728\u7A33\u5B9A\u7684Semver\u8303\u56F4\u5185\u3002\u901A\u5E38\uFF0C\u201Calpha\u201D\u3001\u201Cbeta\u201D\u548C\u201Crc\u201D\uFF08\u5019\u9009\u7248\u672C\uFF09\u7528\u4F5C \u9884\u53D1\u5E03`).option("--no-git-checks <gitChecks>", "\u4E0D\u8981\u68C0\u67E5\u5F53\u524D\u5206\u652F\u662F\u5426\u662F\u60A8\u7684\u53D1\u5E03\u5206\u652F\u3001\u5E72\u51C0\u4E14\u6700\u65B0\u7684\u8FDC\u7A0B\u5206\u652F\u3002").option("-s, --no-silent <silent>", "\u9759\u9ED8\u663E\u793A\u811A\u672C\u8F93\u51FA").option("--test <test>", "\u6A21\u62DF\u53D1\u5E03").option("--no-build <build>", "\u53D1\u5E03\u524D\u4E0D\u6267\u884CBuild\u811A\u672C").option("-b, --release-branch, --releaseBranch <releaseBranch>", "\u53D1\u5E03Git\u5206\u652F").option("-e, --excludes [...name]", "\u6392\u9664\u4E0D\u53D1\u5E03\u7684\u5305\u5217\u8868", []).option("--auto-git-tag <auto-git-tag>", "\u53D1\u5E03\u6210\u529F\u540E\u6DFB\u52A0Git tag").option("--dist-tag <value>", "dist-tag").action(async (increment, options) => {
var _a;
const {
all,
force,
silent,
test,
includeDescendants,
build,
gitChecks
} = options;
options.increment = (_a = [options.increment, increment].find(value => variables.ALL_RELEASE_TYPES.includes(value))) != null ? _a : "";
const opts = (0, import_utils.handleOptions)(program, {
...options,
gitChecks: (0, import_boolean_parser.booleanParser)(gitChecks),
all: (0, import_boolean_parser.booleanParser)(all),
silent: (0, import_boolean_parser.booleanParser)(silent),
build: (0, import_boolean_parser.booleanParser)(build),
test: (0, import_boolean_parser.booleanParser)(test),
force: (0, import_boolean_parser.booleanParser)(force),
includeDescendants: (0, import_boolean_parser.booleanParser)(includeDescendants)
});
await scripts.publish(opts);
});
return program;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
publish
});