@teispace/next-maker 0.2.2 → 0.4.0

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 (46) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +294 -55
  3. package/dist/index.js +257 -22
  4. package/dist/index.js.map +4 -4
  5. package/dist/src/commands/feature.d.ts.map +1 -1
  6. package/dist/src/commands/index.d.ts.map +1 -1
  7. package/dist/src/commands/service.d.ts +3 -0
  8. package/dist/src/commands/service.d.ts.map +1 -0
  9. package/dist/src/commands/slice.d.ts +3 -0
  10. package/dist/src/commands/slice.d.ts.map +1 -0
  11. package/dist/src/config/index.d.ts +2 -0
  12. package/dist/src/config/index.d.ts.map +1 -1
  13. package/dist/src/config/output.d.ts +1 -0
  14. package/dist/src/config/output.d.ts.map +1 -1
  15. package/dist/src/config/paths.d.ts +17 -0
  16. package/dist/src/config/paths.d.ts.map +1 -1
  17. package/dist/src/config/utils.d.ts +4 -0
  18. package/dist/src/config/utils.d.ts.map +1 -1
  19. package/dist/src/core/package-manager.d.ts.map +1 -1
  20. package/dist/src/prompts/create-app.prompt.d.ts +1 -0
  21. package/dist/src/prompts/create-app.prompt.d.ts.map +1 -1
  22. package/dist/src/prompts/feature.prompt.d.ts +10 -1
  23. package/dist/src/prompts/feature.prompt.d.ts.map +1 -1
  24. package/dist/src/prompts/service.prompt.d.ts +7 -0
  25. package/dist/src/prompts/service.prompt.d.ts.map +1 -0
  26. package/dist/src/prompts/slice.prompt.d.ts +6 -0
  27. package/dist/src/prompts/slice.prompt.d.ts.map +1 -0
  28. package/dist/src/services/common/api-registration.service.d.ts +7 -0
  29. package/dist/src/services/common/api-registration.service.d.ts.map +1 -0
  30. package/dist/src/services/feature/detection.service.d.ts +8 -0
  31. package/dist/src/services/feature/detection.service.d.ts.map +1 -0
  32. package/dist/src/services/feature/registration.service.d.ts +6 -0
  33. package/dist/src/services/feature/registration.service.d.ts.map +1 -0
  34. package/dist/src/services/feature/templates.service.d.ts +11 -0
  35. package/dist/src/services/feature/templates.service.d.ts.map +1 -0
  36. package/dist/src/services/init/config.service.d.ts.map +1 -1
  37. package/dist/src/services/init/providers.service.d.ts.map +1 -1
  38. package/dist/src/services/service/detection.service.d.ts +2 -0
  39. package/dist/src/services/service/detection.service.d.ts.map +1 -0
  40. package/dist/src/services/service/service.service.d.ts +8 -0
  41. package/dist/src/services/service/service.service.d.ts.map +1 -0
  42. package/dist/src/services/slice/detection.service.d.ts +2 -0
  43. package/dist/src/services/slice/detection.service.d.ts.map +1 -0
  44. package/dist/src/services/slice/slice.service.d.ts +7 -0
  45. package/dist/src/services/slice/slice.service.d.ts.map +1 -0
  46. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.0](https://github.com/teispace/npm-packages/compare/next-maker-v0.3.0...next-maker-v0.4.0) (2025-12-02)
4
+
5
+
6
+ ### Features
7
+
8
+ * **next-maker:** add API endpoint registration for services and features ([8db4f36](https://github.com/teispace/npm-packages/commit/8db4f36a6037a63129b4a94c7905200668715ebc))
9
+
10
+ ## [0.3.0](https://github.com/teispace/npm-packages/compare/next-maker-v0.2.2...next-maker-v0.3.0) (2025-12-02)
11
+
12
+
13
+ ### Features
14
+
15
+ * **next-maker:** add custom path and fix feature generation ([33c2ca0](https://github.com/teispace/npm-packages/commit/33c2ca09b592fa4a1e6e0c6c606b63c5db3d451b))
16
+ * **next-maker:** implement feature generation command ([0127837](https://github.com/teispace/npm-packages/commit/0127837d97e849dfc7fe875c167604d0997d7093))
17
+ * **next-maker:** implement slice and service generation commands ([59a12e4](https://github.com/teispace/npm-packages/commit/59a12e4b80521ee5fbabb74a09508bd085cc52aa))
18
+ * **next-maker:** optimize prompts and add .env copy feature ([e2ecefe](https://github.com/teispace/npm-packages/commit/e2ecefe7139c335adf34131dee3cebe7ba9eebb2))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **next-maker:** add Counter component to page.tsx when Redux enabled and cleanup i18n/axios types ([87bc69d](https://github.com/teispace/npm-packages/commit/87bc69d96824353cfdfce1af9b6bcf1bda789ff6))
24
+ * **next-maker:** correct script execution for yarn/pnpm/bun ([e633a31](https://github.com/teispace/npm-packages/commit/e633a31237c5ac9450cb35da6dd6edc10e5f1ea5))
25
+ * **next-maker:** remove dark mode styles when dark theme is not selected ([3ad53e5](https://github.com/teispace/npm-packages/commit/3ad53e53de8faf04f7d769051908e7e10f391581))
26
+
3
27
  ## [0.2.2](https://github.com/teispace/npm-packages/compare/next-maker-v0.2.1...next-maker-v0.2.2) (2025-12-02)
4
28
 
5
29
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @teispace/next-maker
2
2
 
3
- A powerful CLI tool to scaffold Next.js applications and generate boilerplate code for features, Redux slices, and API services.
3
+ A powerful CLI tool to scaffold Next.js applications with modern best practices and generate feature-based architecture components including Redux slices and API services.
4
4
 
5
5
  ## Installation
6
6
 
@@ -19,22 +19,27 @@ next-maker <command> [name] [options]
19
19
 
20
20
  ## Commands
21
21
 
22
- ### 1. Create a New App (Default)
22
+ ### 1. Create a New App
23
23
 
24
- Generate a complete Next.js application with your preferred configuration.
24
+ Generate a complete Next.js application with production-ready configuration.
25
25
 
26
26
  ```bash
27
+ npx @teispace/next-maker app [project-name]
28
+ # or simply
27
29
  npx @teispace/next-maker [project-name]
28
- # or just
29
- npx @teispace/next-maker
30
30
  ```
31
31
 
32
- **Interactive prompts:**
32
+ **Features included:**
33
33
 
34
- - TypeScript configuration
35
- - Tailwind CSS setup
36
- - Redux Toolkit integration
37
- - i18n (internationalization) support
34
+ - Next.js 15+ with App Router
35
+ - 🔷 TypeScript (strict mode)
36
+ - 🎨 Tailwind CSS v4
37
+ - 🔄 Redux Toolkit with redux-persist
38
+ - 🌐 next-intl for internationalization
39
+ - 📡 AxiosClient & FetchClient (Result pattern)
40
+ - 🏗️ Feature-based DDD architecture
41
+ - 🎯 ESLint + Prettier configured
42
+ - 🐳 Docker support
38
43
 
39
44
  **Example:**
40
45
 
@@ -46,82 +51,309 @@ npx @teispace/next-maker my-awesome-app
46
51
 
47
52
  ### 2. Generate a Feature Module
48
53
 
49
- Create a feature module with components, hooks, and utilities.
54
+ Create a complete feature module following Domain-Driven Design principles.
50
55
 
51
56
  ```bash
52
- npx @teispace/next-maker feature user-dashboard
57
+ npx @teispace/next-maker feature <name> [options]
53
58
  ```
54
59
 
55
- **Interactive prompts:**
60
+ **Options:**
56
61
 
57
- - Include test files
58
- - Include Storybook stories
59
- - Include CSS module
62
+ - `--store <type>` - Generate Redux store (persist|no-persist)
63
+ - `--skip-store` - Skip Redux store generation
64
+ - `--service <client>` - Generate API service (axios|fetch)
65
+ - `--skip-service` - Skip API service generation
66
+ - `--path <path>` - Custom path (default: src/features)
60
67
 
61
68
  **Generated structure:**
62
69
 
63
70
  ```
64
71
  src/features/user-dashboard/
65
72
  ├── components/
73
+ │ └── UserDashboard.tsx
66
74
  ├── hooks/
67
- ├── utils/
68
- ├── __tests__/ (optional)
69
- ├── stories/ (optional)
75
+ │ └── useUserDashboard.ts
76
+ ├── types/
77
+ │ └── user-dashboard.types.ts
78
+ ├── store/ (optional)
79
+ │ ├── user-dashboard.slice.ts
80
+ │ ├── user-dashboard.selectors.ts
81
+ │ ├── persist.ts (optional)
82
+ │ └── index.ts
83
+ ├── services/ (optional)
84
+ │ └── user-dashboard.service.ts
70
85
  └── index.ts
71
86
  ```
72
87
 
88
+ **Examples:**
89
+
90
+ ```bash
91
+ # Full feature with Redux and API service
92
+ npx @teispace/next-maker feature user-profile --store persist --service axios
93
+
94
+ # Feature with Redux only (no persistence)
95
+ npx @teispace/next-maker feature shopping-cart --store no-persist --skip-service
96
+
97
+ # Feature in custom location
98
+ npx @teispace/next-maker feature auth --store persist --service fetch --path src/modules
99
+ ```
100
+
101
+ ---
102
+
103
+ ### 3. Generate a Redux Slice
104
+
105
+ Create a Redux Toolkit slice with persistence support.
106
+
107
+ ```bash
108
+ npx @teispace/next-maker slice <name> [options]
109
+ ```
110
+
111
+ **Options:**
112
+
113
+ - `--persist` - Enable redux-persist for this slice
114
+ - `--no-persist` - Disable persistence
115
+ - `--path <path>` - Custom path (default: create new feature)
116
+
117
+ **Generated structure:**
118
+
119
+ ```
120
+ src/features/auth/store/auth/
121
+ ├── auth.slice.ts
122
+ ├── auth.selectors.ts
123
+ ├── auth.types.ts
124
+ ├── persist.ts (optional)
125
+ └── index.ts
126
+ ```
127
+
128
+ **Auto-registers in rootReducer** with correct imports!
129
+
130
+ **Examples:**
131
+
132
+ ```bash
133
+ # Create new feature with slice
134
+ npx @teispace/next-maker slice auth --persist
135
+
136
+ # Add slice to existing feature
137
+ npx @teispace/next-maker slice user-settings --path features/auth/store
138
+
139
+ # Slice in custom location
140
+ npx @teispace/next-maker slice theme --no-persist --path src/store/slices
141
+ ```
142
+
143
+ ---
144
+
145
+ ### 4. Generate an API Service
146
+
147
+ Create an API service with HTTP client integration.
148
+
149
+ ```bash
150
+ npx @teispace/next-maker service <name> [options]
151
+ ```
152
+
153
+ **Options:**
154
+
155
+ - `--axios` - Use AxiosClient
156
+ - `--fetch` - Use FetchClient
157
+ - `--path <path>` - Custom path (default: create new feature)
158
+
159
+ **Generated structure:**
160
+
161
+ ```
162
+ src/features/payment/services/
163
+ └── payment.service.ts
164
+ ```
165
+
166
+ **Validates HTTP client setup** before generation!
167
+
168
+ **Examples:**
169
+
170
+ ```bash
171
+ # Create new feature with service
172
+ npx @teispace/next-maker service payment --axios
173
+
174
+ # Add service to existing feature
175
+ npx @teispace/next-maker service user --fetch --path features/auth/services
176
+
177
+ # Service in custom location
178
+ npx @teispace/next-maker service analytics --axios --path src/api/services
179
+ ```
180
+
73
181
  ---
74
182
 
75
183
  ## Usage Examples
76
184
 
77
- ### Create a new app with all features
185
+ ### Quick Start - New Project
78
186
 
79
187
  ```bash
188
+ # Create a new Next.js app
80
189
  npx @teispace/next-maker my-project
81
- # Follow the interactive prompts
190
+
191
+ # Navigate to the project
192
+ cd my-project
193
+
194
+ # Generate your first feature
195
+ npx @teispace/next-maker feature auth --store persist --service axios
196
+
197
+ # Start development server
198
+ npm run dev
82
199
  ```
83
200
 
84
- ### Generate a feature
201
+ ### Feature-Based Development
85
202
 
86
203
  ```bash
87
- # Create a feature
88
- npx @teispace/next-maker feature user-profile
204
+ # E-commerce example
205
+ npx @teispace/next-maker feature products --store persist --service axios
206
+ npx @teispace/next-maker feature cart --store persist --skip-service
207
+ npx @teispace/next-maker slice checkout --path features/cart/store
208
+ npx @teispace/next-maker service orders --axios --path features/products/services
209
+
210
+ # Dashboard example
211
+ npx @teispace/next-maker feature dashboard --store no-persist --service fetch
212
+ npx @teispace/next-maker slice analytics --path features/dashboard/store
213
+ npx @teispace/next-maker service metrics --fetch --path features/dashboard/services
89
214
  ```
90
215
 
91
- ### Get help
216
+ ### Get Help
92
217
 
93
218
  ```bash
94
219
  # General help
95
220
  npx @teispace/next-maker --help
96
221
 
97
- # Feature command help
222
+ # Command-specific help
98
223
  npx @teispace/next-maker feature --help
224
+ npx @teispace/next-maker slice --help
225
+ npx @teispace/next-maker service --help
99
226
  ```
100
227
 
101
228
  ---
102
229
 
103
- ## Command-Line Arguments
230
+ ## Key Features
231
+
232
+ ### 🏗️ Feature-First Architecture
233
+
234
+ All generators follow a feature-based DDD approach by default, organizing code by business domain rather than technical layers.
235
+
236
+ ### 🔄 Smart Redux Integration
237
+
238
+ - Auto-registers slices in `rootReducer`
239
+ - Correct import paths for any custom location
240
+ - Optional redux-persist configuration
241
+ - Demo actions included (setLoading, setError, resetState)
242
+
243
+ ### 📡 HTTP Client Support
244
+
245
+ - **AxiosClient**: Result-based error handling with `isOk()/isErr()`
246
+ - **FetchClient**: Same Result pattern with native fetch
247
+ - Auto-detects available clients
248
+ - Type-safe API calls with generics
249
+
250
+ ### 🎯 Intelligent Path Handling
251
+
252
+ All commands support `--path` for custom locations:
253
+
254
+ - Relative: `features/auth` → `src/features/auth`
255
+ - Absolute: `src/modules/auth` → `src/modules/auth`
256
+ - Auto-creates directory structure
257
+ - Adapts imports based on location
258
+
259
+ ### ✅ Built-in Validations
260
+
261
+ - Checks for required dependencies (Redux, HTTP clients)
262
+ - Prevents duplicate generation
263
+ - Validates naming conventions (kebab-case)
264
+ - Ensures consistent project structure
265
+
266
+ ---
267
+
268
+ ## Command Reference
269
+
270
+ ### Common Options
104
271
 
105
- All commands support the following pattern:
272
+ All commands support:
273
+
274
+ - `[name]` - Resource name (kebab-case, prompted if omitted)
275
+ - `--path <path>` - Custom generation path
276
+ - `--help` - Show command help
277
+
278
+ ### Feature Options
106
279
 
107
280
  ```bash
108
- next-maker <command> [name] [options]
281
+ --store <persist|no-persist> # Generate Redux store
282
+ --skip-store # Don't generate store
283
+ --service <axios|fetch> # Generate API service
284
+ --skip-service # Don't generate service
285
+ ```
286
+
287
+ ### Slice Options
288
+
289
+ ```bash
290
+ --persist # Enable redux-persist
291
+ --no-persist # Disable persistence
292
+ ```
293
+
294
+ ### Service Options
295
+
296
+ ```bash
297
+ --axios # Use AxiosClient
298
+ --fetch # Use FetchClient
109
299
  ```
110
300
 
111
- - `<command>`: Required. One of: `app`, `feature`, `slice`, `service`
112
- - `[name]`: Optional. The name of what you're creating (will prompt if not provided)
113
- - `[options]`: Optional flags like `--help`
301
+ ---
302
+
303
+ ## Project Structure
304
+
305
+ Generated apps follow this structure:
306
+
307
+ ```
308
+ my-project/
309
+ ├── src/
310
+ │ ├── app/ # Next.js App Router
311
+ │ ├── features/ # Feature modules (DDD)
312
+ │ │ └── counter/
313
+ │ │ ├── components/
314
+ │ │ ├── hooks/
315
+ │ │ ├── store/
316
+ │ │ ├── types/
317
+ │ │ └── index.ts
318
+ │ ├── components/ # Shared components
319
+ │ ├── lib/
320
+ │ │ ├── config/ # App configuration
321
+ │ │ ├── utils/
322
+ │ │ │ └── http/ # AxiosClient & FetchClient
323
+ │ │ ├── errors/ # Error classes
324
+ │ │ └── validations/ # Validation schemas
325
+ │ ├── providers/ # React providers
326
+ │ ├── store/ # Redux store setup
327
+ │ ├── services/ # Global services
328
+ │ ├── i18n/ # Internationalization
329
+ │ └── styles/ # Global styles
330
+ ├── public/ # Static assets
331
+ ├── .husky/ # Git hooks
332
+ ├── Dockerfile
333
+ ├── docker-compose.yml
334
+ └── package.json
335
+ ```
114
336
 
115
337
  ---
116
338
 
117
- ## Features
339
+ ## Tech Stack
340
+
341
+ **CLI:**
342
+
343
+ - TypeScript - Type-safe development
344
+ - esbuild - Fast bundling
345
+ - Commander.js - CLI framework
346
+ - Enquirer - Interactive prompts
347
+
348
+ **Generated Apps:**
118
349
 
119
- **Interactive Prompts** - Guided setup with sensible defaults
120
- 🎨 **Multiple Generators** - App, features, slices, and services
121
- 📦 **Modern Stack** - Next.js, TypeScript, Redux Toolkit, Tailwind CSS
122
- 🧪 **Test-Ready** - Optional test file generation
123
- 📚 **Well-Structured** - Follows best practices and conventions
124
- 🚀 **Fast Setup** - Get started in seconds
350
+ - Next.js 15+ - React framework
351
+ - TypeScript - Static typing
352
+ - Redux Toolkit - State management
353
+ - Tailwind CSS v4 - Styling
354
+ - next-intl - Internationalization
355
+ - Axios - HTTP client
356
+ - ESLint + Prettier - Code quality
125
357
 
126
358
  ---
127
359
 
@@ -131,42 +363,43 @@ next-maker <command> [name] [options]
131
363
 
132
364
  ```bash
133
365
  git clone <repository-url>
134
- cd next-maker
135
- npm install
366
+ cd npm-packages/packages/next-maker
367
+ yarn install
136
368
  ```
137
369
 
138
370
  ### Build
139
371
 
140
372
  ```bash
141
- npm run build
373
+ yarn build
142
374
  ```
143
375
 
144
376
  ### Test Locally
145
377
 
146
378
  ```bash
147
- npx .
379
+ # Test app generation
380
+ node dist/index.js app test-project
381
+
382
+ # Test feature generation
383
+ cd test-project
384
+ node ../dist/index.js feature auth --store persist --service axios
385
+
386
+ # Test slice generation
387
+ node ../dist/index.js slice user-profile --persist
388
+
389
+ # Test service generation
390
+ node ../dist/index.js service payment --axios
148
391
  ```
149
392
 
150
393
  ### Link for Global Testing
151
394
 
152
395
  ```bash
153
396
  npm link
154
- next-maker app test-project
397
+ next-maker feature my-feature
155
398
  npm unlink -g
156
399
  ```
157
400
 
158
401
  ---
159
402
 
160
- ## Tech Stack
161
-
162
- - **TypeScript** - Type-safe development
163
- - **esbuild** - Fast bundling
164
- - **Commander.js** - Professional CLI framework
165
- - **enquirer** - Interactive prompts
166
- - **Node.js** - Runtime environment
167
-
168
- ---
169
-
170
403
  ## License
171
404
 
172
405
  MIT
@@ -177,8 +410,14 @@ MIT
177
410
 
178
411
  Contributions are welcome! Please feel free to submit a Pull Request.
179
412
 
413
+ 1. Fork the repository
414
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
415
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
416
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
417
+ 5. Open a Pull Request
418
+
180
419
  ---
181
420
 
182
421
  ## Support
183
422
 
184
- For issues and questions, please visit our [GitHub Issues](https://github.com/teispace/nextjs-starter/issues).
423
+ For issues and questions, please visit our [GitHub Issues](https://github.com/teispace/npm-packages/issues).