postBuild.ts 535 B

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