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.
Files changed (107) hide show
  1. package/README.md +205 -292
  2. package/create-next-pro-completion.sh +8 -38
  3. package/create-next-pro-completion.zsh +13 -0
  4. package/dist/bin.bun.js +1127 -628
  5. package/dist/bin.node.js +1170 -617
  6. package/dist/bin.node.js.map +1 -1
  7. package/dist/create-next-pro +35 -6
  8. package/package.json +49 -27
  9. package/templates/Projects/default/.env.example +17 -0
  10. package/templates/Projects/default/.github/workflows/quality.yml +24 -0
  11. package/templates/Projects/default/.gitignore.template +47 -0
  12. package/templates/Projects/default/.prettierignore +3 -0
  13. package/templates/Projects/default/README.md +66 -21
  14. package/templates/Projects/default/bun.lock +1152 -0
  15. package/templates/Projects/default/eslint.config.mjs +27 -11
  16. package/templates/Projects/default/messages/en/_global_ui.json +23 -10
  17. package/templates/Projects/default/messages/en.ts +17 -2
  18. package/templates/Projects/default/messages/fr/_global_ui.json +23 -10
  19. package/templates/Projects/default/messages/fr.ts +17 -2
  20. package/templates/Projects/default/next.config.ts +43 -3
  21. package/templates/Projects/default/package.json +42 -24
  22. package/templates/Projects/default/playwright.config.ts +26 -0
  23. package/templates/Projects/default/pnpm-workspace.yaml +5 -0
  24. package/templates/Projects/default/public/{cnp-logo.svg → logo.svg} +1 -1
  25. package/templates/Projects/default/src/app/[locale]/(public)/layout.tsx +8 -1
  26. package/templates/Projects/default/src/app/[locale]/(public)/login/page.tsx +8 -0
  27. package/templates/Projects/default/src/app/[locale]/(public)/register/page.tsx +8 -0
  28. package/templates/Projects/default/src/app/[locale]/(user)/dashboard/error.tsx +25 -0
  29. package/templates/Projects/default/src/app/[locale]/(user)/dashboard/loading.tsx +5 -0
  30. package/templates/Projects/default/src/app/[locale]/(user)/{Dashboard → dashboard}/page.tsx +1 -1
  31. package/templates/Projects/default/src/app/[locale]/(user)/layout.tsx +24 -2
  32. package/templates/Projects/default/src/app/[locale]/(user)/settings/loading.tsx +5 -0
  33. package/templates/Projects/default/src/app/[locale]/(user)/{Settings → settings}/page.tsx +1 -2
  34. package/templates/Projects/default/src/app/[locale]/(user)/userInfo/loading.tsx +5 -0
  35. package/templates/Projects/default/src/app/[locale]/(user)/{UserInfo → userInfo}/page.tsx +1 -2
  36. package/templates/Projects/default/src/app/[locale]/layout.tsx +34 -10
  37. package/templates/Projects/default/src/app/[locale]/loading.tsx +0 -9
  38. package/templates/Projects/default/src/app/[locale]/not-found.tsx +6 -15
  39. package/templates/Projects/default/src/app/[locale]/page.tsx +10 -1
  40. package/templates/Projects/default/src/app/api/auth/[...nextauth]/route.ts +8 -60
  41. package/templates/Projects/default/src/app/not-found.tsx +1 -1
  42. package/templates/Projects/default/src/app/sitemap.ts +2 -2
  43. package/templates/Projects/default/src/app/styles/globals.css +166 -113
  44. package/templates/Projects/default/src/auth.ts +20 -0
  45. package/templates/Projects/default/src/config.ts +3 -3
  46. package/templates/Projects/default/src/env.ts +65 -0
  47. package/templates/Projects/default/src/lib/i18n/messages.ts +8 -0
  48. package/templates/Projects/default/src/lib/i18n/request.ts +2 -16
  49. package/templates/Projects/default/src/lib/security/csp.ts +16 -0
  50. package/templates/Projects/default/src/lib/utils.ts +2 -1
  51. package/templates/Projects/default/src/proxy.ts +13 -0
  52. package/templates/Projects/default/src/ui/_global/BackButton.tsx +4 -2
  53. package/templates/Projects/default/src/ui/_global/Button.tsx +3 -8
  54. package/templates/Projects/default/src/ui/_global/GlobalHeader.tsx +10 -28
  55. package/templates/Projects/default/src/ui/_global/GlobalMain.tsx +1 -1
  56. package/templates/Projects/default/src/ui/_global/LocaleSwitcher.tsx +9 -10
  57. package/templates/Projects/default/src/ui/_global/PublicNav.tsx +51 -17
  58. package/templates/Projects/default/src/ui/_global/ThemeToggle.tsx +45 -39
  59. package/templates/Projects/default/src/ui/_global/UserNav.tsx +6 -6
  60. package/templates/Projects/default/src/ui/_home/page-ui.tsx +5 -7
  61. package/templates/Projects/default/src/ui/{Dashboard → dashboard}/LogoutButton.tsx +9 -7
  62. package/templates/Projects/default/src/ui/{Dashboard → dashboard}/StatsCard.tsx +4 -4
  63. package/templates/Projects/default/src/ui/{Dashboard → dashboard}/page-ui.tsx +7 -8
  64. package/templates/Projects/default/src/ui/login/page-ui.tsx +36 -0
  65. package/templates/Projects/default/src/ui/register/page-ui.tsx +38 -0
  66. package/templates/Projects/default/src/ui/settings/page-ui.tsx +15 -0
  67. package/templates/Projects/default/src/ui/userInfo/page-ui.tsx +15 -0
  68. package/templates/Projects/default/tailwind.config.ts +81 -1
  69. package/templates/Projects/default/tests/consumer/validate-template.ts +66 -0
  70. package/templates/Projects/default/tests/e2e/template-remediation.playwright.ts +106 -0
  71. package/templates/Projects/default/tests/rendering/verify-rendering.ts +56 -0
  72. package/templates/Projects/default/tests/unit/csp.test.ts +19 -0
  73. package/templates/Projects/default/tests/unit/env.test.ts +76 -0
  74. package/templates/Projects/default/tsconfig.json +6 -6
  75. package/templates/Projects/default/messages/getMergedMessages.ts +0 -31
  76. package/templates/Projects/default/middleware.ts +0 -11
  77. package/templates/Projects/default/src/app/[locale]/(public)/Login/page.tsx +0 -6
  78. package/templates/Projects/default/src/app/[locale]/(public)/Register/page.tsx +0 -6
  79. package/templates/Projects/default/src/app/[locale]/(user)/Dashboard/error.tsx +0 -38
  80. package/templates/Projects/default/src/app/[locale]/(user)/Dashboard/loading.tsx +0 -10
  81. package/templates/Projects/default/src/app/[locale]/(user)/Settings/loading.tsx +0 -17
  82. package/templates/Projects/default/src/app/[locale]/(user)/UserInfo/loading.tsx +0 -17
  83. package/templates/Projects/default/src/app/api/auth/post-login/route.ts +0 -26
  84. package/templates/Projects/default/src/app/api/hello/route.ts +0 -5
  85. package/templates/Projects/default/src/app/layout.tsx +0 -11
  86. package/templates/Projects/default/src/app/page.tsx +0 -6
  87. package/templates/Projects/default/src/auth.config.ts +0 -0
  88. package/templates/Projects/default/src/lib/auth/disconnect.ts +0 -11
  89. package/templates/Projects/default/src/lib/auth/isConnected.ts +0 -18
  90. package/templates/Projects/default/src/lib/sample/example.ts +0 -3
  91. package/templates/Projects/default/src/lib/sample/index.ts +0 -3
  92. package/templates/Projects/default/src/ui/Login/page-ui.tsx +0 -22
  93. package/templates/Projects/default/src/ui/Register/page-ui.tsx +0 -26
  94. package/templates/Projects/default/src/ui/Settings/page-ui.tsx +0 -17
  95. package/templates/Projects/default/src/ui/UserInfo/page-ui.tsx +0 -17
  96. /package/templates/Projects/default/messages/en/{Dashboard.json → dashboard.json} +0 -0
  97. /package/templates/Projects/default/messages/en/{Login.json → login.json} +0 -0
  98. /package/templates/Projects/default/messages/en/{Register.json → register.json} +0 -0
  99. /package/templates/Projects/default/messages/en/{Settings.json → settings.json} +0 -0
  100. /package/templates/Projects/default/messages/en/{UserInfo.json → userInfo.json} +0 -0
  101. /package/templates/Projects/default/messages/fr/{Dashboard.json → dashboard.json} +0 -0
  102. /package/templates/Projects/default/messages/fr/{Login.json → login.json} +0 -0
  103. /package/templates/Projects/default/messages/fr/{Register.json → register.json} +0 -0
  104. /package/templates/Projects/default/messages/fr/{Settings.json → settings.json} +0 -0
  105. /package/templates/Projects/default/messages/fr/{UserInfo.json → userInfo.json} +0 -0
  106. /package/templates/Projects/default/public/{cnp-logo.png → logo.png} +0 -0
  107. /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 logo" style="width:100%;" />
2
-
3
- ## Runtime Support
4
-
5
- [![Bun](https://img.shields.io/badge/Bun-%23000000?logo=bun&logoColor=white&style=for-the-badge)](https://bun.sh)
6
- [![Node.js](https://img.shields.io/badge/Node.js-%23339933?logo=node.js&logoColor=white&style=for-the-badge)](https://nodejs.org)
7
-
8
- <!-- [![Deno](https://img.shields.io/badge/Deno-%23000000?logo=deno&logoColor=white&style=for-the-badge)](https://deno.land) -->
9
-
10
- ![npm](https://img.shields.io/npm/v/create-next-pro-cli?logo=npm&color=orange)
11
- ![npm dependencies](https://img.shields.io/librariesio/release/npm/create-next-pro-cli?logo=npm)
12
- ![npm downloads](https://img.shields.io/npm/dw/create-next-pro-cli?logo=npm)
13
-
14
- ![GitHub](https://img.shields.io/github/stars/Rising-Corporation/create-next-pro-cli?style=social&logo=github)
15
- ![GitHub forks](https://img.shields.io/github/forks/Rising-Corporation/create-next-pro-cli?style=social&logo=github)
16
- ![GitHub issues](https://img.shields.io/github/issues/Rising-Corporation/create-next-pro-cli?logo=github)
17
- ![CI](https://github.com/Rising-Corporation/typed-sse/actions/workflows/ci.yml/badge.svg)
18
-
19
- ![status](https://img.shields.io/badge/status-beta-orange)
20
- ![license](https://img.shields.io/github/license/Rising-Corporation/create-next-pro-cli?logo=open-source-initiative&logoColor=white)
21
- [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-blue.svg?logo=conventionalcommits)](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
- > 🚀 An advanced CLI scaffolder to create professional Next.js projects instantly.
30
-
31
- ---
5
+ [![Bun](https://img.shields.io/badge/Bun-1.3%2B-000000?logo=bun&logoColor=white)](https://bun.sh)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-24%2B-339933?logo=node.js&logoColor=white)](https://nodejs.org)
7
+ [![npm](https://img.shields.io/npm/v/create-next-pro-cli?logo=npm&color=CB3837)](https://www.npmjs.com/package/create-next-pro-cli)
8
+ [![npm downloads](https://img.shields.io/npm/dw/create-next-pro-cli?logo=npm)](https://www.npmjs.com/package/create-next-pro-cli)
9
+ [![CI](https://github.com/Rising-Corporation/create-next-pro-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/Rising-Corporation/create-next-pro-cli/actions/workflows/ci.yml)
10
+ [![GitHub stars](https://img.shields.io/github/stars/Rising-Corporation/create-next-pro-cli?style=social)](https://github.com/Rising-Corporation/create-next-pro-cli)
11
+ [![GitHub issues](https://img.shields.io/github/issues/Rising-Corporation/create-next-pro-cli?logo=github)](https://github.com/Rising-Corporation/create-next-pro-cli/issues)
12
+ [![License](https://img.shields.io/github/license/Rising-Corporation/create-next-pro-cli?logo=open-source-initiative&logoColor=white)](./LICENSE)
13
+ [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-FE5196?logo=conventionalcommits&logoColor=white)](https://www.conventionalcommits.org/en/v1.0.0/)
32
14
 
33
- > 🤩 Can't wait and too excited to read more? Just want to try it now?
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
- ## 🎯 Purpose
19
+ ## Purpose
44
20
 
45
- Create an enhanced alternative to `bun create next-app` with an interactive interface to generate Next.js projects tailored to real-world professional needs.
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
- This open-source, community-driven project aims to gather and share best practices to help standardize Next.js project structures. It includes many other features to facilitate modern development workflows and encourage collaboration.
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
- The CLI also enables you to instantly create pages and components, automatically placing them in the correct location within your project’s architecture for seamless organization and scalability.
25
+ ## Main features
50
26
 
51
- You can also customize the templates used for pages and components to fit your own needs.
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
- ## 🛠️ Commands & Examples
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
- ### Create a new project
44
+ ## Installation
58
45
 
59
46
  ```bash
60
- create-next-pro MyProjectName
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
- > ⚠️ The interactive prompt for features and customization is not yet implemented, but will be available very soon!
64
-
65
- ### Create a page
54
+ Without a global installation:
66
55
 
67
56
  ```bash
68
- create-next-pro addpage MyPage
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
- ### Create a nested page
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 addpage ParentPage.ChildPage
67
+ create-next-pro my-app
68
+ cd my-app
75
69
  ```
76
70
 
77
- ### Create a component (global)
71
+ Then install dependencies with your preferred package manager:
78
72
 
79
73
  ```bash
80
- create-next-pro addcomponent MyComponent
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
- ### Create a component in a page
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 addcomponent MyComponent -P MyPage
84
+ create-next-pro my-app --force
87
85
  ```
88
86
 
89
- ### Create a component in a nested page
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
- ```bash
92
- create-next-pro addcomponent MyComponent -P ParentPage.ChildPage
93
- ```
89
+ ## Project evolution commands
94
90
 
95
- ### Create a library
91
+ Run the following commands from the root of a generated project.
96
92
 
97
93
  ```bash
98
- create-next-pro addlib mylib
99
- ```
94
+ # Simple or nested pages
95
+ create-next-pro addpage profile
96
+ create-next-pro addpage account.security
100
97
 
101
- ### Add a file to a library
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
- ```bash
104
- create-next-pro addlib mylib.foo
105
- ```
102
+ # Libraries and modules
103
+ create-next-pro addlib analytics
104
+ create-next-pro addlib analytics.trackEvent
106
105
 
107
- ### Create an API route
106
+ # Routes API
107
+ create-next-pro addapi health
108
108
 
109
- ```bash
110
- create-next-pro addapi hello
111
- ```
109
+ # Locales and translations
110
+ create-next-pro addlanguage de
111
+ create-next-pro addtext dashboard.welcome "Welcome"
112
112
 
113
- ### Remove a page
113
+ # Direct removal
114
+ create-next-pro rmpage account.security
114
115
 
115
- ```bash
116
- create-next-pro rmpage MyPage
116
+ # Tree-based autocomplete menu with confirmation
117
+ create-next-pro rmpage
117
118
  ```
118
119
 
119
- ### Remove a nested page
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
- ```bash
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
- ## 📁 Expected Structure of a Generated Project
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
- ```plaintext
130
- my-next-app/
131
- .
132
- ├── eslint.config.mjs
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
- │ │ ├── Login.json
139
- │ │ ├── Register.json
140
- │ │ ├── Settings.json
141
- │ │ └── UserInfo.json
136
+ │ │ ├── dashboard.json
137
+ │ │ ├── login.json
138
+ │ │ ├── register.json
139
+ │ │ ├── settings.json
140
+ │ │ └── userInfo.json
142
141
  │ ├── en.ts
143
- │ ├── fr
144
- │ │ ├── Dashboard.json
145
- │ ├── _global_ui.json
146
- │ │ ├── _home.json
147
- ├── Login.json
148
- │ ├── Register.json
149
- │ │ ├── Settings.json
150
- │ └── UserInfo.json
151
- │ ├── fr.ts
152
- └── getMergedMessages.ts
153
- ├── middleware.ts
154
- ├── next.config.ts
155
- ├── next-env.d.ts
156
- ├── package.json
157
- ├── postcss.config.mjs
158
- ├── public
159
- ├── cnp-logo.png
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
- │ │ │ ├── loading.tsx
175
- │ │ ├── not-found.tsx
176
- │ │ │ ├── page.tsx
177
- │ │ ├── (public)
178
- │ │ │ │ ├── _home
179
- │ │ │ │ │ ├── loading.tsx
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
- └── ui
215
- ├── Dashboard
216
- │ ├── LogoutButton.tsx
217
- │ ├── page-ui.tsx
218
- │ ├── StatsCard.tsx
219
- └── WelcomeCard.tsx
220
- ├── _global
221
- ├── BackButton.tsx
222
- ├── Button.tsx
223
- ├── GlobalHeader.tsx
224
- ├── GlobalMain.tsx
225
- ├── Loading.tsx
226
- │ │ ├── LocaleSwitcher.tsx
227
- ├── PublicNav.tsx
228
- ├── ThemeToggle.tsx
229
- └── UserNav.tsx
230
- ├── _home
231
- │ │ └── page-ui.tsx
232
- ├── Login
233
- │ │ └── page-ui.tsx
234
- ├── Register
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
- ## Main Features
247
-
248
- - Interactive CLI available for Bun, Node.js, or Deno
249
- - Multi-runtime support: Bun, Node.js, Deno
250
- - Features:
251
- - TypeScript integration
252
- - ESLint configuration
253
- - Tailwind CSS setup
254
- - App Router support (with or without `src/` directory)
255
- - Internationalization using `next-intl`
256
- - Turbopack or Webpack support
257
- - Custom path aliases (e.g., `@/*`, `@core/*`)
258
- - Next-auth with custom cookies
259
- - Automatic generation of pages and components
260
- - Clean i18n structure: `/messages/en/*.json`, `/lib/i18n/`
261
- - Add or remove pages and components via CLI
262
- - Bash and Zsh autocompletion
263
- - Interactive installation and runtime detection
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
- │ │ ├── createProjectWithPrompt.ts
286
- ├── rmPage.ts
287
- │ │ ├── utils.test.ts
288
- │ └── utils.ts
289
- ├── scaffold-dev.ts
217
+ │ │ └── rmPage.ts
218
+ │ ├── release/
219
+ │ │ └── model.ts
220
+ ├── runtime/
221
+ │ └── node-context.ts
222
+ │ ├── index.ts
290
223
  │ └── scaffold.ts
291
- └── tsconfig.json
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
- ## 🚀 Install & Usage
246
+ ## Environment and security
298
247
 
299
- ### Local from git ( dev & bun only )
248
+ Generated projects contain `.env.example`, never the template's local `.env`. Copy it before configuring Auth.js:
300
249
 
301
250
  ```bash
302
- git clone https://github.com/Rising-Corporation/create-next-pro-cli.git
303
- bun install
304
- bun dev
251
+ cp .env.example .env.local
305
252
  ```
306
253
 
307
- - then Global ( on your machine )
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 link create-next-pro-cli
311
- create-next-pro my-next-project
261
+ bun install --frozen-lockfile
262
+ bun run check
312
263
  ```
313
264
 
314
- ### From npm (via bunx , npx ... or global install)
265
+ In a generated project, the same scripts work with all three package managers:
315
266
 
316
267
  ```bash
317
- bunx create-next-pro-cli # to try without install
268
+ bun run check
269
+ npm run check
270
+ pnpm run check
318
271
  ```
319
272
 
320
- - or
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
- bun install -g create-next-pro-cli #ℹ️
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
- > ℹ️ To enable autocompletion automatically, add the `--trust` option when installing globally with Bun:
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 prev opts
3
+ local cur command candidates
4
4
  COMPREPLY=()
5
5
  cur="${COMP_WORDS[COMP_CWORD]}"
6
- prev="${COMP_WORDS[COMP_CWORD-1]}"
7
- opts="addpage addcomponent addlib addapi rmpage --help --version --reconfigure"
8
-
9
- # Autocomplete commands
10
- if [[ ${COMP_CWORD} == 1 ]]; then
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