postBuild.ts 668 B

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