vue-vben-admin/build/script/build.ts

33 lines
901 B
TypeScript
Raw Normal View History

// #!/usr/bin/env node
2020-10-19 22:16:24 +08:00
// import { sh } from 'tasksfile';
2020-10-14 21:22:08 +08:00
import { argv } from 'yargs';
import { runBuildConfig } from './buildConf';
import { runUpdateHtml } from './updateHtml';
import { errorConsole, successConsole } from '../utils';
2020-10-16 22:03:44 +08:00
import { startGzipStyle } from '../plugin/gzip/compress';
export const runBuild = async () => {
try {
const argvList = argv._;
2020-10-19 22:16:24 +08:00
// let cmd = `cross-env NODE_ENV=production vite build`;
// // await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);
// await sh(cmd, {
// async: true,
// nopipe: true,
// });
// Generate configuration file
if (!argvList.includes('no-conf')) {
await runBuildConfig();
}
await runUpdateHtml();
2020-10-16 22:03:44 +08:00
await startGzipStyle();
successConsole('Vite Build successfully!');
} catch (error) {
errorConsole('Vite Build Error\n' + error);
process.exit(1);
}
};