UNPKG

@modern-js/builder

Version:
46 lines (45 loc) 1.93 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; 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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var commands_exports = {}; __export(commands_exports, { setupProgram: () => setupProgram }); module.exports = __toCommonJS(commands_exports); var import_path = require("path"); var import_utils = require("@modern-js/utils"); var import_commander = require("@modern-js/utils/commander"); function setupProgram(builder) { const pkgJson = (0, import_path.join)(__dirname, "../../package.json"); const { version } = import_utils.fs.readJSONSync(pkgJson); import_commander.program.name("builder").usage("<command> [options]").version(version); import_commander.program.command("dev").description("starting the dev server").action(async () => { await builder.startDevServer(); }); import_commander.program.command("build").description("build the app for production").action(async () => { await builder.build(); }); import_commander.program.command("serve").description("preview the production build locally").action(async () => { await builder.serve(); }); import_commander.program.parse(); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { setupProgram });