UNPKG

beesbuild

Version:

构建工具链

71 lines (70 loc) 3.15 kB
"use strict"; 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, { build: () => build }); 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 build = program => { if (!(program instanceof import_commander.Command)) { program = (0, import_utils.init)(variables).end(); } program.command("build").description("\u6253\u5305\u9879\u76EE\uFF0C\u5E76\u5C06\u5176\u5B58\u50A8\u5728\u4EFB\u4F55\u53EF\u89C1\u7684\u76EE\u5F55\u4E2D").addOption(new import_commander.Option("--run-env <string>", "\u73AF\u5883").default("Browser").choices(["Browser", "Node"])).option("-D, --dev [boolean]", "\u662F\u5426\u662F\u5F00\u53D1\u73AF\u5883", false).option("-S, --stub [boolean]", "\u662F\u5426\u662F\u5F00\u53D1\u73AF\u5883", false).option("--no-minify [boolean]", "\u751F\u4EA7\u73AF\u5883\u4E2D\u662F\u5426\u538B\u7F29").option("-C, --no-clean", "\u662F\u5426\u5220\u9664\u6253\u5305\u6587\u4EF6\u6216\u6587\u4EF6\u5939").action(async options => { const { stub, minify, clean, dev } = options; const opts = (0, import_utils.handleOptions)(program, { ...options, dev: (0, import_boolean_parser.booleanParser)(dev), stub: (0, import_boolean_parser.booleanParser)(stub), minify: (0, import_boolean_parser.booleanParser)(minify), clean: (0, import_boolean_parser.booleanParser)(clean) }); await scripts.build(opts); }); return program; }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { build });