create-next-pro-cli 0.1.28 → 0.1.30
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 +24 -7
- package/dist/bin.bun.js +27 -2
- package/dist/bin.node.js +27 -2
- package/dist/bin.node.js.map +1 -1
- package/package.json +1 -1
- package/templates/Projects/default/.env.example +9 -7
- 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
|
@@ -71,13 +71,16 @@ cd my-app
|
|
|
71
71
|
Then install dependencies with your preferred package manager:
|
|
72
72
|
|
|
73
73
|
```bash
|
|
74
|
-
bun install && bun run dev
|
|
74
|
+
bun install && cp .env.example .env && bun run dev
|
|
75
75
|
# or
|
|
76
|
-
npm install && npm run dev
|
|
76
|
+
npm install && cp .env.example .env && npm run dev
|
|
77
77
|
# or
|
|
78
|
-
pnpm install && pnpm run dev
|
|
78
|
+
pnpm install && cp .env.example .env && pnpm run dev
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
The creation result reports `.env.example` explicitly and provides the same
|
|
82
|
+
local-development commands in both human and JSON output.
|
|
83
|
+
|
|
81
84
|
An existing destination is rejected by default. `--force` only permits replacement of the requested child destination:
|
|
82
85
|
|
|
83
86
|
```bash
|
|
@@ -130,6 +133,9 @@ The Next.js route and its interface are separate: `src/app` owns routing while `
|
|
|
130
133
|
```text
|
|
131
134
|
my-app/
|
|
132
135
|
├── .env.example
|
|
136
|
+
├── .gitignore
|
|
137
|
+
├── .prettierignore
|
|
138
|
+
├── bun.lock
|
|
133
139
|
├── cnp.config.json
|
|
134
140
|
├── messages/
|
|
135
141
|
│ ├── en/
|
|
@@ -183,11 +189,15 @@ my-app/
|
|
|
183
189
|
│ ├── e2e/
|
|
184
190
|
│ ├── rendering/
|
|
185
191
|
│ └── unit/
|
|
192
|
+
├── scripts/
|
|
193
|
+
│ ├── audit.ts
|
|
194
|
+
│ └── package-manager.ts
|
|
186
195
|
├── next.config.ts
|
|
187
196
|
├── package.json
|
|
188
197
|
├── playwright.config.ts
|
|
189
198
|
├── pnpm-workspace.yaml
|
|
190
|
-
|
|
199
|
+
├── tsconfig.json
|
|
200
|
+
└── vitest.config.ts
|
|
191
201
|
```
|
|
192
202
|
|
|
193
203
|
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.
|
|
@@ -322,13 +332,13 @@ Interactive input is never attempted in JSON mode. Pass every required argument
|
|
|
322
332
|
|
|
323
333
|
## Environment and security
|
|
324
334
|
|
|
325
|
-
Generated projects contain `.env.example`, never the template's local `.env
|
|
335
|
+
Generated projects contain only the canonical `.env.example`, never the template's local `.env` or other environment copies. Copy it before configuring Auth.js:
|
|
326
336
|
|
|
327
337
|
```bash
|
|
328
|
-
cp .env.example .env
|
|
338
|
+
cp .env.example .env
|
|
329
339
|
```
|
|
330
340
|
|
|
331
|
-
|
|
341
|
+
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`.
|
|
332
342
|
|
|
333
343
|
## Quality
|
|
334
344
|
|
|
@@ -349,6 +359,13 @@ pnpm run check
|
|
|
349
359
|
|
|
350
360
|
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.
|
|
351
361
|
|
|
362
|
+
The template source keeps one official `bun.lock`. npm and pnpm create their
|
|
363
|
+
manager-specific lockfiles only in consumer worktrees; `.prettierignore` keeps
|
|
364
|
+
those generated locks outside formatting checks. The generated GitHub Actions
|
|
365
|
+
workflow validates all three managers independently and runs its npm job without
|
|
366
|
+
Bun installed. Explicit npm `allowScripts` and pnpm `allowBuilds` policies limit
|
|
367
|
+
native install scripts to the four dependencies required by the toolchain.
|
|
368
|
+
|
|
352
369
|
## Development
|
|
353
370
|
|
|
354
371
|
```bash
|
package/dist/bin.bun.js
CHANGED
|
@@ -6849,6 +6849,7 @@ import path8 from "path";
|
|
|
6849
6849
|
var TEMPLATE_DENY_NAMES = new Set([
|
|
6850
6850
|
".env",
|
|
6851
6851
|
".git",
|
|
6852
|
+
".gitignore",
|
|
6852
6853
|
".agent",
|
|
6853
6854
|
".cursor",
|
|
6854
6855
|
".next",
|
|
@@ -6860,7 +6861,7 @@ var TEMPLATE_DENY_NAMES = new Set([
|
|
|
6860
6861
|
]);
|
|
6861
6862
|
function isDistributableTemplatePath(relativePath) {
|
|
6862
6863
|
const segments = relativePath.split(path8.sep);
|
|
6863
|
-
return !segments.some((segment) => TEMPLATE_DENY_NAMES.has(segment) || segment.endsWith(".tsbuildinfo") || segment === ".DS_Store");
|
|
6864
|
+
return !segments.some((segment) => TEMPLATE_DENY_NAMES.has(segment) || segment.startsWith(".env") && segment !== ".env.example" || segment.endsWith(".tsbuildinfo") || segment === ".DS_Store");
|
|
6864
6865
|
}
|
|
6865
6866
|
async function templateManifest(root, fs) {
|
|
6866
6867
|
const files = [];
|
|
@@ -6891,7 +6892,20 @@ async function templateManifest(root, fs) {
|
|
|
6891
6892
|
}
|
|
6892
6893
|
async function validateScaffoldTemplate(root, fs) {
|
|
6893
6894
|
const manifest = await templateManifest(root, fs);
|
|
6894
|
-
for (const required of [
|
|
6895
|
+
for (const required of [
|
|
6896
|
+
"package.json",
|
|
6897
|
+
"tsconfig.json",
|
|
6898
|
+
".env.example",
|
|
6899
|
+
".gitignore.template",
|
|
6900
|
+
".prettierignore",
|
|
6901
|
+
"bun.lock",
|
|
6902
|
+
"pnpm-workspace.yaml",
|
|
6903
|
+
"vitest.config.ts",
|
|
6904
|
+
path8.join("scripts", "audit.ts"),
|
|
6905
|
+
path8.join("scripts", "package-manager.ts"),
|
|
6906
|
+
path8.join("tests", "consumer", "validate-template.ts"),
|
|
6907
|
+
path8.join(".github", "workflows", "quality.yml")
|
|
6908
|
+
]) {
|
|
6895
6909
|
if (!manifest.includes(required)) {
|
|
6896
6910
|
throw new CliError(`Required template file was not found: ${required}.`, {
|
|
6897
6911
|
code: "TEMPLATE_MISSING",
|
|
@@ -7046,6 +7060,17 @@ async function createProjectFromOptions(options, context) {
|
|
|
7046
7060
|
message: "Run the generated project checks before development.",
|
|
7047
7061
|
paths: [{ scope: "project", path: "package.json" }],
|
|
7048
7062
|
commands: ["bun run check", "npm run check", "pnpm run check"]
|
|
7063
|
+
},
|
|
7064
|
+
{
|
|
7065
|
+
kind: "run",
|
|
7066
|
+
required: false,
|
|
7067
|
+
message: "To run the project locally, copy the development environment example and start the development server.",
|
|
7068
|
+
paths: [{ scope: "project", path: ".env.example" }],
|
|
7069
|
+
commands: [
|
|
7070
|
+
`cd ${options.projectName} && cp .env.example .env && bun run dev`,
|
|
7071
|
+
`cd ${options.projectName} && cp .env.example .env && npm run dev`,
|
|
7072
|
+
`cd ${options.projectName} && cp .env.example .env && pnpm run dev`
|
|
7073
|
+
]
|
|
7049
7074
|
}
|
|
7050
7075
|
],
|
|
7051
7076
|
data: {
|
package/dist/bin.node.js
CHANGED
|
@@ -2070,6 +2070,7 @@ import path8 from "path";
|
|
|
2070
2070
|
var TEMPLATE_DENY_NAMES = /* @__PURE__ */ new Set([
|
|
2071
2071
|
".env",
|
|
2072
2072
|
".git",
|
|
2073
|
+
".gitignore",
|
|
2073
2074
|
".agent",
|
|
2074
2075
|
".cursor",
|
|
2075
2076
|
".next",
|
|
@@ -2082,7 +2083,7 @@ var TEMPLATE_DENY_NAMES = /* @__PURE__ */ new Set([
|
|
|
2082
2083
|
function isDistributableTemplatePath(relativePath) {
|
|
2083
2084
|
const segments = relativePath.split(path8.sep);
|
|
2084
2085
|
return !segments.some(
|
|
2085
|
-
(segment) => TEMPLATE_DENY_NAMES.has(segment) || segment.endsWith(".tsbuildinfo") || segment === ".DS_Store"
|
|
2086
|
+
(segment) => TEMPLATE_DENY_NAMES.has(segment) || segment.startsWith(".env") && segment !== ".env.example" || segment.endsWith(".tsbuildinfo") || segment === ".DS_Store"
|
|
2086
2087
|
);
|
|
2087
2088
|
}
|
|
2088
2089
|
async function templateManifest(root, fs) {
|
|
@@ -2114,7 +2115,20 @@ async function templateManifest(root, fs) {
|
|
|
2114
2115
|
}
|
|
2115
2116
|
async function validateScaffoldTemplate(root, fs) {
|
|
2116
2117
|
const manifest = await templateManifest(root, fs);
|
|
2117
|
-
for (const required of [
|
|
2118
|
+
for (const required of [
|
|
2119
|
+
"package.json",
|
|
2120
|
+
"tsconfig.json",
|
|
2121
|
+
".env.example",
|
|
2122
|
+
".gitignore.template",
|
|
2123
|
+
".prettierignore",
|
|
2124
|
+
"bun.lock",
|
|
2125
|
+
"pnpm-workspace.yaml",
|
|
2126
|
+
"vitest.config.ts",
|
|
2127
|
+
path8.join("scripts", "audit.ts"),
|
|
2128
|
+
path8.join("scripts", "package-manager.ts"),
|
|
2129
|
+
path8.join("tests", "consumer", "validate-template.ts"),
|
|
2130
|
+
path8.join(".github", "workflows", "quality.yml")
|
|
2131
|
+
]) {
|
|
2118
2132
|
if (!manifest.includes(required)) {
|
|
2119
2133
|
throw new CliError(`Required template file was not found: ${required}.`, {
|
|
2120
2134
|
code: "TEMPLATE_MISSING",
|
|
@@ -2320,6 +2334,17 @@ async function createProjectFromOptions(options, context) {
|
|
|
2320
2334
|
message: "Run the generated project checks before development.",
|
|
2321
2335
|
paths: [{ scope: "project", path: "package.json" }],
|
|
2322
2336
|
commands: ["bun run check", "npm run check", "pnpm run check"]
|
|
2337
|
+
},
|
|
2338
|
+
{
|
|
2339
|
+
kind: "run",
|
|
2340
|
+
required: false,
|
|
2341
|
+
message: "To run the project locally, copy the development environment example and start the development server.",
|
|
2342
|
+
paths: [{ scope: "project", path: ".env.example" }],
|
|
2343
|
+
commands: [
|
|
2344
|
+
`cd ${options.projectName} && cp .env.example .env && bun run dev`,
|
|
2345
|
+
`cd ${options.projectName} && cp .env.example .env && npm run dev`,
|
|
2346
|
+
`cd ${options.projectName} && cp .env.example .env && pnpm run dev`
|
|
2347
|
+
]
|
|
2323
2348
|
}
|
|
2324
2349
|
],
|
|
2325
2350
|
data: {
|