postBuild.ts 557 B

123456789101112131415161718192021222324
  1. // #!/usr/bin/env node
  2. import { argv } from 'yargs';
  3. import { runBuildConfig } from './buildConf';
  4. import chalk from 'chalk';
  5. import pkg from '../../package.json';
  6. export const runBuild = async () => {
  7. try {
  8. const argvList = argv._;
  9. // Generate configuration file
  10. if (!argvList.includes('no-conf')) {
  11. await runBuildConfig();
  12. }
  13. console.log(`✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
  14. } catch (error) {
  15. console.log(chalk.red('vite build error:\n' + error));
  16. process.exit(1);
  17. }
  18. };
  19. runBuild();