create-next-pro-cli 0.1.27 → 0.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -6
- package/dist/bin.bun.js +1933 -947
- package/dist/bin.node.js +2079 -998
- package/dist/bin.node.js.map +1 -1
- package/package.json +3 -2
- package/templates/Projects/default/.env.example +8 -6
- package/templates/Projects/default/.github/workflows/quality.yml +40 -9
- package/templates/Projects/default/.gitignore.template +33 -15
- package/templates/Projects/default/README.md +38 -9
- package/templates/Projects/default/bun.lock +120 -134
- package/templates/Projects/default/messages/en/_home.json +9 -2
- package/templates/Projects/default/messages/en/settings.json +9 -1
- package/templates/Projects/default/messages/en/userInfo.json +6 -1
- package/templates/Projects/default/messages/fr/_home.json +9 -2
- package/templates/Projects/default/messages/fr/settings.json +9 -1
- package/templates/Projects/default/messages/fr/userInfo.json +6 -1
- package/templates/Projects/default/next.config.ts +11 -0
- package/templates/Projects/default/package.json +7 -1
- package/templates/Projects/default/playwright.config.ts +29 -6
- package/templates/Projects/default/pnpm-workspace.yaml +2 -0
- package/templates/Projects/default/scripts/audit.ts +4 -0
- package/templates/Projects/default/scripts/package-manager.ts +68 -0
- package/templates/Projects/default/src/app/[locale]/(public)/_home/page.tsx +2 -2
- package/templates/Projects/default/src/app/[locale]/(public)/layout.tsx +1 -2
- package/templates/Projects/default/src/app/[locale]/(public)/login/page.tsx +6 -1
- package/templates/Projects/default/src/app/[locale]/(public)/register/page.tsx +6 -1
- package/templates/Projects/default/src/app/[locale]/(user)/userInfo/page.tsx +5 -2
- package/templates/Projects/default/src/app/[locale]/page.tsx +1 -4
- package/templates/Projects/default/src/lib/github/repository.ts +68 -0
- package/templates/Projects/default/src/ui/_global/GlobalMain.tsx +10 -5
- package/templates/Projects/default/src/ui/_global/ThemeToggle.tsx +18 -8
- package/templates/Projects/default/src/ui/_global/UserNav.tsx +5 -1
- package/templates/Projects/default/src/ui/_home/GitHubActions.tsx +57 -0
- package/templates/Projects/default/src/ui/_home/page-shell.tsx +16 -0
- package/templates/Projects/default/src/ui/_home/page-ui.tsx +24 -13
- package/templates/Projects/default/src/ui/dashboard/LogoutButton.tsx +1 -1
- package/templates/Projects/default/src/ui/dashboard/StatsCard.tsx +2 -2
- package/templates/Projects/default/src/ui/dashboard/WelcomeCard.tsx +4 -2
- package/templates/Projects/default/src/ui/dashboard/page-ui.tsx +0 -2
- package/templates/Projects/default/src/ui/settings/page-ui.tsx +45 -6
- package/templates/Projects/default/src/ui/userInfo/page-ui.tsx +54 -7
- package/templates/Projects/default/tests/consumer/validate-template.ts +57 -48
- package/templates/Projects/default/tests/e2e/template-remediation.playwright.ts +47 -4
- package/templates/Projects/default/tests/unit/csp.test.ts +1 -1
- package/templates/Projects/default/tests/unit/github-repository.test.ts +45 -0
- package/templates/Projects/default/tests/unit/package-manager.test.ts +51 -0
- package/templates/Projects/default/tests/unit/template-baseline.test.ts +52 -0
- package/templates/Projects/default/tests/unit/user-nav.test.tsx +52 -0
- package/templates/Projects/default/tsconfig.json +2 -1
- package/templates/Projects/default/vitest.config.ts +10 -0
package/README.md
CHANGED
|
@@ -117,6 +117,8 @@ create-next-pro rmpage account.security
|
|
|
117
117
|
create-next-pro rmpage
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
`addlanguage` copies every message file from the configured default locale. The command reports each copied path and emits a required `translate` next step: the copied source-language text must be translated before the locale is ready to ship.
|
|
121
|
+
|
|
120
122
|
`addpage` creates `layout`, `page`, and `loading` files by default. Available long options are `--layout`, `--page`, `--loading`, `--not-found`, `--error`, `--global-error`, `--route`, `--template`, and `--default`. The historical short forms remain available.
|
|
121
123
|
|
|
122
124
|
`rmpage` only lists routes that contain an actual `page.tsx`. Next.js route groups and technical directories are hidden. Removal is confined to the project and preserves shared parent directories and unrelated files.
|
|
@@ -128,6 +130,9 @@ The Next.js route and its interface are separate: `src/app` owns routing while `
|
|
|
128
130
|
```text
|
|
129
131
|
my-app/
|
|
130
132
|
├── .env.example
|
|
133
|
+
├── .gitignore
|
|
134
|
+
├── .prettierignore
|
|
135
|
+
├── bun.lock
|
|
131
136
|
├── cnp.config.json
|
|
132
137
|
├── messages/
|
|
133
138
|
│ ├── en/
|
|
@@ -181,11 +186,15 @@ my-app/
|
|
|
181
186
|
│ ├── e2e/
|
|
182
187
|
│ ├── rendering/
|
|
183
188
|
│ └── unit/
|
|
189
|
+
├── scripts/
|
|
190
|
+
│ ├── audit.ts
|
|
191
|
+
│ └── package-manager.ts
|
|
184
192
|
├── next.config.ts
|
|
185
193
|
├── package.json
|
|
186
194
|
├── playwright.config.ts
|
|
187
195
|
├── pnpm-workspace.yaml
|
|
188
|
-
|
|
196
|
+
├── tsconfig.json
|
|
197
|
+
└── vitest.config.ts
|
|
189
198
|
```
|
|
190
199
|
|
|
191
200
|
Template working files (`.env`, the nested Git repository, caches, screenshots, and test results) are not copied into generated projects. The CLI creates `cnp.config.json` with the project name and selected alias.
|
|
@@ -200,9 +209,11 @@ create-next-pro-cli/
|
|
|
200
209
|
│ ├── cli/
|
|
201
210
|
│ │ ├── completion.ts
|
|
202
211
|
│ │ ├── onboarding.ts
|
|
212
|
+
│ │ ├── output.ts
|
|
203
213
|
│ │ └── registry.ts
|
|
204
214
|
│ ├── core/
|
|
205
215
|
│ │ ├── contracts.ts
|
|
216
|
+
│ │ ├── operations.ts
|
|
206
217
|
│ │ ├── page-catalog.ts
|
|
207
218
|
│ │ ├── project-paths.ts
|
|
208
219
|
│ │ └── template-manifest.ts
|
|
@@ -222,10 +233,11 @@ create-next-pro-cli/
|
|
|
222
233
|
│ ├── index.ts
|
|
223
234
|
│ └── scaffold.ts
|
|
224
235
|
├── templates/
|
|
225
|
-
│ ├──
|
|
226
|
-
│ ├──
|
|
236
|
+
│ ├── Component/
|
|
237
|
+
│ ├── Page/
|
|
227
238
|
│ ├── Projects/default/
|
|
228
|
-
│
|
|
239
|
+
│ ├── Api/
|
|
240
|
+
│ └── Lib/
|
|
229
241
|
├── create-next-pro-completion.sh
|
|
230
242
|
├── create-next-pro-completion.zsh
|
|
231
243
|
├── package.json
|
|
@@ -239,19 +251,91 @@ The CLI registry resolves commands to a shared asynchronous interface. The core
|
|
|
239
251
|
```text
|
|
240
252
|
--help Show help
|
|
241
253
|
--version, -v Show the version
|
|
254
|
+
--json Emit one deterministic JSON document
|
|
242
255
|
--reconfigure Run CLI configuration again
|
|
243
256
|
--force Replace an existing project destination
|
|
244
257
|
```
|
|
245
258
|
|
|
259
|
+
`--json` can appear before or after a command. It disables prompts, colors, banners, and incidental logs. Standard output contains exactly one JSON document followed by a newline, while standard error remains empty even when the command fails. Internal shell completion continues to use its separate line-based protocol.
|
|
260
|
+
|
|
261
|
+
## Human and agent output
|
|
262
|
+
|
|
263
|
+
Human output names every created, copied, updated, deleted, unchanged, or skipped resource with an absolute path. It ends with a summary and only the next steps that are still required. For example, adding a locale clearly reports that its messages were copied from the source locale:
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
COPIED translation-messages: /workspace/my-app/messages/de/dashboard.json from /workspace/my-app/messages/en/dashboard.json (locale="de", sourceLocale="en")
|
|
267
|
+
UPDATED messages-registry: /workspace/my-app/src/lib/i18n/messages.ts
|
|
268
|
+
SUCCESS: Added locale "de" by copying 7 files from "en".
|
|
269
|
+
NEXT [translate]: Translate every copied message from en to de; the copied text is not ready for delivery.
|
|
270
|
+
/workspace/my-app/messages/de/dashboard.json
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Agentic usage adds `--json`:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
create-next-pro addapi health --json
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
The versioned document has stable status, event, next-step, and error fields:
|
|
280
|
+
|
|
281
|
+
```json
|
|
282
|
+
{
|
|
283
|
+
"schemaVersion": 1,
|
|
284
|
+
"command": "addapi",
|
|
285
|
+
"status": "success",
|
|
286
|
+
"exitCode": 0,
|
|
287
|
+
"summary": "Added API route \"health\".",
|
|
288
|
+
"projectRoot": "/workspace/my-app",
|
|
289
|
+
"events": [
|
|
290
|
+
{
|
|
291
|
+
"sequence": 1,
|
|
292
|
+
"action": "created",
|
|
293
|
+
"resource": "directory",
|
|
294
|
+
"role": "api-directory",
|
|
295
|
+
"scope": "project",
|
|
296
|
+
"path": "src/app/api/health"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"sequence": 2,
|
|
300
|
+
"action": "created",
|
|
301
|
+
"resource": "file",
|
|
302
|
+
"role": "api-route",
|
|
303
|
+
"scope": "project",
|
|
304
|
+
"path": "src/app/api/health/route.ts"
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
"nextSteps": [
|
|
308
|
+
{
|
|
309
|
+
"kind": "review",
|
|
310
|
+
"required": true,
|
|
311
|
+
"message": "Replace the example response and review validation and authentication.",
|
|
312
|
+
"paths": [
|
|
313
|
+
{
|
|
314
|
+
"scope": "project",
|
|
315
|
+
"path": "src/app/api/health/route.ts"
|
|
316
|
+
}
|
|
317
|
+
]
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
"error": null
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Paths inside events and next steps are relative to their named scope. Applicable absolute roots are exposed as `projectRoot`, `configRoot`, and `homeRoot`. Events never contain file contents, environment values, credentials, or secrets.
|
|
325
|
+
|
|
326
|
+
Command statuses are `success`, `unchanged`, `cancelled`, and `failed`. Successful mutations, idempotent no-op results, and user cancellations exit with code `0`; only `failed` exits with code `1`. Stable error codes include `INVALID_ARGUMENT`, `CONFIG_NOT_FOUND`, `I18N_DISABLED`, `TARGET_EXISTS`, `TARGET_NOT_FOUND`, `TEMPLATE_MISSING`, `UNSAFE_PATH`, `INCONSISTENT_LOCALE`, `FILESYSTEM_ERROR`, `INTERACTIVE_INPUT_REQUIRED`, and `ONBOARDING_REQUIRED`.
|
|
327
|
+
|
|
328
|
+
Interactive input is never attempted in JSON mode. Pass every required argument explicitly. On a new machine, run the CLI once without `--json` to complete onboarding; `--reconfigure --json` is intentionally rejected.
|
|
329
|
+
|
|
246
330
|
## Environment and security
|
|
247
331
|
|
|
248
|
-
Generated projects contain `.env.example`, never the template's local `.env
|
|
332
|
+
Generated projects contain only the canonical `.env.example`, never the template's local `.env` or other environment copies. Copy it before configuring Auth.js:
|
|
249
333
|
|
|
250
334
|
```bash
|
|
251
335
|
cp .env.example .env.local
|
|
252
336
|
```
|
|
253
337
|
|
|
254
|
-
|
|
338
|
+
The Google and Auth.js values shipped in `.env.example` are intentionally public, limited development credentials. Replace all of them before production use. Nested Git repositories, caches, installed dependencies, Playwright artifacts, agent context, the local `.env`, and every non-canonical `.env*` file are excluded from generated projects and the npm package. For checks without authentication, use `AUTH_DISABLED=true`.
|
|
255
339
|
|
|
256
340
|
## Quality
|
|
257
341
|
|
|
@@ -272,6 +356,13 @@ pnpm run check
|
|
|
272
356
|
|
|
273
357
|
Validation covers formatting, linting, TypeScript, Vitest, the Next.js build, and the rendering contract. Use `npm pack --dry-run --json` to inspect the CLI's distributable contents.
|
|
274
358
|
|
|
359
|
+
The template source keeps one official `bun.lock`. npm and pnpm create their
|
|
360
|
+
manager-specific lockfiles only in consumer worktrees; `.prettierignore` keeps
|
|
361
|
+
those generated locks outside formatting checks. The generated GitHub Actions
|
|
362
|
+
workflow validates all three managers independently and runs its npm job without
|
|
363
|
+
Bun installed. Explicit npm `allowScripts` and pnpm `allowBuilds` policies limit
|
|
364
|
+
native install scripts to the four dependencies required by the toolchain.
|
|
365
|
+
|
|
275
366
|
## Development
|
|
276
367
|
|
|
277
368
|
```bash
|