create-next-mui 0.1.1 → 0.1.3
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 +141 -54
- package/{next-mui-template-ts → next-mui-templates/base-js}/package-lock.json +39 -5
- package/{next-mui-template-js → next-mui-templates/base-js}/package.json +1 -1
- package/{next-mui-template-js → next-mui-templates/base-ts}/package-lock.json +37 -3
- package/{next-mui-template-ts → next-mui-templates/base-ts}/package.json +1 -1
- package/package.json +2 -4
- package/src/index.js +136 -52
- /package/{next-mui-template-js → next-mui-templates/base-js}/.vscode/settings.json +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/.vscode/typescript.code-snippets +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/eslint.config.mjs +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/jsconfig.json +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/next.config.js +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/public/mui.svg +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/public/next.svg +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/public/vercel.svg +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/app/favicon.ico +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/app/globals.css +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/app/layout.jsx +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/app/page.jsx +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/config-global.js +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/lib/router-link/index.js +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/sections/home/view.jsx +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/core/colors.json +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/core/components/button.js +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/core/components/card.js +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/core/components/index.js +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/core/palette.js +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/core/typography.js +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/create-theme.js +0 -0
- /package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/theme-provider.jsx +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/.vscode/settings.json +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/.vscode/typescript.code-snippets +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/eslint.config.mjs +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/next.config.ts +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/public/mui.svg +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/public/next.svg +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/public/vercel.svg +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/app/favicon.ico +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/app/globals.css +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/app/layout.tsx +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/app/page.tsx +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/config-global.ts +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/lib/router-link/index.ts +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/sections/home/view.tsx +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/core/colors.json +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/core/components/button.ts +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/core/components/card.ts +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/core/components/index.ts +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/core/palette.ts +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/core/typography.ts +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/create-theme.ts +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/theme-provider.tsx +0 -0
- /package/{next-mui-template-ts → next-mui-templates/base-ts}/tsconfig.json +0 -0
package/README.md
CHANGED
|
@@ -1,122 +1,209 @@
|
|
|
1
|
-
<img width="1420"
|
|
1
|
+
<img width="1420" alt="CREATE-NEXT-MUI-BANNER" src="https://github.com/user-attachments/assets/11e72fc8-6b6d-40c4-97a1-c05f7b943e02" />
|
|
2
2
|
|
|
3
|
-
# create-next-mui
|
|
3
|
+
# create-next-mui
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/create-next-mui)
|
|
6
|
-
[](https://nextjs.org/)
|
|
7
|
+
[](https://mui.com/)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Scaffold a production-ready **Next.js + Material UI** application in seconds.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The generated project comes preconfigured with:
|
|
12
|
+
|
|
13
|
+
- ⚡ Next.js App Router
|
|
14
|
+
- 🎨 Material UI
|
|
15
|
+
- 📦 TypeScript or JavaScript templates
|
|
16
|
+
- 🧹 ESLint Flat Config
|
|
17
|
+
- 📁 Scalable project structure
|
|
18
|
+
|
|
19
|
+
No global installation required.
|
|
12
20
|
|
|
13
21
|
---
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
# Quick Start
|
|
24
|
+
|
|
25
|
+
Create a new project:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx create-next-mui my-app
|
|
29
|
+
```
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
or
|
|
18
32
|
|
|
19
33
|
```bash
|
|
20
|
-
|
|
34
|
+
npm init next-mui
|
|
35
|
+
```
|
|
21
36
|
|
|
22
|
-
|
|
37
|
+
If no project name is provided, the CLI will guide you through the setup interactively.
|
|
23
38
|
|
|
39
|
+
```bash
|
|
24
40
|
npx create-next-mui
|
|
41
|
+
```
|
|
25
42
|
|
|
26
|
-
|
|
43
|
+
---
|
|
27
44
|
|
|
28
|
-
|
|
45
|
+
# Non-interactive Mode
|
|
46
|
+
|
|
47
|
+
Use the `--yes` (or `-y`) flag to skip prompts and accept the default configuration.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx create-next-mui my-app --yes
|
|
29
51
|
```
|
|
30
52
|
|
|
31
|
-
|
|
53
|
+
This will automatically:
|
|
32
54
|
|
|
33
|
-
|
|
55
|
+
- use the provided project name
|
|
56
|
+
- select the **TypeScript** template
|
|
57
|
+
- generate the project without prompting
|
|
34
58
|
|
|
35
|
-
|
|
59
|
+
This is especially useful for:
|
|
36
60
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
- **📦 Pure & Lightweight:** Zero bloat. Template files are automatically stripped of development artifacts (`node_modules`, caches) before build deployment.
|
|
61
|
+
- CI/CD pipelines
|
|
62
|
+
- automation scripts
|
|
63
|
+
- testing
|
|
64
|
+
- quick project generation
|
|
42
65
|
|
|
43
66
|
---
|
|
44
67
|
|
|
45
|
-
|
|
68
|
+
# Interactive Setup
|
|
69
|
+
|
|
70
|
+
Without `--yes`, the CLI walks you through the available options.
|
|
46
71
|
|
|
47
|
-
|
|
72
|
+
Current prompts include:
|
|
48
73
|
|
|
49
|
-
|
|
50
|
-
|
|
74
|
+
- Project name
|
|
75
|
+
- Language selection
|
|
76
|
+
- TypeScript (recommended)
|
|
77
|
+
- JavaScript
|
|
51
78
|
|
|
52
79
|
---
|
|
53
80
|
|
|
54
|
-
|
|
81
|
+
# Available Templates
|
|
82
|
+
|
|
83
|
+
## TypeScript
|
|
84
|
+
|
|
85
|
+
Recommended for most projects.
|
|
86
|
+
|
|
87
|
+
Includes:
|
|
88
|
+
|
|
89
|
+
- TypeScript
|
|
90
|
+
- strict type checking
|
|
91
|
+
- MUI theme typings
|
|
92
|
+
- ESLint Flat Config
|
|
93
|
+
|
|
94
|
+
## JavaScript
|
|
55
95
|
|
|
56
|
-
|
|
96
|
+
For developers who prefer JavaScript.
|
|
97
|
+
|
|
98
|
+
Includes:
|
|
99
|
+
|
|
100
|
+
- modern JavaScript
|
|
101
|
+
- Material UI
|
|
102
|
+
- ESLint Flat Config
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
# Generated Project Structure
|
|
57
107
|
|
|
58
108
|
```text
|
|
59
|
-
my-
|
|
109
|
+
my-app/
|
|
60
110
|
├── src/
|
|
61
111
|
│ ├── app/
|
|
62
|
-
│
|
|
63
|
-
│ │ └── page.js/ts # Pre-built home view utilizing responsive MUI layouts
|
|
64
|
-
│ ├── components/ # Reusable global presentation components
|
|
112
|
+
│ ├── components/
|
|
65
113
|
│ └── theme/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
├── eslint.config.mjs # Elite natural line-length linting layout
|
|
69
|
-
├── next.config.js # Configured optimization vectors
|
|
114
|
+
├── eslint.config.mjs
|
|
115
|
+
├── next.config.js
|
|
70
116
|
├── package.json
|
|
71
117
|
└── README.md
|
|
72
|
-
|
|
73
118
|
```
|
|
74
119
|
|
|
75
120
|
---
|
|
76
121
|
|
|
77
|
-
|
|
122
|
+
# What's Included
|
|
78
123
|
|
|
79
|
-
|
|
124
|
+
Every generated project comes configured with:
|
|
80
125
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
126
|
+
- Next.js App Router
|
|
127
|
+
- Material UI
|
|
128
|
+
- Theme Provider
|
|
129
|
+
- Emotion integration
|
|
130
|
+
- ESLint v9 Flat Config
|
|
131
|
+
- eslint-plugin-perfectionist
|
|
132
|
+
- eslint-plugin-unused-imports
|
|
133
|
+
- organized project structure
|
|
86
134
|
|
|
87
|
-
|
|
135
|
+
Development artifacts such as `node_modules`, `.next`, and build caches are excluded from generated projects.
|
|
88
136
|
|
|
89
137
|
---
|
|
90
138
|
|
|
91
|
-
|
|
139
|
+
# Getting Started
|
|
92
140
|
|
|
93
|
-
|
|
141
|
+
After scaffolding:
|
|
94
142
|
|
|
95
143
|
```bash
|
|
96
|
-
|
|
144
|
+
cd my-app
|
|
97
145
|
npm install
|
|
146
|
+
npm run dev
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Useful scripts:
|
|
98
150
|
|
|
99
|
-
|
|
151
|
+
```bash
|
|
100
152
|
npm run dev
|
|
153
|
+
```
|
|
101
154
|
|
|
102
|
-
|
|
155
|
+
Start the development server.
|
|
156
|
+
|
|
157
|
+
```bash
|
|
103
158
|
npm run lint
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Run ESLint.
|
|
104
162
|
|
|
105
|
-
|
|
163
|
+
```bash
|
|
106
164
|
npm run build
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Create a production build.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
# CLI Reference
|
|
172
|
+
|
|
173
|
+
## Create a project
|
|
107
174
|
|
|
175
|
+
```bash
|
|
176
|
+
npx create-next-mui my-app
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Interactive mode
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npx create-next-mui
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Accept defaults
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npx create-next-mui my-app --yes
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
or
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npx create-next-mui my-app -y
|
|
108
195
|
```
|
|
109
196
|
|
|
110
197
|
---
|
|
111
198
|
|
|
112
|
-
|
|
199
|
+
# Contributing
|
|
113
200
|
|
|
114
|
-
Issues and pull requests are
|
|
201
|
+
Issues and pull requests are welcome.
|
|
115
202
|
|
|
116
|
-
|
|
203
|
+
If you'd like to improve the templates or add new features, feel free to open an issue or submit a PR.
|
|
117
204
|
|
|
118
205
|
---
|
|
119
206
|
|
|
120
|
-
|
|
207
|
+
# License
|
|
121
208
|
|
|
122
|
-
|
|
209
|
+
MIT
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "next-mui
|
|
2
|
+
"name": "create-next-mui",
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
|
-
"name": "next-mui
|
|
8
|
+
"name": "create-next-mui",
|
|
9
9
|
"version": "0.0.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@emotion/react": "^11.14.0",
|
|
@@ -276,9 +276,9 @@
|
|
|
276
276
|
}
|
|
277
277
|
},
|
|
278
278
|
"node_modules/@emnapi/wasi-threads": {
|
|
279
|
-
"version": "1.2.
|
|
280
|
-
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.
|
|
281
|
-
"integrity": "sha512-
|
|
279
|
+
"version": "1.2.2",
|
|
280
|
+
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
|
|
281
|
+
"integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
|
|
282
282
|
"dev": true,
|
|
283
283
|
"license": "MIT",
|
|
284
284
|
"optional": true,
|
|
@@ -2312,6 +2312,40 @@
|
|
|
2312
2312
|
"node": ">=14.0.0"
|
|
2313
2313
|
}
|
|
2314
2314
|
},
|
|
2315
|
+
"node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/core": {
|
|
2316
|
+
"version": "1.10.0",
|
|
2317
|
+
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
|
2318
|
+
"integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
|
|
2319
|
+
"dev": true,
|
|
2320
|
+
"license": "MIT",
|
|
2321
|
+
"optional": true,
|
|
2322
|
+
"dependencies": {
|
|
2323
|
+
"@emnapi/wasi-threads": "1.2.1",
|
|
2324
|
+
"tslib": "^2.4.0"
|
|
2325
|
+
}
|
|
2326
|
+
},
|
|
2327
|
+
"node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/runtime": {
|
|
2328
|
+
"version": "1.10.0",
|
|
2329
|
+
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
|
|
2330
|
+
"integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
|
|
2331
|
+
"dev": true,
|
|
2332
|
+
"license": "MIT",
|
|
2333
|
+
"optional": true,
|
|
2334
|
+
"dependencies": {
|
|
2335
|
+
"tslib": "^2.4.0"
|
|
2336
|
+
}
|
|
2337
|
+
},
|
|
2338
|
+
"node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
|
|
2339
|
+
"version": "1.2.1",
|
|
2340
|
+
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
|
2341
|
+
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
|
2342
|
+
"dev": true,
|
|
2343
|
+
"license": "MIT",
|
|
2344
|
+
"optional": true,
|
|
2345
|
+
"dependencies": {
|
|
2346
|
+
"tslib": "^2.4.0"
|
|
2347
|
+
}
|
|
2348
|
+
},
|
|
2315
2349
|
"node_modules/@unrs/resolver-binding-win32-arm64-msvc": {
|
|
2316
2350
|
"version": "1.12.2",
|
|
2317
2351
|
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.12.2.tgz",
|
|
@@ -276,9 +276,9 @@
|
|
|
276
276
|
}
|
|
277
277
|
},
|
|
278
278
|
"node_modules/@emnapi/wasi-threads": {
|
|
279
|
-
"version": "1.2.
|
|
280
|
-
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.
|
|
281
|
-
"integrity": "sha512-
|
|
279
|
+
"version": "1.2.2",
|
|
280
|
+
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
|
|
281
|
+
"integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
|
|
282
282
|
"dev": true,
|
|
283
283
|
"license": "MIT",
|
|
284
284
|
"optional": true,
|
|
@@ -2312,6 +2312,40 @@
|
|
|
2312
2312
|
"node": ">=14.0.0"
|
|
2313
2313
|
}
|
|
2314
2314
|
},
|
|
2315
|
+
"node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/core": {
|
|
2316
|
+
"version": "1.10.0",
|
|
2317
|
+
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
|
2318
|
+
"integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
|
|
2319
|
+
"dev": true,
|
|
2320
|
+
"license": "MIT",
|
|
2321
|
+
"optional": true,
|
|
2322
|
+
"dependencies": {
|
|
2323
|
+
"@emnapi/wasi-threads": "1.2.1",
|
|
2324
|
+
"tslib": "^2.4.0"
|
|
2325
|
+
}
|
|
2326
|
+
},
|
|
2327
|
+
"node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/runtime": {
|
|
2328
|
+
"version": "1.10.0",
|
|
2329
|
+
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
|
|
2330
|
+
"integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
|
|
2331
|
+
"dev": true,
|
|
2332
|
+
"license": "MIT",
|
|
2333
|
+
"optional": true,
|
|
2334
|
+
"dependencies": {
|
|
2335
|
+
"tslib": "^2.4.0"
|
|
2336
|
+
}
|
|
2337
|
+
},
|
|
2338
|
+
"node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
|
|
2339
|
+
"version": "1.2.1",
|
|
2340
|
+
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
|
2341
|
+
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
|
2342
|
+
"dev": true,
|
|
2343
|
+
"license": "MIT",
|
|
2344
|
+
"optional": true,
|
|
2345
|
+
"dependencies": {
|
|
2346
|
+
"tslib": "^2.4.0"
|
|
2347
|
+
}
|
|
2348
|
+
},
|
|
2315
2349
|
"node_modules/@unrs/resolver-binding-win32-arm64-msvc": {
|
|
2316
2350
|
"version": "1.12.2",
|
|
2317
2351
|
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.12.2.tgz",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-next-mui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "spin up your nextjs project with mui setup",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextjs",
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"src",
|
|
26
|
-
"next-mui-
|
|
27
|
-
"next-mui-template-js"
|
|
26
|
+
"next-mui-templates"
|
|
28
27
|
],
|
|
29
28
|
"main": "index.js",
|
|
30
29
|
"scripts": {
|
|
@@ -32,7 +31,6 @@
|
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
33
|
"@clack/prompts": "^1.5.0",
|
|
35
|
-
"degit": "^3.3.2",
|
|
36
34
|
"picocolors": "^1.1.1"
|
|
37
35
|
}
|
|
38
36
|
}
|
package/src/index.js
CHANGED
|
@@ -6,12 +6,54 @@ import fs from "node:fs/promises";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// ----------------------------------------------------------------------
|
|
10
|
+
|
|
10
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
12
|
const __dirname = path.dirname(__filename);
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
-
|
|
14
|
+
const args = process.argv.slice(2);
|
|
15
|
+
|
|
16
|
+
const positionalArgs = args.filter(
|
|
17
|
+
(arg) => !["--yes", "-y", "--js"].includes(arg),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const PROJECT_NAME = positionalArgs[0];
|
|
21
|
+
const hasInitialProjectName = PROJECT_NAME !== undefined;
|
|
22
|
+
|
|
23
|
+
const hasYesFlag = args.includes("--yes") || args.includes("-y");
|
|
24
|
+
const hasJsFlag = args.includes("--js");
|
|
25
|
+
|
|
26
|
+
const DEFAULT_LANGUAGE = hasJsFlag ? "js" : "ts";
|
|
27
|
+
|
|
28
|
+
// ----------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
const LANG = [
|
|
31
|
+
{
|
|
32
|
+
value: "ts",
|
|
33
|
+
label: "TypeScript (Recommended)",
|
|
34
|
+
hint: "Strict typings, clean architecture",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: "js",
|
|
38
|
+
label: "JavaScript",
|
|
39
|
+
hint: "Vanilla JS configuration",
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const FEATURES = [
|
|
44
|
+
{
|
|
45
|
+
value: "react-query",
|
|
46
|
+
label: "React Query",
|
|
47
|
+
hint: "TanStack Query configuration",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
value: "zustand",
|
|
51
|
+
label: "Zustand",
|
|
52
|
+
hint: "Lightweight global state management",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
// ----------------------------------------------------------------------
|
|
15
57
|
|
|
16
58
|
function validateProjectName(value) {
|
|
17
59
|
if (value.length === 0) return "Project name is required!";
|
|
@@ -48,19 +90,21 @@ async function updateProjectName(targetProjectDir, packageName) {
|
|
|
48
90
|
await fs.writeFile(filePath, `${JSON.stringify(json, null, 2)}\n`);
|
|
49
91
|
} catch (error) {
|
|
50
92
|
if (error.code === "ENOENT") return;
|
|
51
|
-
|
|
52
93
|
throw error;
|
|
53
94
|
}
|
|
54
95
|
}),
|
|
55
96
|
);
|
|
56
97
|
}
|
|
57
98
|
|
|
99
|
+
// ----------------------------------------------------------------------
|
|
100
|
+
|
|
58
101
|
async function main() {
|
|
59
102
|
console.clear();
|
|
103
|
+
|
|
60
104
|
p.intro(color.bgBlue(color.white(" create-next-mui ")));
|
|
61
105
|
|
|
62
106
|
const projectNameError = hasInitialProjectName
|
|
63
|
-
? validateProjectName(
|
|
107
|
+
? validateProjectName(PROJECT_NAME)
|
|
64
108
|
: undefined;
|
|
65
109
|
|
|
66
110
|
if (projectNameError) {
|
|
@@ -72,28 +116,29 @@ async function main() {
|
|
|
72
116
|
{
|
|
73
117
|
name: () =>
|
|
74
118
|
hasInitialProjectName
|
|
75
|
-
? Promise.resolve(
|
|
119
|
+
? Promise.resolve(PROJECT_NAME)
|
|
76
120
|
: p.text({
|
|
77
121
|
message: "What is your project name?",
|
|
78
122
|
placeholder: "my-next-mui-app (or '.' for current directory)",
|
|
79
123
|
validate: validateProjectName,
|
|
80
124
|
}),
|
|
125
|
+
|
|
81
126
|
language: () =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
127
|
+
hasYesFlag
|
|
128
|
+
? Promise.resolve(DEFAULT_LANGUAGE)
|
|
129
|
+
: p.select({
|
|
130
|
+
message: "Choose your language flavor:",
|
|
131
|
+
options: LANG,
|
|
132
|
+
}),
|
|
133
|
+
|
|
134
|
+
features: () =>
|
|
135
|
+
hasYesFlag
|
|
136
|
+
? Promise.resolve([])
|
|
137
|
+
: p.multiselect({
|
|
138
|
+
message: "Select optional features:",
|
|
139
|
+
required: false,
|
|
140
|
+
options: FEATURES,
|
|
141
|
+
}),
|
|
97
142
|
},
|
|
98
143
|
{
|
|
99
144
|
onCancel: () => {
|
|
@@ -103,71 +148,110 @@ async function main() {
|
|
|
103
148
|
},
|
|
104
149
|
);
|
|
105
150
|
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
151
|
+
// --------------------------------------------------------------------
|
|
152
|
+
// Paths
|
|
153
|
+
// --------------------------------------------------------------------
|
|
154
|
+
|
|
155
|
+
const baseTemplateDir = path.resolve(
|
|
156
|
+
__dirname,
|
|
157
|
+
"..",
|
|
158
|
+
"next-mui-templates",
|
|
159
|
+
`base-${project.language}`,
|
|
160
|
+
);
|
|
110
161
|
|
|
111
|
-
// Define destination paths (where the user is running the command)
|
|
112
162
|
const targetProjectDir = path.resolve(process.cwd(), project.name);
|
|
163
|
+
|
|
113
164
|
const packageName = getPackageName(project.name, targetProjectDir);
|
|
114
165
|
|
|
115
|
-
//
|
|
166
|
+
// --------------------------------------------------------------------
|
|
167
|
+
// Current directory validation
|
|
168
|
+
// --------------------------------------------------------------------
|
|
169
|
+
|
|
116
170
|
if (project.name === ".") {
|
|
117
171
|
try {
|
|
118
|
-
const
|
|
119
|
-
|
|
172
|
+
const files = await fs.readdir(targetProjectDir);
|
|
173
|
+
|
|
174
|
+
if (files.length > 0) {
|
|
120
175
|
p.log.error(
|
|
121
176
|
color.red(
|
|
122
|
-
"The current directory is not empty! Please clear it or specify
|
|
177
|
+
"The current directory is not empty! Please clear it or specify another project name.",
|
|
123
178
|
),
|
|
124
179
|
);
|
|
180
|
+
|
|
125
181
|
process.exit(1);
|
|
126
182
|
}
|
|
127
|
-
} catch
|
|
128
|
-
// If the directory reading fails completely, we exit safely
|
|
183
|
+
} catch {
|
|
129
184
|
process.exit(1);
|
|
130
185
|
}
|
|
131
186
|
}
|
|
132
187
|
|
|
188
|
+
// --------------------------------------------------------------------
|
|
189
|
+
|
|
133
190
|
const s = p.spinner();
|
|
134
|
-
|
|
191
|
+
|
|
192
|
+
s.start("Scaffolding your Next.js + MUI workspace...");
|
|
135
193
|
|
|
136
194
|
try {
|
|
137
|
-
//
|
|
138
|
-
|
|
195
|
+
// ------------------------------------------------------------------
|
|
196
|
+
// Copy base template
|
|
197
|
+
// ------------------------------------------------------------------
|
|
198
|
+
|
|
199
|
+
await fs.cp(baseTemplateDir, targetProjectDir, {
|
|
139
200
|
recursive: true,
|
|
140
201
|
filter: (src) => {
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
targetName !== ".next" &&
|
|
145
|
-
targetName !== "out" &&
|
|
146
|
-
targetName !== "build"
|
|
147
|
-
);
|
|
202
|
+
const name = path.basename(src);
|
|
203
|
+
|
|
204
|
+
return !["node_modules", ".next", "out", "build"].includes(name);
|
|
148
205
|
},
|
|
149
206
|
});
|
|
207
|
+
|
|
208
|
+
// ------------------------------------------------------------------
|
|
209
|
+
// Apply selected features
|
|
210
|
+
// ------------------------------------------------------------------
|
|
211
|
+
|
|
212
|
+
for (const feature of project.features) {
|
|
213
|
+
const featureDir = path.resolve(
|
|
214
|
+
__dirname,
|
|
215
|
+
"..",
|
|
216
|
+
"next-mui-features",
|
|
217
|
+
feature,
|
|
218
|
+
project.language,
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
await fs.cp(featureDir, targetProjectDir, {
|
|
222
|
+
recursive: true,
|
|
223
|
+
filter: (src) => {
|
|
224
|
+
const name = path.basename(src);
|
|
225
|
+
|
|
226
|
+
return !["node_modules", ".next", "out", "build"].includes(name);
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// ------------------------------------------------------------------
|
|
232
|
+
|
|
150
233
|
await updateProjectName(targetProjectDir, packageName);
|
|
151
234
|
|
|
152
235
|
s.stop(color.green("Workspace scaffolded successfully!"));
|
|
153
236
|
} catch (error) {
|
|
154
|
-
s.stop(color.red("Failed to
|
|
155
|
-
|
|
237
|
+
s.stop(color.red("Failed to scaffold workspace."));
|
|
238
|
+
|
|
239
|
+
p.note(color.yellow(error.message), "Troubleshooting");
|
|
240
|
+
|
|
156
241
|
process.exit(1);
|
|
157
242
|
}
|
|
158
243
|
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
? ""
|
|
163
|
-
: `${color.cyan(`cd ${project.name}`)}\n`;
|
|
244
|
+
// --------------------------------------------------------------------
|
|
245
|
+
|
|
246
|
+
const cd =
|
|
247
|
+
project.name === "." ? "" : `${color.cyan(`cd ${project.name}`)}\n`;
|
|
164
248
|
|
|
165
249
|
p.note(
|
|
166
|
-
`${
|
|
167
|
-
"Next Steps
|
|
250
|
+
`${cd}${color.cyan("npm install")}\n${color.cyan("npm run dev")}`,
|
|
251
|
+
"Next Steps",
|
|
168
252
|
);
|
|
169
253
|
|
|
170
|
-
p.outro(
|
|
254
|
+
p.outro("✨ Build clean and fast with create-next-mui!");
|
|
171
255
|
}
|
|
172
256
|
|
|
173
257
|
main().catch(console.error);
|
|
File without changes
|
/package/{next-mui-template-js → next-mui-templates/base-js}/.vscode/typescript.code-snippets
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/core/components/button.js
RENAMED
|
File without changes
|
/package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/core/components/card.js
RENAMED
|
File without changes
|
/package/{next-mui-template-js → next-mui-templates/base-js}/src/theme/core/components/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{next-mui-template-ts → next-mui-templates/base-ts}/.vscode/typescript.code-snippets
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/core/components/button.ts
RENAMED
|
File without changes
|
/package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/core/components/card.ts
RENAMED
|
File without changes
|
/package/{next-mui-template-ts → next-mui-templates/base-ts}/src/theme/core/components/index.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|