Skip to content

Commit

Permalink
fix(create): generate alias don't work
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Nov 7, 2024
1 parent 03a5fbb commit 887c79d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npx serve dist -s
- `tnf create <project-name> --template=<template-name>`: Create a new project with the given template.
- `tnf build`: Build the project.
- `tnf dev`: Start the development server.
- `tnf generate <type> <name>`: Generate a new page (or component and other types in the future).
- `tnf generate/g <type> <name>`: Generate a new page (or component and other types in the future).
- `tnf preview`: Preview the product after building the project.

## API
Expand Down
7 changes: 2 additions & 5 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 887c79d

Please sign in to comment.