Skip to content

Commit a2a5a47

Browse files
author
Ramu Narasinga
committed
more comments added for prompt
1 parent 9d65690 commit a2a5a47

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

create-next-app/index.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,84 +51,121 @@ const program = new Commander.Command(packageJson.name)
5151
// https://www.npmjs.com/package/commander#action-handler
5252
.action((name) => {
5353
projectPath = name
54+
console.log("projectPath", projectPath);
5455
})
56+
// https://www.npmjs.com/package/commander#options
57+
// --ts option
58+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
5559
.option(
5660
'--ts, --typescript',
5761
`
5862
5963
Initialize as a TypeScript project. (default)
6064
`
6165
)
66+
// https://www.npmjs.com/package/commander#options
67+
// --js option
68+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
6269
.option(
6370
'--js, --javascript',
6471
`
6572
6673
Initialize as a JavaScript project.
6774
`
6875
)
76+
// https://www.npmjs.com/package/commander#options
77+
// --tailwind option
78+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
6979
.option(
7080
'--tailwind',
7181
`
7282
7383
Initialize with Tailwind CSS config. (default)
7484
`
7585
)
86+
// https://www.npmjs.com/package/commander#options
87+
// --eslint option
88+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
7689
.option(
7790
'--eslint',
7891
`
7992
8093
Initialize with eslint config.
8194
`
8295
)
96+
// https://www.npmjs.com/package/commander#options
97+
// --app option
98+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
8399
.option(
84100
'--app',
85101
`
86102
87103
Initialize as an App Router project.
88104
`
89105
)
106+
// https://www.npmjs.com/package/commander#options
107+
// --src-dir option
108+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
90109
.option(
91110
'--src-dir',
92111
`
93112
94113
Initialize inside a \`src/\` directory.
95114
`
96115
)
116+
// https://www.npmjs.com/package/commander#options
117+
//--import-alias option
118+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
97119
.option(
98120
'--import-alias <alias-to-configure>',
99121
`
100122
101123
Specify import alias to use (default "@/*").
102124
`
103125
)
126+
// https://www.npmjs.com/package/commander#options
127+
// --use-npm
128+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
104129
.option(
105130
'--use-npm',
106131
`
107132
108133
Explicitly tell the CLI to bootstrap the application using npm
109134
`
110135
)
136+
// https://www.npmjs.com/package/commander#options
137+
// --use-pnpm
138+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
111139
.option(
112140
'--use-pnpm',
113141
`
114142
115143
Explicitly tell the CLI to bootstrap the application using pnpm
116144
`
117145
)
146+
// https://www.npmjs.com/package/commander#options
147+
// --use-yarn
148+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
118149
.option(
119150
'--use-yarn',
120151
`
121152
122153
Explicitly tell the CLI to bootstrap the application using Yarn
123154
`
124155
)
156+
// https://www.npmjs.com/package/commander#options
157+
// --use-bun
158+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
125159
.option(
126160
'--use-bun',
127161
`
128162
129163
Explicitly tell the CLI to bootstrap the application using Bun
130164
`
131165
)
166+
// https://www.npmjs.com/package/commander#options
167+
// -e
168+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
132169
.option(
133170
'-e, --example [name]|[github-url]',
134171
`
@@ -138,6 +175,9 @@ const program = new Commander.Command(packageJson.name)
138175
any branch and/or subdirectory
139176
`
140177
)
178+
// https://www.npmjs.com/package/commander#options
179+
// --example-path <path-to-example>
180+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
141181
.option(
142182
'--example-path <path-to-example>',
143183
`
@@ -148,6 +188,9 @@ const program = new Commander.Command(packageJson.name)
148188
--example-path foo/bar
149189
`
150190
)
191+
// https://www.npmjs.com/package/commander#options
192+
// --example-path <path-to-example>
193+
// https://github.com/vercel/next.js/tree/canary/packages/create-next-app#non-interactive
151194
.option(
152195
'--reset-preferences',
153196
`
@@ -170,10 +213,14 @@ const packageManager = !!program.useNpm
170213

171214
async function run(): Promise<void> {
172215

216+
console.log("program.resetPreferences:", program.resetPreferences);
217+
173218
// a Conf object creation with projectName.
174219
// We do not know what Conf does yet and it is okay.
175220
const conf = new Conf({ projectName: 'create-next-app' })
176221

222+
console.log("conf", conf);
223+
177224
// My first thought, where did the program come from?
178225
// Let’s find out by looking outside the run() function.
179226
// We skipped Conf class but the program variable cannot be skipped.

0 commit comments

Comments
 (0)