chore: update npm script

This commit is contained in:
vben
2020-10-26 21:45:43 +08:00
parent adffefd702
commit 2be166d6a1
9 changed files with 275 additions and 456 deletions

View File

@@ -1,15 +1,15 @@
import chalk from 'chalk';
import Koa from 'koa';
import inquirer from 'inquirer';
// import inquirer from 'inquirer';
import staticServer from 'koa-static';
import portfinder from 'portfinder';
import { resolve } from 'path';
import viteConfig from '../../vite.config';
import { getIPAddress } from '../utils';
import { runBuild } from './build';
// import { runBuild } from './postBuild';
const BUILD = 1;
const NO_BUILD = 2;
// const BUILD = 1;
// const NO_BUILD = 2;
// start server
const startApp = () => {
@@ -35,25 +35,25 @@ const startApp = () => {
});
};
export const runPreview = async () => {
const prompt = inquirer.prompt({
type: 'list',
message: 'Please select a preview method',
name: 'type',
choices: [
{
name: 'Preview after packaging',
value: BUILD,
},
{
name: `No packaging, preview directly (need to have dist file after packaging)`,
value: NO_BUILD,
},
],
});
const { type } = await prompt;
if (type === BUILD) {
await runBuild(true);
}
startApp();
};
// export const runPreview = async () => {
// // const prompt = inquirer.prompt({
// // type: 'list',
// // message: 'Please select a preview method',
// // name: 'type',
// // choices: [
// // {
// // name: 'Preview after packaging',
// // value: BUILD,
// // },
// // {
// // name: `No packaging, preview directly (need to have dist file after packaging)`,
// // value: NO_BUILD,
// // },
// // ],
// // });
// const { type } = await prompt;
// if (type === BUILD) {
// await runBuild(true);
// }
// };
startApp();