mirror of
https://gitee.com/bootx/dax-pay-ui.git
synced 2025-09-08 21:27:57 +00:00
chore: update npm script
This commit is contained in:
@@ -22,3 +22,5 @@ export const runChangeLog = async () => {
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
runChangeLog();
|
||||
|
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { argv } from 'yargs';
|
||||
|
||||
import { runChangeLog } from './changelog';
|
||||
import { runPreview } from './preview';
|
||||
// import { runPreserve } from './preserve';
|
||||
import { runBuild } from './build';
|
||||
|
||||
const task = (argv._ || [])[0];
|
||||
|
||||
console.log('Run Task: ' + chalk.cyan(task));
|
||||
|
||||
switch (task) {
|
||||
// change log
|
||||
case 'log':
|
||||
runChangeLog();
|
||||
break;
|
||||
|
||||
case 'build':
|
||||
runBuild();
|
||||
break;
|
||||
|
||||
// case 'preserve':
|
||||
// runPreserve();
|
||||
// break;
|
||||
|
||||
case 'preview':
|
||||
runPreview();
|
||||
break;
|
||||
|
||||
// TODO
|
||||
case 'gzip':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
export default {};
|
@@ -12,7 +12,7 @@ export const runBuild = async (preview = false) => {
|
||||
try {
|
||||
const argvList = argv._;
|
||||
if (preview) {
|
||||
let cmd = `cross-env NODE_ENV=production vite build`;
|
||||
let cmd = `npm run build`;
|
||||
await sh(cmd, {
|
||||
async: true,
|
||||
nopipe: true,
|
||||
@@ -33,3 +33,4 @@ export const runBuild = async (preview = false) => {
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
runBuild();
|
@@ -4,29 +4,26 @@ import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import { isEqual } from 'lodash';
|
||||
import { sh } from 'tasksfile';
|
||||
import {
|
||||
successConsole,
|
||||
// errorConsole
|
||||
} from '../utils';
|
||||
import { successConsole, errorConsole } from '../utils';
|
||||
|
||||
const resolve = (dir: string) => {
|
||||
return path.resolve(process.cwd(), dir);
|
||||
};
|
||||
|
||||
// const reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
|
||||
const reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
|
||||
|
||||
let NEED_INSTALL = false;
|
||||
|
||||
export async function runPreserve() {
|
||||
// rc.6 fixed
|
||||
// const cwdPath = process.cwd();
|
||||
// if (reg.test(cwdPath)) {
|
||||
// errorConsole(
|
||||
// 'Do not include Chinese, Japanese or Korean in the full path of the project directory, please modify the directory name and run again!'
|
||||
// );
|
||||
// errorConsole('项目目录全路径请勿包含中文、日文、韩文,请修改目录名后再次重新运行!');
|
||||
// process.exit(1);
|
||||
// }
|
||||
const cwdPath = process.cwd();
|
||||
if (reg.test(cwdPath)) {
|
||||
errorConsole(
|
||||
'Do not include Chinese, Japanese or Korean in the full path of the project directory, please modify the directory name and run again!'
|
||||
);
|
||||
errorConsole('项目目录全路径请勿包含中文、日文、韩文,请修改目录名后再次重新运行!');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
fs.mkdirp(resolve('build/.cache'));
|
||||
function checkPkgUpdate() {
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user