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.
Files changed (107) hide show
  1. package/README.md +281 -291
  2. package/create-next-pro-completion.sh +8 -38
  3. package/create-next-pro-completion.zsh +13 -0
  4. package/dist/bin.bun.js +2265 -794
  5. package/dist/bin.node.js +2425 -805
  6. package/dist/bin.node.js.map +1 -1
  7. package/package.json +50 -27
  8. package/templates/Projects/default/.env.example +17 -0
  9. package/templates/Projects/default/.github/workflows/quality.yml +24 -0
  10. package/templates/Projects/default/.gitignore.template +47 -0
  11. package/templates/Projects/default/.prettierignore +3 -0
  12. package/templates/Projects/default/README.md +52 -108
  13. package/templates/Projects/default/bun.lock +1152 -0
  14. package/templates/Projects/default/eslint.config.mjs +27 -11
  15. package/templates/Projects/default/messages/en/_global_ui.json +23 -10
  16. package/templates/Projects/default/messages/en.ts +17 -2
  17. package/templates/Projects/default/messages/fr/_global_ui.json +23 -10
  18. package/templates/Projects/default/messages/fr.ts +17 -2
  19. package/templates/Projects/default/next.config.ts +43 -3
  20. package/templates/Projects/default/package.json +42 -24
  21. package/templates/Projects/default/playwright.config.ts +26 -0
  22. package/templates/Projects/default/pnpm-workspace.yaml +5 -0
  23. package/templates/Projects/default/public/{cnp-logo.svg → logo.svg} +1 -1
  24. package/templates/Projects/default/src/app/[locale]/(public)/layout.tsx +8 -1
  25. package/templates/Projects/default/src/app/[locale]/(public)/login/page.tsx +8 -0
  26. package/templates/Projects/default/src/app/[locale]/(public)/register/page.tsx +8 -0
  27. package/templates/Projects/default/src/app/[locale]/(user)/dashboard/error.tsx +25 -0
  28. package/templates/Projects/default/src/app/[locale]/(user)/dashboard/loading.tsx +5 -0
  29. package/templates/Projects/default/src/app/[locale]/(user)/{Dashboard → dashboard}/page.tsx +1 -1
  30. package/templates/Projects/default/src/app/[locale]/(user)/layout.tsx +24 -2
  31. package/templates/Projects/default/src/app/[locale]/(user)/settings/loading.tsx +5 -0
  32. package/templates/Projects/default/src/app/[locale]/(user)/{Settings → settings}/page.tsx +1 -2
  33. package/templates/Projects/default/src/app/[locale]/(user)/userInfo/loading.tsx +5 -0
  34. package/templates/Projects/default/src/app/[locale]/(user)/{UserInfo → userInfo}/page.tsx +1 -2
  35. package/templates/Projects/default/src/app/[locale]/layout.tsx +34 -10
  36. package/templates/Projects/default/src/app/[locale]/loading.tsx +0 -9
  37. package/templates/Projects/default/src/app/[locale]/not-found.tsx +6 -15
  38. package/templates/Projects/default/src/app/[locale]/page.tsx +10 -1
  39. package/templates/Projects/default/src/app/api/auth/[...nextauth]/route.ts +8 -60
  40. package/templates/Projects/default/src/app/not-found.tsx +1 -1
  41. package/templates/Projects/default/src/app/sitemap.ts +2 -2
  42. package/templates/Projects/default/src/app/styles/globals.css +166 -113
  43. package/templates/Projects/default/src/auth.ts +20 -0
  44. package/templates/Projects/default/src/config.ts +3 -3
  45. package/templates/Projects/default/src/env.ts +65 -0
  46. package/templates/Projects/default/src/lib/i18n/messages.ts +8 -0
  47. package/templates/Projects/default/src/lib/i18n/request.ts +2 -16
  48. package/templates/Projects/default/src/lib/security/csp.ts +16 -0
  49. package/templates/Projects/default/src/lib/utils.ts +2 -1
  50. package/templates/Projects/default/src/proxy.ts +13 -0
  51. package/templates/Projects/default/src/ui/_global/BackButton.tsx +4 -2
  52. package/templates/Projects/default/src/ui/_global/Button.tsx +3 -8
  53. package/templates/Projects/default/src/ui/_global/GlobalHeader.tsx +10 -28
  54. package/templates/Projects/default/src/ui/_global/GlobalMain.tsx +1 -1
  55. package/templates/Projects/default/src/ui/_global/LocaleSwitcher.tsx +9 -10
  56. package/templates/Projects/default/src/ui/_global/PublicNav.tsx +51 -17
  57. package/templates/Projects/default/src/ui/_global/ThemeToggle.tsx +45 -39
  58. package/templates/Projects/default/src/ui/_global/UserNav.tsx +6 -6
  59. package/templates/Projects/default/src/ui/_home/page-ui.tsx +5 -7
  60. package/templates/Projects/default/src/ui/{Dashboard → dashboard}/LogoutButton.tsx +9 -7
  61. package/templates/Projects/default/src/ui/{Dashboard → dashboard}/StatsCard.tsx +4 -4
  62. package/templates/Projects/default/src/ui/{Dashboard → dashboard}/page-ui.tsx +7 -8
  63. package/templates/Projects/default/src/ui/login/page-ui.tsx +36 -0
  64. package/templates/Projects/default/src/ui/register/page-ui.tsx +38 -0
  65. package/templates/Projects/default/src/ui/settings/page-ui.tsx +15 -0
  66. package/templates/Projects/default/src/ui/userInfo/page-ui.tsx +15 -0
  67. package/templates/Projects/default/tailwind.config.ts +81 -1
  68. package/templates/Projects/default/tests/consumer/validate-template.ts +66 -0
  69. package/templates/Projects/default/tests/e2e/template-remediation.playwright.ts +106 -0
  70. package/templates/Projects/default/tests/rendering/verify-rendering.ts +56 -0
  71. package/templates/Projects/default/tests/unit/csp.test.ts +19 -0
  72. package/templates/Projects/default/tests/unit/env.test.ts +76 -0
  73. package/templates/Projects/default/tsconfig.json +6 -6
  74. package/templates/Projects/default/example.env +0 -8
  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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-next-pro-cli",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "Advanced Next.js project scaffolder with i18n, Tailwind, App Router and more.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,8 +11,13 @@
11
11
  },
12
12
  "files": [
13
13
  "dist",
14
- "templates",
14
+ "templates/Api",
15
+ "templates/Component",
16
+ "templates/Lib",
17
+ "templates/Page",
18
+ "templates/Projects/default",
15
19
  "create-next-pro-completion.sh",
20
+ "create-next-pro-completion.zsh",
16
21
  "public/cnp-banner.svg",
17
22
  "public/logo.svg",
18
23
  "LICENSE",
@@ -21,31 +26,50 @@
21
26
  "author": "MrRise",
22
27
  "license": "MIT",
23
28
  "type": "module",
29
+ "packageManager": "bun@1.3.14",
30
+ "engines": {
31
+ "node": ">=24",
32
+ "bun": ">=1.3"
33
+ },
24
34
  "scripts": {
25
35
  "dev": "bun run bin.bun.ts",
26
36
  "scaffold-dev": "bun run src/scaffold-dev.ts",
27
- "test": "vitest run",
37
+ "format": "prettier --write --ignore-unknown .github/workflows/ci.yml .husky scripts bunfig.toml bin.bun.ts bin.node.ts src tsup.config.ts eslint.config.mjs package.json tsconfig.base.json tsconfig.json tsconfig.node.json",
38
+ "format:check": "prettier --check --ignore-unknown .github/workflows/ci.yml .husky scripts bunfig.toml bin.bun.ts bin.node.ts src tsup.config.ts eslint.config.mjs package.json tsconfig.base.json tsconfig.json tsconfig.node.json",
39
+ "lint": "eslint bin.bun.ts bin.node.ts scripts src tsup.config.ts",
40
+ "typecheck": "tsc --project tsconfig.json --noEmit",
41
+ "language:check": "bun scripts/check-public-language.ts",
42
+ "test": "bun test",
28
43
  "clean": "rm -rf dist",
29
44
  "build": "bun run clean && bun run build:node && bun run build:bun && cp scripts/create-next-pro dist/create-next-pro && chmod +x dist/create-next-pro",
30
45
  "build:node": "tsup",
31
46
  "build:bun": "bun build bin.bun.ts --outdir dist --target=bun",
32
- "prepublishOnly": "bun run clean && bun run build",
33
- "commit": "cz",
34
- "release": "bunx --bun standard-version",
35
- "prepare-husky": "husky",
36
- "version-patch": "npm version patch",
37
- "git-fullpush": "bun run build && git add -A && bun commit && git push origin master && bun version-patch"
38
- },
39
- "config": {
40
- "commitizen": {
41
- "path": "./node_modules/cz-conventional-changelog"
42
- }
47
+ "check": "bun run format:check && bun run lint && bun run typecheck && bun run language:check && bun test && bun run build",
48
+ "prepublishOnly": "bun run check",
49
+ "commitlint:range": "commitlint",
50
+ "release:check": "bun scripts/release.ts check",
51
+ "release:prepare": "bun scripts/release.ts prepare",
52
+ "release:resume": "bun scripts/release.ts resume",
53
+ "release:commit": "bun scripts/release.ts commit",
54
+ "package:pack": "bun scripts/pack.ts",
55
+ "package:inspect": "bun scripts/inspect-package.ts"
43
56
  },
44
57
  "lint-staged": {
45
58
  "*.{js,ts,tsx,md,css,json}": [
46
59
  "prettier --write"
47
60
  ]
48
61
  },
62
+ "overrides": {
63
+ "brace-expansion": "2.0.3",
64
+ "esbuild": "0.28.1",
65
+ "fast-uri": "3.1.2",
66
+ "glob": "10.5.0",
67
+ "js-yaml": "5.2.1",
68
+ "picomatch": "4.0.5",
69
+ "postcss": "8.5.17",
70
+ "rollup": "4.62.2",
71
+ "vite": "8.1.5"
72
+ },
49
73
  "keywords": [
50
74
  "nextjs",
51
75
  "bun",
@@ -59,20 +83,19 @@
59
83
  "prompts": "^2.4.2"
60
84
  },
61
85
  "devDependencies": {
62
- "@commitlint/cli": "^19.8.1",
63
- "@commitlint/config-conventional": "^19.8.1",
64
- "@types/node": "^22",
86
+ "@commitlint/cli": "^21.2.1",
87
+ "@commitlint/config-conventional": "^21.2.0",
88
+ "@eslint/js": "^10.0.1",
89
+ "@types/bun": "^1.3.14",
90
+ "@types/node": "^24.13.3",
65
91
  "@types/prompts": "^2.4.9",
66
- "commitizen": "^4.3.1",
67
- "csstype": "^3.1.3",
68
- "cz-conventional-changelog": "^3.3.0",
92
+ "eslint": "^10.7.0",
69
93
  "husky": "^9.1.7",
70
- "kleur": "^4.1.5",
71
- "lint-staged": "^16.1.5",
72
- "prettier": "^3.6.2",
73
- "standard-version": "^9.5.0",
74
- "tsup": "^8.5.0",
75
- "undici-types": "^6",
76
- "vitest": "^3.2.4"
94
+ "lint-staged": "^17.0.8",
95
+ "prettier": "^3.9.5",
96
+ "tsup": "^8.5.1",
97
+ "typescript": "^6.0.3",
98
+ "typescript-eslint": "^8.64.0",
99
+ "vitest": "^4.1.10"
77
100
  }
78
101
  }
@@ -0,0 +1,17 @@
1
+ PORT=3000
2
+ NEXT_PUBLIC_APP_URL=http://localhost:3000
3
+
4
+ # Auth.js v5
5
+ AUTH_URL=http://localhost:3000
6
+ AUTH_SECRET=
7
+ AUTH_GOOGLE_ID=
8
+ AUTH_GOOGLE_SECRET=
9
+ AUTH_TRUST_HOST=false
10
+ AUTH_DISABLED=false
11
+
12
+ # Legacy aliases are still accepted by the template code:
13
+ # PROJECT_PRODUCTION_URL=
14
+ # NEXTAUTH_URL=
15
+ # NEXTAUTH_SECRET=
16
+ # GOOGLE_CLIENT_ID=
17
+ # GOOGLE_CLIENT_SECRET=
@@ -0,0 +1,24 @@
1
+ name: Quality
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [master]
7
+
8
+ jobs:
9
+ validate:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: oven-sh/setup-bun@v2
14
+ with:
15
+ bun-version: 1.3.14
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: 24
19
+ - run: bun install --frozen-lockfile
20
+ - run: bun run check
21
+ - run: bun run audit
22
+ - run: bun run test:consumer
23
+ - run: bunx playwright install --with-deps chromium
24
+ - run: bun run test:e2e
@@ -0,0 +1,47 @@
1
+ # dependencies
2
+ /node_modules
3
+ /.pnp
4
+ .pnp.*
5
+ .yarn/*
6
+ !.yarn/patches
7
+ !.yarn/plugins
8
+ !.yarn/releases
9
+ !.yarn/versions
10
+
11
+ # testing
12
+ /coverage
13
+ /artifacts
14
+ /playwright-report
15
+ /test-results
16
+
17
+ # next.js
18
+ /.next/
19
+ /out/
20
+
21
+ # production
22
+ /build
23
+
24
+ # misc
25
+ .DS_Store
26
+ *.pem
27
+
28
+ # debug
29
+ npm-debug.log*
30
+ yarn-debug.log*
31
+ yarn-error.log*
32
+ .pnpm-debug.log*
33
+
34
+ # env files
35
+ .env*
36
+ !.env.example
37
+
38
+ # vercel
39
+ .vercel
40
+
41
+ # typescript
42
+ *.tsbuildinfo
43
+ next-env.d.ts
44
+
45
+ # development
46
+ .cursor
47
+ .vscode
@@ -0,0 +1,3 @@
1
+ package-lock.json
2
+ pnpm-lock.yaml
3
+ yarn.lock
@@ -1,137 +1,81 @@
1
- # My Next.js Project
1
+ # Create Next Pro Template
2
2
 
3
- This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-pro`](https://github.com/Rising-Corporation/create-next-pro-cli).
3
+ Next.js App Router template for `create-next-pro-cli`.
4
4
 
5
- ## 🚀 Getting Started
5
+ ## Runtime
6
6
 
7
- First, run the development server:
7
+ This template is Bun-first. Do not use npm, pnpm, or yarn for project scripts.
8
8
 
9
- ```bash
10
- npm run dev
11
- # or
12
- yarn dev
13
- # or
14
- pnpm dev
15
- # or
16
- bun dev
17
- ```
18
-
19
- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
20
-
21
- You can start editing the page by modifying `src/app/[locale]/page.tsx`. The page auto-updates as you edit the file.
22
-
23
- ## ✨ Features
24
-
25
- This project comes with the following features pre-configured:
26
-
27
- - **🌍 Internationalization (i18n)** - Using `next-intl` with locale-based routing
28
- - **🎨 Tailwind CSS** - Utility-first CSS framework
29
- - **⚡ TypeScript** - Type-safe development
30
- - **🔐 Authentication** - NextAuth.js integration
31
- - **📱 Responsive Design** - Mobile-first approach
32
- - **⚙️ ESLint & Prettier** - Code quality and formatting
33
- - **🎯 App Router** - Latest Next.js routing system
34
-
35
- ## 🛠️ CLI Commands
36
-
37
- You can use `create-next-pro` to add and manage your project structure:
38
-
39
- ### Add a new page:
9
+ Required:
40
10
 
41
11
  ```bash
42
- create-next-pro addpage MyPage
12
+ bun --version
13
+ node --version
43
14
  ```
44
15
 
45
- ### Add a nested page:
16
+ Node must satisfy `>=24.0.0`.
46
17
 
47
- ```bash
48
- create-next-pro addpage ParentPage.ChildPage
49
- ```
50
-
51
- ### Add a component (global):
18
+ ## Setup
52
19
 
53
20
  ```bash
54
- create-next-pro addcomponent MyComponent
21
+ bun install
22
+ cp .env.example .env
23
+ bun run dev
55
24
  ```
56
25
 
57
- ### Add a component in a specific page:
26
+ Open `http://localhost:3000`.
58
27
 
59
- ```bash
60
- create-next-pro addcomponent MyComponent -P MyPage
61
- ```
28
+ ## Environment
62
29
 
63
- ### Add a library:
30
+ Auth.js v5 supports Google OAuth when credentials are configured. The public
31
+ application, checks and production build work without OAuth credentials.
64
32
 
65
- ```bash
66
- create-next-pro addlib mylib
67
- ```
68
-
69
- ### Add an API route:
33
+ Optional Google OAuth values (set all three together):
70
34
 
71
35
  ```bash
72
- create-next-pro addapi hello
36
+ AUTH_SECRET=
37
+ AUTH_GOOGLE_ID=
38
+ AUTH_GOOGLE_SECRET=
39
+ NEXT_PUBLIC_APP_URL=http://localhost:3000
40
+ AUTH_TRUST_HOST=false
41
+ AUTH_DISABLED=false
73
42
  ```
74
43
 
75
- ### Add a new language (i18n):
44
+ The template also accepts the legacy aliases `NEXTAUTH_SECRET`, `NEXTAUTH_URL`, `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, and `PROJECT_PRODUCTION_URL` to ease migration from older generated projects.
76
45
 
77
- ```bash
78
- create-next-pro addlanguage fr
79
- ```
80
-
81
- ### Add translation text:
46
+ ## Scripts
82
47
 
83
48
  ```bash
84
- create-next-pro addtext MyPage.welcome "Welcome to my page"
85
- ```
86
-
87
- ### Remove a page:
88
-
89
- ```bash
90
- create-next-pro rmpage MyPage
91
- ```
92
-
93
- ## 📁 Project Structure
94
-
49
+ bun run dev
50
+ bun run lint
51
+ bun run typecheck
52
+ bun run build
53
+ bun run verify:rendering
54
+ bun test
55
+ bun run test:e2e
56
+ bun run test:consumer
57
+ bun run audit
58
+ bun run check
95
59
  ```
96
- src/
97
- ├── app/
98
- │ ├── [locale]/ # Internationalization routing
99
- │ │ ├── (public)/ # Public pages (login, register)
100
- │ │ └── (user)/ # Protected pages (dashboard, settings)
101
- │ └── api/ # API routes
102
- ├── lib/ # Utility libraries
103
- │ ├── auth/ # Authentication helpers
104
- │ └── i18n/ # Internationalization config
105
- └── ui/ # UI components organized by page
106
- ```
107
-
108
- ## 🌐 Internationalization
109
-
110
- The project supports multiple languages through the `messages/` directory:
111
-
112
- - `messages/en/` - English translations
113
- - `messages/fr/` - French translations
114
- - Add more languages with `create-next-pro addlanguage <locale>`
115
-
116
- ## 🔐 Authentication
117
-
118
- Authentication is configured with NextAuth.js. Check `src/auth.config.ts` for configuration and `/api/auth/` for auth routes.
119
-
120
- ## 📚 Learn More
121
-
122
- To learn more about the technologies used:
123
-
124
- - [Next.js Documentation](https://nextjs.org/docs)
125
- - [Tailwind CSS](https://tailwindcss.com/docs)
126
- - [next-intl Documentation](https://next-intl-docs.vercel.app/)
127
- - [NextAuth.js Documentation](https://next-auth.js.org/)
128
60
 
129
- ## 🚀 Deploy on Vercel
61
+ ## Template Features
130
62
 
131
- The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new) from the creators of Next.js.
63
+ - Next.js 16 App Router
64
+ - React 19
65
+ - Auth.js v5 through `next-auth@beta`
66
+ - Google OAuth provider
67
+ - Protected user routes
68
+ - `next-intl` locale routing for `en` and `fr`
69
+ - Tailwind CSS 4 theme tokens
70
+ - Playwright smoke captures for desktop and mobile
132
71
 
133
- Check out the [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
72
+ ## Rendering and CSP
134
73
 
135
- ---
74
+ Public localized pages are prerendered for `en` and `fr`. Authenticated routes
75
+ and Auth.js handlers stay dynamic. `bun run verify:rendering` checks this boundary
76
+ after every production build.
136
77
 
137
- Created with ❤️ using [create-next-pro](https://github.com/Rising-Corporation/create-next-pro-cli)
78
+ The default Content Security Policy follows the stable static-rendering setup
79
+ documented by Next.js and allows the framework's inline bootstrap scripts. Projects
80
+ with stricter compliance requirements can adopt a per-request nonce, with the
81
+ tradeoff that nonce-protected pages become dynamically rendered.