create 支持 -d --dev 表示测试
This commit is contained in:
parent
d3edff0578
commit
e5ead8d947
|
|
@ -1 +1 @@
|
|||
export default function create(dirName: string, env: string): Promise<void>;
|
||||
export default function create(dirName: string, cmd: any): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ async function getMiniVersion() {
|
|||
});
|
||||
return versionsSort[0]['sdkVer'];
|
||||
}
|
||||
async function create(dirName, env) {
|
||||
async function create(dirName, cmd) {
|
||||
const nameOption = {
|
||||
type: 'input',
|
||||
name: 'name',
|
||||
|
|
@ -66,7 +66,7 @@ async function create(dirName, env) {
|
|||
default: dirName,
|
||||
};
|
||||
prompt.unshift(nameOption);
|
||||
const isDev = env === 'dev' || env === 'development';
|
||||
const isDev = cmd.dev ? true : false;
|
||||
const { name, version, description } = await inquirer_1.default.prompt(prompt);
|
||||
// 获取微信小程序稳定基础版本库
|
||||
const miniVersion = await getMiniVersion();
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ commander_1.default
|
|||
.description('build we chat mp of build on demand')
|
||||
.action(build_1.default);
|
||||
commander_1.default
|
||||
.command('create <name> [env]')
|
||||
.command('create <name>')
|
||||
.usage('<name>')
|
||||
// .option('-e, --env <env>', 'A env')
|
||||
.option('-d, --dev', 'dev')
|
||||
.description(`create a new project powered by ${config_1.CLI_NAME}`)
|
||||
.action(create_1.default);
|
||||
// output help information on unknown commands
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ async function getMiniVersion() {
|
|||
return versionsSort[0]['sdkVer'];
|
||||
}
|
||||
|
||||
export default async function create(dirName: string, env: string) {
|
||||
export default async function create(dirName: string, cmd: any) {
|
||||
const nameOption = {
|
||||
type: 'input',
|
||||
name: 'name',
|
||||
|
|
@ -98,8 +98,7 @@ export default async function create(dirName: string, env: string) {
|
|||
default: dirName,
|
||||
};
|
||||
prompt.unshift(nameOption);
|
||||
|
||||
const isDev = env === 'dev' || env === 'development';
|
||||
const isDev = cmd.dev ? true : false;
|
||||
|
||||
const { name, version, description }: PromptInput = await inquirer.prompt(
|
||||
prompt
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ program
|
|||
.description('build we chat mp of build on demand')
|
||||
.action(build);
|
||||
program
|
||||
.command('create <name> [env]')
|
||||
.command('create <name>')
|
||||
.usage('<name>')
|
||||
// .option('-e, --env <env>', 'A env')
|
||||
.option('-d, --dev', 'dev')
|
||||
.description(`create a new project powered by ${CLI_NAME}`)
|
||||
.action(create);
|
||||
// output help information on unknown commands
|
||||
|
|
|
|||
Loading…
Reference in New Issue