mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-01-24 02:00:22 +08:00
fix: fix script preview no build
This commit is contained in:
parent
e3cbc9326e
commit
c2333f5d04
@ -1,6 +1,6 @@
|
|||||||
// #!/usr/bin/env node
|
// #!/usr/bin/env node
|
||||||
|
|
||||||
// import { sh } from 'tasksfile';
|
import { sh } from 'tasksfile';
|
||||||
|
|
||||||
import { argv } from 'yargs';
|
import { argv } from 'yargs';
|
||||||
import { runBuildConfig } from './buildConf';
|
import { runBuildConfig } from './buildConf';
|
||||||
@ -8,22 +8,25 @@ import { runUpdateHtml } from './updateHtml';
|
|||||||
import { errorConsole, successConsole } from '../utils';
|
import { errorConsole, successConsole } from '../utils';
|
||||||
import { startGzipStyle } from '../plugin/gzip/compress';
|
import { startGzipStyle } from '../plugin/gzip/compress';
|
||||||
|
|
||||||
export const runBuild = async () => {
|
export const runBuild = async (preview = false) => {
|
||||||
try {
|
try {
|
||||||
const argvList = argv._;
|
const argvList = argv._;
|
||||||
// let cmd = `cross-env NODE_ENV=production vite build`;
|
if (preview) {
|
||||||
// // await run('cross-env', ['NODE_ENV=production', 'vite', 'build']);
|
let cmd = `cross-env NODE_ENV=production vite build`;
|
||||||
// await sh(cmd, {
|
await sh(cmd, {
|
||||||
// async: true,
|
async: true,
|
||||||
// nopipe: true,
|
nopipe: true,
|
||||||
// });
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Generate configuration file
|
// Generate configuration file
|
||||||
if (!argvList.includes('no-conf')) {
|
if (!argvList.includes('no-conf')) {
|
||||||
await runBuildConfig();
|
await runBuildConfig();
|
||||||
}
|
}
|
||||||
await runUpdateHtml();
|
await runUpdateHtml();
|
||||||
await startGzipStyle();
|
if (!preview) {
|
||||||
|
await startGzipStyle();
|
||||||
|
}
|
||||||
successConsole('Vite Build successfully!');
|
successConsole('Vite Build successfully!');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
errorConsole('Vite Build Error\n' + error);
|
errorConsole('Vite Build Error\n' + error);
|
||||||
|
@ -53,7 +53,7 @@ export const runPreview = async () => {
|
|||||||
});
|
});
|
||||||
const { type } = await prompt;
|
const { type } = await prompt;
|
||||||
if (type === BUILD) {
|
if (type === BUILD) {
|
||||||
await runBuild();
|
await runBuild(true);
|
||||||
}
|
}
|
||||||
startApp();
|
startApp();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user