From 887c79d20242cd6839f5c74a396b95dacc65bb7a Mon Sep 17 00:00:00 2001 From: sorrycc Date: Thu, 7 Nov 2024 14:34:51 +0800 Subject: [PATCH] fix(create): generate alias don't work --- README.md | 2 +- src/cli.ts | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 24bfc92..4e41a9d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ $ npx serve dist -s - `tnf create --template=`: Create a new project with the given template. - `tnf build`: Build the project. - `tnf dev`: Start the development server. -- `tnf generate `: Generate a new page (or component and other types in the future). +- `tnf generate/g `: Generate a new page (or component and other types in the future). - `tnf preview`: Preview the product after building the project. ## API diff --git a/src/cli.ts b/src/cli.ts index f0c22d6..78bd268 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -10,11 +10,7 @@ import { import { generate } from './generate'; async function run(cwd: string) { - const argv = yargsParser(process.argv.slice(2), { - alias: { - g: 'generate', - }, - }); + const argv = yargsParser(process.argv.slice(2)); const cmd = argv._[0]; assert(cmd, 'Command is required'); switch (cmd) { @@ -44,6 +40,7 @@ async function run(cwd: string) { config: await loadConfig({ cwd }), }); case 'generate': + case 'g': const type = argv._[1] as string; const name = argv._[2] as string; assert(type, 'Type is required');