postBuild.ts 533 B

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