UNPKG

@sanpjs/cmd-start

Version:

Sanp start command

51 lines 1.39 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.handler = exports.builder = exports.description = exports.command = void 0; /** * @file main process * @author chaiyanchen <chaiyanchen@baidu.com> */ const core_1 = __importDefault(require("@sanpjs/core")); exports.command = 'start [entry]'; exports.description = 'start an app in production mode'; exports.builder = { config: { alias: 'config-file', type: 'string', hidden: true, describe: 'Project config file' }, https: { type: 'boolean', default: false, describe: 'Enable https' }, port: { alias: 'p', type: 'number', default: '8888', describe: 'Port number of the URL' }, host: { alias: 'H', type: 'string', default: '127.0.0.1', describe: 'Hostname of the URL' }, }; const handler = (args) => { const sanp = (0, core_1.default)(); sanp.run(args, (err) => { if (err) { sanp.context.logger.error(err); process.exit(1); } }).then(() => { sanp.server?.listen(args.port, args.host); }); }; exports.handler = handler; //# sourceMappingURL=index.js.map