Skip to content

Commit 7b6be5a

Browse files
committed
feat: add program
1 parent 0d0f6f3 commit 7b6be5a

File tree

2 files changed

+69
-51
lines changed

2 files changed

+69
-51
lines changed

src/core/command/create-vue-next/index.ts

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,82 @@ import createVueQuestions from '../../questions/vue/createVueQuestions'
33
import initialLog from '../create-vue-next/initialLog'
44
import installDeps from '../create-vue-next/install'
55
import copyTemplate from '../create-vue-next/copyTemplate'
6+
import packageJson from "../../../../package.json"
7+
import options from '../../utils/vue/options'
68
async function createProject() {
79
await initialLog()
810
await createVueQuestions()
911
await copyTemplate()
1012
await installDeps();
1113
}
12-
1314
export default async function createVueNext() {
1415
program
16+
.name(packageJson.name)
17+
.arguments('<project-name>')
18+
.version(packageJson.version)
1519
.description(`Create Vue Next. The Next Generation Vue Scaffolding Tool ⚡`)
16-
.action(async () => {
17-
createProject()
20+
.action((name: string) => {
21+
options.name = name.trim()
1822
})
23+
.option(
24+
'--ts, --typescript',
25+
`
26+
27+
28+
Initialize as a TypeScript project.
29+
`
30+
)
31+
.option(
32+
'--js, --javascript',
33+
`
34+
35+
36+
Initialize as a JavaScript project.
37+
`
38+
)
39+
.option(
40+
'--tailwind',
41+
`
42+
43+
44+
Initialize with Tailwind CSS config. (default)
45+
`
46+
)
47+
.option(
48+
'--eslint',
49+
`
50+
51+
Initialize with eslint config.
52+
`
53+
)
54+
.option(
55+
'--use-npm',
56+
`
57+
58+
Explicitly tell the CLI to bootstrap the application using npm
59+
`
60+
)
61+
.option(
62+
'--use-pnpm',
63+
`
64+
65+
Explicitly tell the CLI to bootstrap the application using pnpm
66+
`
67+
)
68+
.option(
69+
'--use-yarn',
70+
`
71+
72+
Explicitly tell the CLI to bootstrap the application using Yarn
73+
`
74+
)
75+
.option(
76+
'--use-bun',
77+
`
78+
79+
Explicitly tell the CLI to bootstrap the application using Bun
80+
`
81+
)
82+
.allowUnknownOption()
83+
.parse(process.argv);
1984
}

src/core/program.ts

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,4 @@
11
import { Command } from 'commander'
22
const program = new Command()
33

4-
export default program
5-
6-
7-
// const program = new Commander.Command(packageJson.name)
8-
// .description(packageJson.description)
9-
// .arguments('<project-directory>')
10-
// .option(
11-
// '--ts', '--typescript',
12-
// 'Initialize as a TypeScript project'
13-
// )
14-
// .option(
15-
// '--js', '--javascript',
16-
// 'Initialize as a JavaScript project'
17-
// )
18-
// .option(
19-
// '--tw', '--tailwind',
20-
// 'Initialize as a Tailwind project'
21-
// )
22-
// .option(
23-
// '--router', '--vue-router',
24-
// 'Initialize with Vue Router'
25-
// )
26-
// .option(
27-
// '--use-npm',
28-
// 'BootStrap project with npm'
29-
// )
30-
// .option(
31-
// '--use-pnpm',
32-
// 'BootStrap project with yarn'
33-
// )
34-
// .option(
35-
// '--use-pnpm',
36-
// 'BootStrap project with pnpm'
37-
// )
38-
// .option(
39-
// '--use-bun',
40-
// 'BootStrap project with bun'
41-
// )
42-
// .option(
43-
// '--reset-preferences',
44-
// `
45-
// Explicitly tell the CLI to reset any stored preferences
46-
// `
47-
// )
48-
// .allowUnknownOption()
49-
// .parse(process.argv);
50-
51-
// export default program
4+
export default program

0 commit comments

Comments
 (0)