2023-03-18 13:10:54 +00:00
|
|
|
// #!/usr/bin/env node
|
|
|
|
|
|
|
|
import colors from 'picocolors'
|
|
|
|
|
|
|
|
import pkg from '../../package.json'
|
2023-07-29 10:46:43 +00:00
|
|
|
import { runBuildConfig } from './buildConf'
|
2023-03-18 13:10:54 +00:00
|
|
|
|
2023-07-29 12:20:40 +00:00
|
|
|
export function runBuild() {
|
2023-03-18 13:10:54 +00:00
|
|
|
try {
|
|
|
|
const argvList = process.argv.splice(2)
|
|
|
|
|
|
|
|
// Generate configuration file
|
2023-07-29 10:46:43 +00:00
|
|
|
if (!argvList.includes('disabled-config'))
|
2023-03-18 13:10:54 +00:00
|
|
|
runBuildConfig()
|
|
|
|
|
|
|
|
console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!')
|
2023-07-29 10:46:43 +00:00
|
|
|
}
|
2023-07-29 12:20:40 +00:00
|
|
|
catch (error: any) {
|
2023-07-29 10:46:43 +00:00
|
|
|
console.log(colors.red(`vite build error:\n${error}`))
|
2023-03-18 13:10:54 +00:00
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
runBuild()
|