| 123456789101112131415161718192021222324 |
- import { OUTPUT_DIR, VERSION } from '../constant';
- import fs, { writeFileSync } from 'fs-extra';
- import chalk from 'chalk';
- import { getRootPath } from '../utils';
- import { nanoid } from 'nanoid';
- export const runBuild = async () => {
- try {
- try {
- const versionJson = {
- version: 'V' + nanoid(10),
- };
- fs.mkdirp(getRootPath(OUTPUT_DIR));
- writeFileSync(getRootPath(`${OUTPUT_DIR}/${VERSION}`), JSON.stringify(versionJson));
- console.log(chalk.cyan(`✨ [${VERSION}]`) + ` - file is build successfully!`);
- } catch (error) {
- console.log(chalk.red('configuration file configuration file failed to package:\n' + error));
- }
- } catch (error) {
- console.log(chalk.red('vite build error:\n' + error));
- process.exit(1);
- }
- };
- runBuild();
|