create-next-pro-cli 0.1.25 → 0.1.27
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 +205 -292
- package/create-next-pro-completion.sh +8 -38
- package/create-next-pro-completion.zsh +13 -0
- package/dist/bin.bun.js +1127 -628
- package/dist/bin.node.js +1170 -617
- package/dist/bin.node.js.map +1 -1
- package/dist/create-next-pro +35 -6
- package/package.json +49 -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 +66 -21
- 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/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,286 @@
|
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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/)
|
|
32
14
|
|
|
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
|
-
> ```
|
|
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.
|
|
40
16
|
|
|
41
|
-
|
|
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.
|
|
42
18
|
|
|
43
|
-
##
|
|
19
|
+
## Purpose
|
|
44
20
|
|
|
45
|
-
|
|
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.
|
|
46
22
|
|
|
47
|
-
|
|
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.
|
|
48
24
|
|
|
49
|
-
|
|
25
|
+
## Main features
|
|
50
26
|
|
|
51
|
-
|
|
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.
|
|
52
38
|
|
|
53
|
-
|
|
39
|
+
## Requirements
|
|
54
40
|
|
|
55
|
-
|
|
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.
|
|
56
43
|
|
|
57
|
-
|
|
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
|
+
`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.
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
create-next-pro rmpage ParentPage.ChildPage
|
|
123
|
-
```
|
|
122
|
+
`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
123
|
|
|
125
|
-
|
|
124
|
+
## Generated project architecture
|
|
126
125
|
|
|
127
|
-
|
|
126
|
+
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
127
|
|
|
129
|
-
```
|
|
130
|
-
my-
|
|
131
|
-
.
|
|
132
|
-
├──
|
|
133
|
-
├── messages
|
|
134
|
-
│ ├── en
|
|
135
|
-
│ │ ├── Dashboard.json
|
|
128
|
+
```text
|
|
129
|
+
my-app/
|
|
130
|
+
├── .env.example
|
|
131
|
+
├── cnp.config.json
|
|
132
|
+
├── messages/
|
|
133
|
+
│ ├── en/
|
|
136
134
|
│ │ ├── _global_ui.json
|
|
137
135
|
│ │ ├── _home.json
|
|
138
|
-
│ │ ├──
|
|
139
|
-
│ │ ├──
|
|
140
|
-
│ │ ├──
|
|
141
|
-
│ │
|
|
136
|
+
│ │ ├── dashboard.json
|
|
137
|
+
│ │ ├── login.json
|
|
138
|
+
│ │ ├── register.json
|
|
139
|
+
│ │ ├── settings.json
|
|
140
|
+
│ │ └── userInfo.json
|
|
142
141
|
│ ├── 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]
|
|
142
|
+
│ ├── fr/
|
|
143
|
+
│ │ └── ...
|
|
144
|
+
│ └── fr.ts
|
|
145
|
+
├── public/
|
|
146
|
+
│ ├── logo.png
|
|
147
|
+
│ └── logo.svg
|
|
148
|
+
├── src/
|
|
149
|
+
│ ├── app/
|
|
150
|
+
│ │ ├── [locale]/
|
|
151
|
+
│ │ │ ├── (public)/
|
|
152
|
+
│ │ │ │ ├── _home/
|
|
153
|
+
│ │ │ │ ├── login/
|
|
154
|
+
│ │ │ │ └── register/
|
|
155
|
+
│ │ │ ├── (user)/
|
|
156
|
+
│ │ │ │ ├── dashboard/
|
|
157
|
+
│ │ │ │ ├── settings/
|
|
158
|
+
│ │ │ │ └── userInfo/
|
|
173
159
|
│ │ │ ├── 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
|
|
160
|
+
│ │ │ └── page.tsx
|
|
161
|
+
│ │ ├── api/auth/[...nextauth]/route.ts
|
|
162
|
+
│ │ └── styles/globals.css
|
|
163
|
+
│ ├── lib/
|
|
164
|
+
│ │ ├── i18n/
|
|
165
|
+
│ │ ├── security/csp.ts
|
|
213
166
|
│ │ └── 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
|
|
167
|
+
│ ├── ui/
|
|
168
|
+
│ │ ├── _global/
|
|
169
|
+
│ │ ├── _home/
|
|
170
|
+
│ │ ├── dashboard/
|
|
171
|
+
│ │ ├── login/
|
|
172
|
+
│ │ ├── register/
|
|
173
|
+
│ │ ├── settings/
|
|
174
|
+
│ │ └── userInfo/
|
|
175
|
+
│ ├── auth.ts
|
|
176
|
+
│ ├── config.ts
|
|
177
|
+
│ ├── env.ts
|
|
178
|
+
│ └── proxy.ts
|
|
179
|
+
├── tests/
|
|
180
|
+
│ ├── consumer/
|
|
181
|
+
│ ├── e2e/
|
|
182
|
+
│ ├── rendering/
|
|
183
|
+
│ └── unit/
|
|
184
|
+
├── next.config.ts
|
|
185
|
+
├── package.json
|
|
186
|
+
├── playwright.config.ts
|
|
187
|
+
├── pnpm-workspace.yaml
|
|
241
188
|
└── tsconfig.json
|
|
242
189
|
```
|
|
243
190
|
|
|
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
|
|
191
|
+
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.
|
|
192
|
+
|
|
193
|
+
## CLI architecture
|
|
194
|
+
|
|
195
|
+
```text
|
|
196
|
+
create-next-pro-cli/
|
|
197
|
+
├── bin.bun.ts
|
|
198
|
+
├── bin.node.ts
|
|
199
|
+
├── src/
|
|
200
|
+
│ ├── cli/
|
|
201
|
+
│ │ ├── completion.ts
|
|
202
|
+
│ │ ├── onboarding.ts
|
|
203
|
+
│ │ └── registry.ts
|
|
204
|
+
│ ├── core/
|
|
205
|
+
│ │ ├── contracts.ts
|
|
206
|
+
│ │ ├── page-catalog.ts
|
|
207
|
+
│ │ ├── project-paths.ts
|
|
208
|
+
│ │ └── template-manifest.ts
|
|
209
|
+
│ ├── lib/
|
|
210
|
+
│ │ ├── addApi.ts
|
|
282
211
|
│ │ ├── addComponent.ts
|
|
212
|
+
│ │ ├── addLanguage.ts
|
|
213
|
+
│ │ ├── addLib.ts
|
|
283
214
|
│ │ ├── addPage.ts
|
|
215
|
+
│ │ ├── addText.ts
|
|
284
216
|
│ │ ├── createProject.ts
|
|
285
|
-
│ │
|
|
286
|
-
│
|
|
287
|
-
│ │
|
|
288
|
-
│
|
|
289
|
-
│
|
|
217
|
+
│ │ └── rmPage.ts
|
|
218
|
+
│ ├── release/
|
|
219
|
+
│ │ └── model.ts
|
|
220
|
+
│ ├── runtime/
|
|
221
|
+
│ │ └── node-context.ts
|
|
222
|
+
│ ├── index.ts
|
|
290
223
|
│ └── scaffold.ts
|
|
291
|
-
|
|
292
|
-
|
|
224
|
+
├── templates/
|
|
225
|
+
│ ├── Components/
|
|
226
|
+
│ ├── Pages/
|
|
227
|
+
│ ├── Projects/default/
|
|
228
|
+
│ └── Routes/
|
|
229
|
+
├── create-next-pro-completion.sh
|
|
230
|
+
├── create-next-pro-completion.zsh
|
|
231
|
+
├── package.json
|
|
232
|
+
└── tsup.config.ts
|
|
293
233
|
```
|
|
294
234
|
|
|
295
|
-
|
|
235
|
+
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.
|
|
236
|
+
|
|
237
|
+
## Global options
|
|
238
|
+
|
|
239
|
+
```text
|
|
240
|
+
--help Show help
|
|
241
|
+
--version, -v Show the version
|
|
242
|
+
--reconfigure Run CLI configuration again
|
|
243
|
+
--force Replace an existing project destination
|
|
244
|
+
```
|
|
296
245
|
|
|
297
|
-
##
|
|
246
|
+
## Environment and security
|
|
298
247
|
|
|
299
|
-
|
|
248
|
+
Generated projects contain `.env.example`, never the template's local `.env`. Copy it before configuring Auth.js:
|
|
300
249
|
|
|
301
250
|
```bash
|
|
302
|
-
|
|
303
|
-
bun install
|
|
304
|
-
bun dev
|
|
251
|
+
cp .env.example .env.local
|
|
305
252
|
```
|
|
306
253
|
|
|
307
|
-
|
|
254
|
+
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`.
|
|
255
|
+
|
|
256
|
+
## Quality
|
|
257
|
+
|
|
258
|
+
In the CLI repository:
|
|
308
259
|
|
|
309
260
|
```bash
|
|
310
|
-
bun
|
|
311
|
-
|
|
261
|
+
bun install --frozen-lockfile
|
|
262
|
+
bun run check
|
|
312
263
|
```
|
|
313
264
|
|
|
314
|
-
|
|
265
|
+
In a generated project, the same scripts work with all three package managers:
|
|
315
266
|
|
|
316
267
|
```bash
|
|
317
|
-
|
|
268
|
+
bun run check
|
|
269
|
+
npm run check
|
|
270
|
+
pnpm run check
|
|
318
271
|
```
|
|
319
272
|
|
|
320
|
-
-
|
|
273
|
+
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
|
+
|
|
275
|
+
## Development
|
|
321
276
|
|
|
322
277
|
```bash
|
|
323
|
-
|
|
278
|
+
git clone https://github.com/Rising-Corporation/create-next-pro-cli.git
|
|
279
|
+
cd create-next-pro-cli
|
|
280
|
+
bun install --frozen-lockfile
|
|
281
|
+
bun run build
|
|
282
|
+
bun link
|
|
283
|
+
create-next-pro --help
|
|
324
284
|
```
|
|
325
285
|
|
|
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 🐇
|
|
286
|
+
MIT licensed. Contribution guidelines are available in [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
@@ -1,44 +1,14 @@
|
|
|
1
|
-
# Bash completion for create-next-pro
|
|
1
|
+
# Bash completion for create-next-pro.
|
|
2
2
|
_create_next_pro_complete() {
|
|
3
|
-
local cur
|
|
3
|
+
local cur command candidates
|
|
4
4
|
COMPREPLY=()
|
|
5
5
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
12
|
-
return 0
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
# Autocomplete page/component names for addpage/addcomponent
|
|
16
|
-
if [[ ${COMP_CWORD} == 2 && ( ${prev} == "addpage" || ${prev} == "addcomponent" ) ]]; then
|
|
17
|
-
# List all nested page/component paths under src/ui
|
|
18
|
-
local IFS=$'\n'
|
|
19
|
-
local items=( $(find src/ui -type d | sed 's|src/ui/||; /^$/d' | grep -v '^$' | grep -v '^\.$' | grep -v '^src/ui$') )
|
|
20
|
-
# Explicitly remove src/ui
|
|
21
|
-
items=( "${items[@]}" )
|
|
22
|
-
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
|
23
|
-
return 0
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
# Autocomplete nested children after dot for addpage
|
|
27
|
-
if [[ ${COMP_CWORD} == 2 && ${prev} == "addpage" && "${cur}" == *.* ]]; then
|
|
28
|
-
local parent=${cur%%.*}
|
|
29
|
-
local prefix=${cur#*.}
|
|
30
|
-
local IFS=$'\n'
|
|
31
|
-
local children=( $(find src/ui/${parent} -mindepth 1 -type d | sed "s|src/ui/${parent}/||") )
|
|
32
|
-
COMPREPLY=( $(compgen -W "${children[*]}" -- ${prefix}) )
|
|
33
|
-
return 0
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# Autocomplete page names for rmpage (based on src/ui)
|
|
37
|
-
if [[ ${COMP_CWORD} == 2 && ${prev} == "rmpage" ]]; then
|
|
38
|
-
local IFS=$'\n'
|
|
39
|
-
local pages=( $(find src/ui -type d | sed 's|src/ui/||; /^$/d' | grep -v '^$' | grep -v '^\.$' | grep -v '^src/ui$') )
|
|
40
|
-
COMPREPLY=( $(compgen -W "${pages[*]}" -- ${cur}) )
|
|
41
|
-
return 0
|
|
6
|
+
command="${COMP_WORDS[1]}"
|
|
7
|
+
if [[ ${COMP_CWORD} -eq 1 ]]; then
|
|
8
|
+
candidates="$(create-next-pro __complete 2>/dev/null)"
|
|
9
|
+
else
|
|
10
|
+
candidates="$(create-next-pro __complete "${command}" 2>/dev/null)"
|
|
42
11
|
fi
|
|
12
|
+
mapfile -t COMPREPLY < <(compgen -W "${candidates}" -- "${cur}")
|
|
43
13
|
}
|
|
44
14
|
complete -F _create_next_pro_complete create-next-pro
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#compdef create-next-pro
|
|
2
|
+
|
|
3
|
+
_create_next_pro() {
|
|
4
|
+
local command
|
|
5
|
+
command="${words[2]}"
|
|
6
|
+
if (( CURRENT == 2 )); then
|
|
7
|
+
compadd -- ${(f)"$(create-next-pro __complete 2>/dev/null)"}
|
|
8
|
+
else
|
|
9
|
+
compadd -- ${(f)"$(create-next-pro __complete "${command}" 2>/dev/null)"}
|
|
10
|
+
fi
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
compdef _create_next_pro create-next-pro
|