| 12345678910111213141516171819202122232425262728293031323334 |
- // #!/usr/bin/env node
- import { runBuildConfig } from './buildConf';
- import chalk from 'chalk';
- const fs = require('fs');
- import pkg from '../../package.json';
- function removeFile(filename) {
- fs.unlink(filename, (err) => {
- if (err) {
- console.error('删除本地配置文件:', err);
- } else {
- console.log(`删除本地配置文件: ${filename} 成功!`);
- }
- });
- }
- export const runBuild = async () => {
- try {
- const argvList = process.argv.splice(2);
- // Generate configuration file
- if (!argvList.includes('disabled-config')) {
- runBuildConfig();
- }
- console.log(`✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
- removeFile('./target/dist/_app.config.js');
- } catch (error) {
- console.log(chalk.red('vite build error:\n' + error));
- process.exit(1);
- }
- };
- runBuild();
|