oak-cli/lib/build.js

23 lines
940 B
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const tip_style_1 = require("./tip-style");
const cross_spawn_1 = __importDefault(require("cross-spawn"));
async function build(env) {
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`build环境:${env}`)}`);
const result = cross_spawn_1.default.sync(process.execPath, [require.resolve('../scripts/' + 'webpack.js')].concat([env]), {
stdio: 'inherit',
shell: true,
});
// const result = spawn.sync('npm -v', [], { stdio: 'inherit', shell: true });
if (result.status === 0) {
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`执行完成`)}`);
}
else {
(0, tip_style_1.Error)(`${(0, tip_style_1.error)(`执行失败`)}`);
}
}
exports.default = build;