37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
// #!/usr/bin/env node
|
|
|
|
import { runBuildConfig } from './buildConf';
|
|
import colors from 'picocolors';
|
|
|
|
import pkg from '../../package.json';
|
|
|
|
export const runBuild = async () => {
|
|
try {
|
|
const argvList = process.argv.splice(2);
|
|
|
|
// Generate configuration file
|
|
if (!argvList.includes('disabled-config')) {
|
|
runBuildConfig();
|
|
}
|
|
|
|
console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
|
|
} catch (error: any) {
|
|
console.error('\n');
|
|
console.error(colors.red('╔══════════════════════════════════════════════════════════════════╗'));
|
|
console.error(colors.red('║ 构建后处理错误 ║'));
|
|
console.error(colors.red('╚══════════════════════════════════════════════════════════════════╝'));
|
|
console.error('\n');
|
|
console.error(colors.yellow('错误详情:'));
|
|
console.error(error);
|
|
|
|
if (error.stack) {
|
|
console.error('\n');
|
|
console.error(colors.yellow('错误堆栈:'));
|
|
console.error(error.stack);
|
|
}
|
|
|
|
process.exit(1);
|
|
}
|
|
};
|
|
runBuild();
|