2020-10-13 01:40:21 +08:00
|
|
|
// #!/usr/bin/env node
|
|
|
|
|
|
|
|
import { argv } from 'yargs';
|
|
|
|
import { runBuildConfig } from './buildConf';
|
2021-02-04 22:00:25 +08:00
|
|
|
import chalk from 'chalk';
|
2020-10-13 01:40:21 +08:00
|
|
|
|
2021-02-08 23:59:47 +08:00
|
|
|
import pkg from '../../package.json';
|
|
|
|
|
2020-12-22 22:13:03 +08:00
|
|
|
export const runBuild = async () => {
|
2020-10-13 01:40:21 +08:00
|
|
|
try {
|
|
|
|
const argvList = argv._;
|
|
|
|
|
|
|
|
// Generate configuration file
|
|
|
|
if (!argvList.includes('no-conf')) {
|
|
|
|
await runBuildConfig();
|
|
|
|
}
|
2021-02-25 20:17:08 +08:00
|
|
|
|
2021-02-08 23:59:47 +08:00
|
|
|
console.log(`✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
|
2020-10-13 01:40:21 +08:00
|
|
|
} catch (error) {
|
2021-02-04 22:00:25 +08:00
|
|
|
console.log(chalk.red('vite build error:\n' + error));
|
2020-10-13 01:40:21 +08:00
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
};
|
2020-10-26 21:45:43 +08:00
|
|
|
runBuild();
|