create-next-pro-cli 0.1.26 → 0.1.28
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 +281 -291
- package/create-next-pro-completion.sh +8 -38
- package/create-next-pro-completion.zsh +13 -0
- package/dist/bin.bun.js +2265 -794
- package/dist/bin.node.js +2425 -805
- package/dist/bin.node.js.map +1 -1
- package/package.json +50 -27
- package/templates/Projects/default/.env.example +17 -0
- package/templates/Projects/default/.github/workflows/quality.yml +24 -0
- package/templates/Projects/default/.gitignore.template +47 -0
- package/templates/Projects/default/.prettierignore +3 -0
- package/templates/Projects/default/README.md +52 -108
- package/templates/Projects/default/bun.lock +1152 -0
- package/templates/Projects/default/eslint.config.mjs +27 -11
- package/templates/Projects/default/messages/en/_global_ui.json +23 -10
- package/templates/Projects/default/messages/en.ts +17 -2
- package/templates/Projects/default/messages/fr/_global_ui.json +23 -10
- package/templates/Projects/default/messages/fr.ts +17 -2
- package/templates/Projects/default/next.config.ts +43 -3
- package/templates/Projects/default/package.json +42 -24
- package/templates/Projects/default/playwright.config.ts +26 -0
- package/templates/Projects/default/pnpm-workspace.yaml +5 -0
- package/templates/Projects/default/public/{cnp-logo.svg → logo.svg} +1 -1
- package/templates/Projects/default/src/app/[locale]/(public)/layout.tsx +8 -1
- package/templates/Projects/default/src/app/[locale]/(public)/login/page.tsx +8 -0
- package/templates/Projects/default/src/app/[locale]/(public)/register/page.tsx +8 -0
- package/templates/Projects/default/src/app/[locale]/(user)/dashboard/error.tsx +25 -0
- package/templates/Projects/default/src/app/[locale]/(user)/dashboard/loading.tsx +5 -0
- package/templates/Projects/default/src/app/[locale]/(user)/{Dashboard → dashboard}/page.tsx +1 -1
- package/templates/Projects/default/src/app/[locale]/(user)/layout.tsx +24 -2
- package/templates/Projects/default/src/app/[locale]/(user)/settings/loading.tsx +5 -0
- package/templates/Projects/default/src/app/[locale]/(user)/{Settings → settings}/page.tsx +1 -2
- package/templates/Projects/default/src/app/[locale]/(user)/userInfo/loading.tsx +5 -0
- package/templates/Projects/default/src/app/[locale]/(user)/{UserInfo → userInfo}/page.tsx +1 -2
- package/templates/Projects/default/src/app/[locale]/layout.tsx +34 -10
- package/templates/Projects/default/src/app/[locale]/loading.tsx +0 -9
- package/templates/Projects/default/src/app/[locale]/not-found.tsx +6 -15
- package/templates/Projects/default/src/app/[locale]/page.tsx +10 -1
- package/templates/Projects/default/src/app/api/auth/[...nextauth]/route.ts +8 -60
- package/templates/Projects/default/src/app/not-found.tsx +1 -1
- package/templates/Projects/default/src/app/sitemap.ts +2 -2
- package/templates/Projects/default/src/app/styles/globals.css +166 -113
- package/templates/Projects/default/src/auth.ts +20 -0
- package/templates/Projects/default/src/config.ts +3 -3
- package/templates/Projects/default/src/env.ts +65 -0
- package/templates/Projects/default/src/lib/i18n/messages.ts +8 -0
- package/templates/Projects/default/src/lib/i18n/request.ts +2 -16
- package/templates/Projects/default/src/lib/security/csp.ts +16 -0
- package/templates/Projects/default/src/lib/utils.ts +2 -1
- package/templates/Projects/default/src/proxy.ts +13 -0
- package/templates/Projects/default/src/ui/_global/BackButton.tsx +4 -2
- package/templates/Projects/default/src/ui/_global/Button.tsx +3 -8
- package/templates/Projects/default/src/ui/_global/GlobalHeader.tsx +10 -28
- package/templates/Projects/default/src/ui/_global/GlobalMain.tsx +1 -1
- package/templates/Projects/default/src/ui/_global/LocaleSwitcher.tsx +9 -10
- package/templates/Projects/default/src/ui/_global/PublicNav.tsx +51 -17
- package/templates/Projects/default/src/ui/_global/ThemeToggle.tsx +45 -39
- package/templates/Projects/default/src/ui/_global/UserNav.tsx +6 -6
- package/templates/Projects/default/src/ui/_home/page-ui.tsx +5 -7
- package/templates/Projects/default/src/ui/{Dashboard → dashboard}/LogoutButton.tsx +9 -7
- package/templates/Projects/default/src/ui/{Dashboard → dashboard}/StatsCard.tsx +4 -4
- package/templates/Projects/default/src/ui/{Dashboard → dashboard}/page-ui.tsx +7 -8
- package/templates/Projects/default/src/ui/login/page-ui.tsx +36 -0
- package/templates/Projects/default/src/ui/register/page-ui.tsx +38 -0
- package/templates/Projects/default/src/ui/settings/page-ui.tsx +15 -0
- package/templates/Projects/default/src/ui/userInfo/page-ui.tsx +15 -0
- package/templates/Projects/default/tailwind.config.ts +81 -1
- package/templates/Projects/default/tests/consumer/validate-template.ts +66 -0
- package/templates/Projects/default/tests/e2e/template-remediation.playwright.ts +106 -0
- package/templates/Projects/default/tests/rendering/verify-rendering.ts +56 -0
- package/templates/Projects/default/tests/unit/csp.test.ts +19 -0
- package/templates/Projects/default/tests/unit/env.test.ts +76 -0
- package/templates/Projects/default/tsconfig.json +6 -6
- package/templates/Projects/default/example.env +0 -8
- package/templates/Projects/default/messages/getMergedMessages.ts +0 -31
- package/templates/Projects/default/middleware.ts +0 -11
- package/templates/Projects/default/src/app/[locale]/(public)/Login/page.tsx +0 -6
- package/templates/Projects/default/src/app/[locale]/(public)/Register/page.tsx +0 -6
- package/templates/Projects/default/src/app/[locale]/(user)/Dashboard/error.tsx +0 -38
- package/templates/Projects/default/src/app/[locale]/(user)/Dashboard/loading.tsx +0 -10
- package/templates/Projects/default/src/app/[locale]/(user)/Settings/loading.tsx +0 -17
- package/templates/Projects/default/src/app/[locale]/(user)/UserInfo/loading.tsx +0 -17
- package/templates/Projects/default/src/app/api/auth/post-login/route.ts +0 -26
- package/templates/Projects/default/src/app/api/hello/route.ts +0 -5
- package/templates/Projects/default/src/app/layout.tsx +0 -11
- package/templates/Projects/default/src/app/page.tsx +0 -6
- package/templates/Projects/default/src/auth.config.ts +0 -0
- package/templates/Projects/default/src/lib/auth/disconnect.ts +0 -11
- package/templates/Projects/default/src/lib/auth/isConnected.ts +0 -18
- package/templates/Projects/default/src/lib/sample/example.ts +0 -3
- package/templates/Projects/default/src/lib/sample/index.ts +0 -3
- package/templates/Projects/default/src/ui/Login/page-ui.tsx +0 -22
- package/templates/Projects/default/src/ui/Register/page-ui.tsx +0 -26
- package/templates/Projects/default/src/ui/Settings/page-ui.tsx +0 -17
- package/templates/Projects/default/src/ui/UserInfo/page-ui.tsx +0 -17
- /package/templates/Projects/default/messages/en/{Dashboard.json → dashboard.json} +0 -0
- /package/templates/Projects/default/messages/en/{Login.json → login.json} +0 -0
- /package/templates/Projects/default/messages/en/{Register.json → register.json} +0 -0
- /package/templates/Projects/default/messages/en/{Settings.json → settings.json} +0 -0
- /package/templates/Projects/default/messages/en/{UserInfo.json → userInfo.json} +0 -0
- /package/templates/Projects/default/messages/fr/{Dashboard.json → dashboard.json} +0 -0
- /package/templates/Projects/default/messages/fr/{Login.json → login.json} +0 -0
- /package/templates/Projects/default/messages/fr/{Register.json → register.json} +0 -0
- /package/templates/Projects/default/messages/fr/{Settings.json → settings.json} +0 -0
- /package/templates/Projects/default/messages/fr/{UserInfo.json → userInfo.json} +0 -0
- /package/templates/Projects/default/public/{cnp-logo.png → logo.png} +0 -0
- /package/templates/Projects/default/src/ui/{Dashboard → dashboard}/WelcomeCard.tsx +0 -0
package/README.md
CHANGED
|
@@ -1,373 +1,363 @@
|
|
|
1
|
-
<img src="./public/cnp-banner.svg" alt="create-next-pro
|
|
2
|
-
|
|
3
|
-
## Runtime Support
|
|
4
|
-
|
|
5
|
-
[](https://bun.sh)
|
|
6
|
-
[](https://nodejs.org)
|
|
7
|
-
|
|
8
|
-
<!-- [](https://deno.land) -->
|
|
9
|
-
|
|
10
|
-

|
|
11
|
-

|
|
12
|
-

|
|
13
|
-
|
|
14
|
-

|
|
15
|
-

|
|
16
|
-

|
|
17
|
-

|
|
18
|
-
|
|
19
|
-

|
|
20
|
-

|
|
21
|
-
[](https://www.conventionalcommits.org/en/v1.0.0/)
|
|
22
|
-
|
|
23
|
-
> ⚠️ This project is under active development and currently in beta testing. You may encounter bugs or crashes until the first release. Not all features are implemented yet, and contributions are welcome!
|
|
24
|
-
|
|
25
|
-
Initially, changes will be accepted or rejected by the creator, but in a few weeks, contributions will be submitted to a community vote.
|
|
1
|
+
<img src="./public/cnp-banner.svg" alt="create-next-pro" width="100%" />
|
|
26
2
|
|
|
27
3
|
# create-next-pro-cli
|
|
28
4
|
|
|
29
|
-
|
|
5
|
+
[](https://bun.sh)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](https://www.npmjs.com/package/create-next-pro-cli)
|
|
8
|
+
[](https://www.npmjs.com/package/create-next-pro-cli)
|
|
9
|
+
[](https://github.com/Rising-Corporation/create-next-pro-cli/actions/workflows/ci.yml)
|
|
10
|
+
[](https://github.com/Rising-Corporation/create-next-pro-cli)
|
|
11
|
+
[](https://github.com/Rising-Corporation/create-next-pro-cli/issues)
|
|
12
|
+
[](./LICENSE)
|
|
13
|
+
[](https://www.conventionalcommits.org/en/v1.0.0/)
|
|
30
14
|
|
|
31
|
-
|
|
15
|
+
`create-next-pro` generates and evolves Next.js 16 projects with TypeScript, App Router, React 19, Tailwind CSS 4, `next-intl`, and Auth.js.
|
|
32
16
|
|
|
33
|
-
|
|
34
|
-
>
|
|
35
|
-
> ℹ️ To enable autocompletion automatically, add the `--trust` option when installing globally with Bun:
|
|
36
|
-
>
|
|
37
|
-
> ```bash
|
|
38
|
-
> bun install -g create-next-pro-cli --trust
|
|
39
|
-
> ```
|
|
17
|
+
The launcher uses Bun when available and automatically falls back to Node.js. No runtime selection is persisted. Generated projects are validated with Bun, npm, and pnpm.
|
|
40
18
|
|
|
41
|
-
|
|
19
|
+
## Purpose
|
|
42
20
|
|
|
43
|
-
|
|
21
|
+
`create-next-pro` provides a reproducible, production-oriented Next.js foundation and commands to evolve it without manually relocating files. The scaffolder separates App Router routes, interfaces under `src/ui`, translated messages, and application libraries to keep the structure clear as the application grows.
|
|
44
22
|
|
|
45
|
-
|
|
23
|
+
The CLI is built around a runtime-independent core, injectable terminal and file-system adapters, and generators confined to the project root. The distributed template includes internationalization, authentication, a CSP policy, environment validation, and automated quality checks.
|
|
46
24
|
|
|
47
|
-
|
|
25
|
+
## Main features
|
|
48
26
|
|
|
49
|
-
|
|
27
|
+
- direct or interactive Next.js 16 project creation;
|
|
28
|
+
- Bun-first CLI execution with an automatic Node.js fallback;
|
|
29
|
+
- generated projects compatible with Bun, npm, and pnpm;
|
|
30
|
+
- generation of pages, components, libraries, and API routes;
|
|
31
|
+
- addition of `next-intl` locales and messages;
|
|
32
|
+
- direct or interactive page removal with a tree-based selector;
|
|
33
|
+
- nested routes and interfaces using `Parent.Child` notation;
|
|
34
|
+
- customizable import aliases such as `@/*` or `@core/*`;
|
|
35
|
+
- dedicated Bash and Zsh completion;
|
|
36
|
+
- confined file operations and allowlist-based template copying;
|
|
37
|
+
- Auth.js, CSP, environment validation, Vitest, and Playwright in the template.
|
|
50
38
|
|
|
51
|
-
|
|
39
|
+
## Requirements
|
|
52
40
|
|
|
53
|
-
|
|
41
|
+
- Node.js 24 or later, or Bun 1.3 or later, to run the CLI.
|
|
42
|
+
- Bun 1.3+, the npm version bundled with Node.js 24+, or pnpm 11+ for generated projects.
|
|
54
43
|
|
|
55
|
-
##
|
|
56
|
-
|
|
57
|
-
### Create a new project
|
|
44
|
+
## Installation
|
|
58
45
|
|
|
59
46
|
```bash
|
|
60
|
-
create-next-pro
|
|
47
|
+
bun install --global create-next-pro-cli
|
|
48
|
+
# or
|
|
49
|
+
npm install --global create-next-pro-cli
|
|
50
|
+
# or
|
|
51
|
+
pnpm add --global create-next-pro-cli
|
|
61
52
|
```
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
### Create a page
|
|
54
|
+
Without a global installation:
|
|
66
55
|
|
|
67
56
|
```bash
|
|
68
|
-
create-next-pro
|
|
57
|
+
bunx create-next-pro-cli my-app
|
|
58
|
+
npx create-next-pro-cli my-app
|
|
59
|
+
pnpm dlx create-next-pro-cli my-app
|
|
69
60
|
```
|
|
70
61
|
|
|
71
|
-
|
|
62
|
+
On first launch, the onboarding assistant offers to install Bash or Zsh completion. Run `create-next-pro --reconfigure` to start the assistant again without duplicating the shell configuration.
|
|
63
|
+
|
|
64
|
+
## Create a project
|
|
72
65
|
|
|
73
66
|
```bash
|
|
74
|
-
create-next-pro
|
|
67
|
+
create-next-pro my-app
|
|
68
|
+
cd my-app
|
|
75
69
|
```
|
|
76
70
|
|
|
77
|
-
|
|
71
|
+
Then install dependencies with your preferred package manager:
|
|
78
72
|
|
|
79
73
|
```bash
|
|
80
|
-
|
|
74
|
+
bun install && bun run dev
|
|
75
|
+
# or
|
|
76
|
+
npm install && npm run dev
|
|
77
|
+
# or
|
|
78
|
+
pnpm install && pnpm run dev
|
|
81
79
|
```
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
An existing destination is rejected by default. `--force` only permits replacement of the requested child destination:
|
|
84
82
|
|
|
85
83
|
```bash
|
|
86
|
-
create-next-pro
|
|
84
|
+
create-next-pro my-app --force
|
|
87
85
|
```
|
|
88
86
|
|
|
89
|
-
|
|
87
|
+
Without a project name, the CLI opens the interactive assistant. The import alias must follow the `<prefix>/*` form, such as `@/*` or `@core/*`. It is written to `tsconfig.json` and `cnp.config.json`, then reused by the generators.
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
create-next-pro addcomponent MyComponent -P ParentPage.ChildPage
|
|
93
|
-
```
|
|
89
|
+
## Project evolution commands
|
|
94
90
|
|
|
95
|
-
|
|
91
|
+
Run the following commands from the root of a generated project.
|
|
96
92
|
|
|
97
93
|
```bash
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
# Simple or nested pages
|
|
95
|
+
create-next-pro addpage profile
|
|
96
|
+
create-next-pro addpage account.security
|
|
100
97
|
|
|
101
|
-
|
|
98
|
+
# Global components or components attached to a page
|
|
99
|
+
create-next-pro addcomponent Alert
|
|
100
|
+
create-next-pro addcomponent PasswordForm --page account.security
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
create-next-pro addlib
|
|
105
|
-
|
|
102
|
+
# Libraries and modules
|
|
103
|
+
create-next-pro addlib analytics
|
|
104
|
+
create-next-pro addlib analytics.trackEvent
|
|
106
105
|
|
|
107
|
-
|
|
106
|
+
# Routes API
|
|
107
|
+
create-next-pro addapi health
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
create-next-pro
|
|
111
|
-
|
|
109
|
+
# Locales and translations
|
|
110
|
+
create-next-pro addlanguage de
|
|
111
|
+
create-next-pro addtext dashboard.welcome "Welcome"
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
# Direct removal
|
|
114
|
+
create-next-pro rmpage account.security
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
create-next-pro rmpage
|
|
116
|
+
# Tree-based autocomplete menu with confirmation
|
|
117
|
+
create-next-pro rmpage
|
|
117
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.
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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.
|
|
123
|
+
|
|
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.
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
## Generated project architecture
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
The Next.js route and its interface are separate: `src/app` owns routing while `src/ui` owns page components. Translations remain organized by locale and domain.
|
|
128
129
|
|
|
129
|
-
```
|
|
130
|
-
my-
|
|
131
|
-
.
|
|
132
|
-
├──
|
|
133
|
-
├── messages
|
|
134
|
-
│ ├── en
|
|
135
|
-
│ │ ├── Dashboard.json
|
|
130
|
+
```text
|
|
131
|
+
my-app/
|
|
132
|
+
├── .env.example
|
|
133
|
+
├── cnp.config.json
|
|
134
|
+
├── messages/
|
|
135
|
+
│ ├── en/
|
|
136
136
|
│ │ ├── _global_ui.json
|
|
137
137
|
│ │ ├── _home.json
|
|
138
|
-
│ │ ├──
|
|
139
|
-
│ │ ├──
|
|
140
|
-
│ │ ├──
|
|
141
|
-
│ │
|
|
138
|
+
│ │ ├── dashboard.json
|
|
139
|
+
│ │ ├── login.json
|
|
140
|
+
│ │ ├── register.json
|
|
141
|
+
│ │ ├── settings.json
|
|
142
|
+
│ │ └── userInfo.json
|
|
142
143
|
│ ├── en.ts
|
|
143
|
-
│ ├── fr
|
|
144
|
-
│ │
|
|
145
|
-
│
|
|
146
|
-
|
|
147
|
-
│
|
|
148
|
-
│
|
|
149
|
-
|
|
150
|
-
│
|
|
151
|
-
│ ├──
|
|
152
|
-
│
|
|
153
|
-
├──
|
|
154
|
-
├──
|
|
155
|
-
|
|
156
|
-
├──
|
|
157
|
-
├──
|
|
158
|
-
├──
|
|
159
|
-
│
|
|
160
|
-
│ └── cnp-logo.svg
|
|
161
|
-
├── README.md
|
|
162
|
-
├── src
|
|
163
|
-
│ ├── app
|
|
164
|
-
│ │ ├── api
|
|
165
|
-
│ │ │ └── auth
|
|
166
|
-
│ │ │ ├── [...nextauth]
|
|
167
|
-
│ │ │ │ └── route.ts
|
|
168
|
-
│ │ │ └── post-login
|
|
169
|
-
│ │ │ └── route.ts
|
|
170
|
-
│ │ ├── favicon.ico
|
|
171
|
-
│ │ ├── layout.tsx
|
|
172
|
-
│ │ ├── [locale]
|
|
144
|
+
│ ├── fr/
|
|
145
|
+
│ │ └── ...
|
|
146
|
+
│ └── fr.ts
|
|
147
|
+
├── public/
|
|
148
|
+
│ ├── logo.png
|
|
149
|
+
│ └── logo.svg
|
|
150
|
+
├── src/
|
|
151
|
+
│ ├── app/
|
|
152
|
+
│ │ ├── [locale]/
|
|
153
|
+
│ │ │ ├── (public)/
|
|
154
|
+
│ │ │ │ ├── _home/
|
|
155
|
+
│ │ │ │ ├── login/
|
|
156
|
+
│ │ │ │ └── register/
|
|
157
|
+
│ │ │ ├── (user)/
|
|
158
|
+
│ │ │ │ ├── dashboard/
|
|
159
|
+
│ │ │ │ ├── settings/
|
|
160
|
+
│ │ │ │ └── userInfo/
|
|
173
161
|
│ │ │ ├── layout.tsx
|
|
174
|
-
│ │ │
|
|
175
|
-
│ │
|
|
176
|
-
│ │
|
|
177
|
-
│
|
|
178
|
-
│ │
|
|
179
|
-
│ │
|
|
180
|
-
│ │ │ │ │ └── page.tsx
|
|
181
|
-
│ │ │ │ ├── layout.tsx
|
|
182
|
-
│ │ │ │ ├── Login
|
|
183
|
-
│ │ │ │ │ └── page.tsx
|
|
184
|
-
│ │ │ │ └── Register
|
|
185
|
-
│ │ │ │ └── page.tsx
|
|
186
|
-
│ │ │ └── (user)
|
|
187
|
-
│ │ │ ├── Dashboard
|
|
188
|
-
│ │ │ │ ├── error.tsx
|
|
189
|
-
│ │ │ │ ├── loading.tsx
|
|
190
|
-
│ │ │ │ └── page.tsx
|
|
191
|
-
│ │ │ ├── layout.tsx
|
|
192
|
-
│ │ │ ├── Settings
|
|
193
|
-
│ │ │ │ ├── loading.tsx
|
|
194
|
-
│ │ │ │ └── page.tsx
|
|
195
|
-
│ │ │ └── UserInfo
|
|
196
|
-
│ │ │ ├── loading.tsx
|
|
197
|
-
│ │ │ └── page.tsx
|
|
198
|
-
│ │ ├── not-found.tsx
|
|
199
|
-
│ │ ├── page.tsx
|
|
200
|
-
│ │ ├── sitemap.ts
|
|
201
|
-
│ │ └── styles
|
|
202
|
-
│ │ └── globals.css
|
|
203
|
-
│ ├── auth.config.ts
|
|
204
|
-
│ ├── config.ts
|
|
205
|
-
│ ├── lib
|
|
206
|
-
│ │ ├── auth
|
|
207
|
-
│ │ │ ├── disconnect.ts
|
|
208
|
-
│ │ │ └── isConnected.ts
|
|
209
|
-
│ │ ├── i18n
|
|
210
|
-
│ │ │ ├── navigation.ts
|
|
211
|
-
│ │ │ ├── request.ts
|
|
212
|
-
│ │ │ └── routing.ts
|
|
162
|
+
│ │ │ └── page.tsx
|
|
163
|
+
│ │ ├── api/auth/[...nextauth]/route.ts
|
|
164
|
+
│ │ └── styles/globals.css
|
|
165
|
+
│ ├── lib/
|
|
166
|
+
│ │ ├── i18n/
|
|
167
|
+
│ │ ├── security/csp.ts
|
|
213
168
|
│ │ └── utils.ts
|
|
214
|
-
│
|
|
215
|
-
│
|
|
216
|
-
│
|
|
217
|
-
│
|
|
218
|
-
│
|
|
219
|
-
│
|
|
220
|
-
│
|
|
221
|
-
│
|
|
222
|
-
│
|
|
223
|
-
│
|
|
224
|
-
│
|
|
225
|
-
│
|
|
226
|
-
|
|
227
|
-
│
|
|
228
|
-
│
|
|
229
|
-
│
|
|
230
|
-
│
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
│ │ └── page-ui.tsx
|
|
236
|
-
│ ├── Settings
|
|
237
|
-
│ │ └── page-ui.tsx
|
|
238
|
-
│ └── UserInfo
|
|
239
|
-
│ └── page-ui.tsx
|
|
240
|
-
├── tailwind.config.ts
|
|
169
|
+
│ ├── ui/
|
|
170
|
+
│ │ ├── _global/
|
|
171
|
+
│ │ ├── _home/
|
|
172
|
+
│ │ ├── dashboard/
|
|
173
|
+
│ │ ├── login/
|
|
174
|
+
│ │ ├── register/
|
|
175
|
+
│ │ ├── settings/
|
|
176
|
+
│ │ └── userInfo/
|
|
177
|
+
│ ├── auth.ts
|
|
178
|
+
│ ├── config.ts
|
|
179
|
+
│ ├── env.ts
|
|
180
|
+
│ └── proxy.ts
|
|
181
|
+
├── tests/
|
|
182
|
+
│ ├── consumer/
|
|
183
|
+
│ ├── e2e/
|
|
184
|
+
│ ├── rendering/
|
|
185
|
+
│ └── unit/
|
|
186
|
+
├── next.config.ts
|
|
187
|
+
├── package.json
|
|
188
|
+
├── playwright.config.ts
|
|
189
|
+
├── pnpm-workspace.yaml
|
|
241
190
|
└── tsconfig.json
|
|
242
191
|
```
|
|
243
192
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
##
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
## 📁 CLI Structure
|
|
268
|
-
|
|
269
|
-
```plaintext
|
|
270
|
-
create-next-pro/
|
|
271
|
-
.
|
|
272
|
-
├── bin.ts
|
|
273
|
-
├── create-next-pro-completion.sh
|
|
274
|
-
├── install.sh
|
|
275
|
-
├── package.json
|
|
276
|
-
├── public
|
|
277
|
-
│ ├── cnp-banner.svg
|
|
278
|
-
│ └── logo.svg
|
|
279
|
-
├── src
|
|
280
|
-
│ ├── index.ts
|
|
281
|
-
│ ├── lib
|
|
193
|
+
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.
|
|
194
|
+
|
|
195
|
+
## CLI architecture
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
create-next-pro-cli/
|
|
199
|
+
├── bin.bun.ts
|
|
200
|
+
├── bin.node.ts
|
|
201
|
+
├── src/
|
|
202
|
+
│ ├── cli/
|
|
203
|
+
│ │ ├── completion.ts
|
|
204
|
+
│ │ ├── onboarding.ts
|
|
205
|
+
│ │ ├── output.ts
|
|
206
|
+
│ │ └── registry.ts
|
|
207
|
+
│ ├── core/
|
|
208
|
+
│ │ ├── contracts.ts
|
|
209
|
+
│ │ ├── operations.ts
|
|
210
|
+
│ │ ├── page-catalog.ts
|
|
211
|
+
│ │ ├── project-paths.ts
|
|
212
|
+
│ │ └── template-manifest.ts
|
|
213
|
+
│ ├── lib/
|
|
214
|
+
│ │ ├── addApi.ts
|
|
282
215
|
│ │ ├── addComponent.ts
|
|
216
|
+
│ │ ├── addLanguage.ts
|
|
217
|
+
│ │ ├── addLib.ts
|
|
283
218
|
│ │ ├── addPage.ts
|
|
219
|
+
│ │ ├── addText.ts
|
|
284
220
|
│ │ ├── createProject.ts
|
|
285
|
-
│ │
|
|
286
|
-
│
|
|
287
|
-
│ │
|
|
288
|
-
│
|
|
289
|
-
│
|
|
221
|
+
│ │ └── rmPage.ts
|
|
222
|
+
│ ├── release/
|
|
223
|
+
│ │ └── model.ts
|
|
224
|
+
│ ├── runtime/
|
|
225
|
+
│ │ └── node-context.ts
|
|
226
|
+
│ ├── index.ts
|
|
290
227
|
│ └── scaffold.ts
|
|
291
|
-
|
|
228
|
+
├── templates/
|
|
229
|
+
│ ├── Component/
|
|
230
|
+
│ ├── Page/
|
|
231
|
+
│ ├── Projects/default/
|
|
232
|
+
│ ├── Api/
|
|
233
|
+
│ └── Lib/
|
|
234
|
+
├── create-next-pro-completion.sh
|
|
235
|
+
├── create-next-pro-completion.zsh
|
|
236
|
+
├── package.json
|
|
237
|
+
└── tsup.config.ts
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
The CLI registry resolves commands to a shared asynchronous interface. The core defines contracts, the page catalog, and path boundaries; runtime adapters provide prompts, console access, and file-system operations. Bun and Node.js bundles are built separately and selected by the `dist/create-next-pro` launcher.
|
|
241
|
+
|
|
242
|
+
## Global options
|
|
243
|
+
|
|
244
|
+
```text
|
|
245
|
+
--help Show help
|
|
246
|
+
--version, -v Show the version
|
|
247
|
+
--json Emit one deterministic JSON document
|
|
248
|
+
--reconfigure Run CLI configuration again
|
|
249
|
+
--force Replace an existing project destination
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
`--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.
|
|
292
253
|
|
|
254
|
+
## Human and agent output
|
|
255
|
+
|
|
256
|
+
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:
|
|
257
|
+
|
|
258
|
+
```text
|
|
259
|
+
COPIED translation-messages: /workspace/my-app/messages/de/dashboard.json from /workspace/my-app/messages/en/dashboard.json (locale="de", sourceLocale="en")
|
|
260
|
+
UPDATED messages-registry: /workspace/my-app/src/lib/i18n/messages.ts
|
|
261
|
+
SUCCESS: Added locale "de" by copying 7 files from "en".
|
|
262
|
+
NEXT [translate]: Translate every copied message from en to de; the copied text is not ready for delivery.
|
|
263
|
+
/workspace/my-app/messages/de/dashboard.json
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Agentic usage adds `--json`:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
create-next-pro addapi health --json
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The versioned document has stable status, event, next-step, and error fields:
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"schemaVersion": 1,
|
|
277
|
+
"command": "addapi",
|
|
278
|
+
"status": "success",
|
|
279
|
+
"exitCode": 0,
|
|
280
|
+
"summary": "Added API route \"health\".",
|
|
281
|
+
"projectRoot": "/workspace/my-app",
|
|
282
|
+
"events": [
|
|
283
|
+
{
|
|
284
|
+
"sequence": 1,
|
|
285
|
+
"action": "created",
|
|
286
|
+
"resource": "directory",
|
|
287
|
+
"role": "api-directory",
|
|
288
|
+
"scope": "project",
|
|
289
|
+
"path": "src/app/api/health"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"sequence": 2,
|
|
293
|
+
"action": "created",
|
|
294
|
+
"resource": "file",
|
|
295
|
+
"role": "api-route",
|
|
296
|
+
"scope": "project",
|
|
297
|
+
"path": "src/app/api/health/route.ts"
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
"nextSteps": [
|
|
301
|
+
{
|
|
302
|
+
"kind": "review",
|
|
303
|
+
"required": true,
|
|
304
|
+
"message": "Replace the example response and review validation and authentication.",
|
|
305
|
+
"paths": [
|
|
306
|
+
{
|
|
307
|
+
"scope": "project",
|
|
308
|
+
"path": "src/app/api/health/route.ts"
|
|
309
|
+
}
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
"error": null
|
|
314
|
+
}
|
|
293
315
|
```
|
|
294
316
|
|
|
295
|
-
|
|
317
|
+
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.
|
|
296
318
|
|
|
297
|
-
|
|
319
|
+
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`.
|
|
298
320
|
|
|
299
|
-
|
|
321
|
+
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.
|
|
322
|
+
|
|
323
|
+
## Environment and security
|
|
324
|
+
|
|
325
|
+
Generated projects contain `.env.example`, never the template's local `.env`. Copy it before configuring Auth.js:
|
|
300
326
|
|
|
301
327
|
```bash
|
|
302
|
-
|
|
303
|
-
bun install
|
|
304
|
-
bun dev
|
|
328
|
+
cp .env.example .env.local
|
|
305
329
|
```
|
|
306
330
|
|
|
307
|
-
|
|
331
|
+
OAuth credentials, nested Git repositories, caches, installed dependencies, Playwright artifacts, and agent context are excluded from generated projects and the npm package. For deployments without authentication, use `AUTH_DISABLED=true`.
|
|
332
|
+
|
|
333
|
+
## Quality
|
|
334
|
+
|
|
335
|
+
In the CLI repository:
|
|
308
336
|
|
|
309
337
|
```bash
|
|
310
|
-
bun
|
|
311
|
-
|
|
338
|
+
bun install --frozen-lockfile
|
|
339
|
+
bun run check
|
|
312
340
|
```
|
|
313
341
|
|
|
314
|
-
|
|
342
|
+
In a generated project, the same scripts work with all three package managers:
|
|
315
343
|
|
|
316
344
|
```bash
|
|
317
|
-
|
|
345
|
+
bun run check
|
|
346
|
+
npm run check
|
|
347
|
+
pnpm run check
|
|
318
348
|
```
|
|
319
349
|
|
|
320
|
-
-
|
|
350
|
+
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
|
+
|
|
352
|
+
## Development
|
|
321
353
|
|
|
322
354
|
```bash
|
|
323
|
-
|
|
355
|
+
git clone https://github.com/Rising-Corporation/create-next-pro-cli.git
|
|
356
|
+
cd create-next-pro-cli
|
|
357
|
+
bun install --frozen-lockfile
|
|
358
|
+
bun run build
|
|
359
|
+
bun link
|
|
360
|
+
create-next-pro --help
|
|
324
361
|
```
|
|
325
362
|
|
|
326
|
-
|
|
327
|
-
>
|
|
328
|
-
> ```bash
|
|
329
|
-
> bun install -g create-next-pro-cli --trust
|
|
330
|
-
> ```
|
|
331
|
-
|
|
332
|
-
> Otherwise, run the autocompletion install script from binary manually:
|
|
333
|
-
>
|
|
334
|
-
> ```bash
|
|
335
|
-
> bash install.sh
|
|
336
|
-
> ```
|
|
337
|
-
|
|
338
|
-
> Or add the autocompletion line to your `.bashrc`/`.zshrc` :
|
|
339
|
-
>
|
|
340
|
-
> ```bash
|
|
341
|
-
> source ~/.bun/install/global/node_modules/create-next-pro-cli/create-next-pro-completion.sh
|
|
342
|
-
> ```
|
|
343
|
-
>
|
|
344
|
-
> Then restart your terminal or run
|
|
345
|
-
>
|
|
346
|
-
> ```bash
|
|
347
|
-
> source ~/.bashrc
|
|
348
|
-
> ```
|
|
349
|
-
>
|
|
350
|
-
> ||
|
|
351
|
-
>
|
|
352
|
-
> ```bash
|
|
353
|
-
> source ~/.zshrc
|
|
354
|
-
> ```
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
## 🛣️ Roadmap in coming for beta v0.2.0
|
|
359
|
-
|
|
360
|
-
- [ ] Implementation of interactive prompts
|
|
361
|
-
- [ ] Create library features
|
|
362
|
-
- [ ] Create API features
|
|
363
|
-
- [ ] Generation of `.env.*`
|
|
364
|
-
- [ ] Multi-platform testing (`bunx`, `link`, `npm`, etc.)
|
|
365
|
-
- [ ] Additional Components templates (admin panel, landing page, etc.)
|
|
366
|
-
- [ ] Auto deployment to Vercel
|
|
367
|
-
|
|
368
|
-
---
|
|
369
|
-
|
|
370
|
-
## 👨💻 Author
|
|
371
|
-
|
|
372
|
-
MrRise@RisingCorporation
|
|
373
|
-
Made with ❤️ and Bun 🐇
|
|
363
|
+
MIT licensed. Contribution guidelines are available in [CONTRIBUTING.md](./CONTRIBUTING.md).
|