diff --git a/packages/feflow-cli/src/core/native/generator.ts b/packages/feflow-cli/src/core/native/generator.ts index 5879c925..1f60a209 100644 --- a/packages/feflow-cli/src/core/native/generator.ts +++ b/packages/feflow-cli/src/core/native/generator.ts @@ -51,11 +51,23 @@ const run = (ctx: any, name: string) => { module.exports = (ctx: any) => { ctx.commander.register('init', 'Create a new project', () => { - const { root, rootPkg } = ctx; + const { root, rootPkg, args } = ctx; + const { generator } = args; + const chooseGenerator = generator; + let isValidGenerator = false; + loadGenerator(root, rootPkg).then((generators: any) => { const options = generators.map((item: any) => { + if (item.name === chooseGenerator) { + isValidGenerator = true + } return item.desc }); + + if(isValidGenerator) { + return run(ctx, chooseGenerator); + } + if (generators.length) { inquirer.prompt([{ type: 'list', diff --git a/packages/feflow-cli/types/index.d.ts b/packages/feflow-cli/types/index.d.ts index 9b7b05b5..fc8cf9ee 100644 --- a/packages/feflow-cli/types/index.d.ts +++ b/packages/feflow-cli/types/index.d.ts @@ -1 +1,2 @@ -declare module '@feflow/report'; \ No newline at end of file +declare module '@feflow/report'; +declare module "request-promise" \ No newline at end of file