@teispace/next-maker 1.11.1 → 1.13.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.
- package/CHANGELOG.md +27 -0
- package/README.md +222 -271
- package/dist/index.js +353 -225
- package/dist/index.js.map +4 -4
- package/dist/src/commands/component.d.ts +3 -0
- package/dist/src/commands/component.d.ts.map +1 -0
- package/dist/src/commands/feature.d.ts.map +1 -1
- package/dist/src/commands/hook.d.ts +3 -0
- package/dist/src/commands/hook.d.ts.map +1 -0
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/locale.d.ts +3 -0
- package/dist/src/commands/locale.d.ts.map +1 -0
- package/dist/src/commands/page.d.ts +3 -0
- package/dist/src/commands/page.d.ts.map +1 -0
- package/dist/src/commands/service.d.ts.map +1 -1
- package/dist/src/commands/slice.d.ts.map +1 -1
- package/dist/src/config/paths.d.ts +4 -0
- package/dist/src/config/paths.d.ts.map +1 -1
- package/dist/src/detection/existence.checker.d.ts +9 -0
- package/dist/src/detection/existence.checker.d.ts.map +1 -0
- package/dist/src/detection/index.d.ts +4 -0
- package/dist/src/detection/index.d.ts.map +1 -0
- package/dist/src/{services/feature/detection.service.d.ts → detection/project.detector.d.ts} +1 -2
- package/dist/src/detection/project.detector.d.ts.map +1 -0
- package/dist/src/generators/component.generator.d.ts +9 -0
- package/dist/src/generators/component.generator.d.ts.map +1 -0
- package/dist/src/generators/crud-service.generator.d.ts +6 -0
- package/dist/src/generators/crud-service.generator.d.ts.map +1 -0
- package/dist/src/generators/feature.generator.d.ts +7 -0
- package/dist/src/generators/feature.generator.d.ts.map +1 -0
- package/dist/src/generators/hook.generator.d.ts +8 -0
- package/dist/src/generators/hook.generator.d.ts.map +1 -0
- package/dist/src/generators/index.d.ts +14 -0
- package/dist/src/generators/index.d.ts.map +1 -0
- package/dist/src/generators/locale.generator.d.ts +10 -0
- package/dist/src/generators/locale.generator.d.ts.map +1 -0
- package/dist/src/generators/page.generator.d.ts +10 -0
- package/dist/src/generators/page.generator.d.ts.map +1 -0
- package/dist/src/generators/service.generator.d.ts +6 -0
- package/dist/src/generators/service.generator.d.ts.map +1 -0
- package/dist/src/generators/slice.generator.d.ts +11 -0
- package/dist/src/generators/slice.generator.d.ts.map +1 -0
- package/dist/src/generators/templates/barrel.template.d.ts +12 -0
- package/dist/src/generators/templates/barrel.template.d.ts.map +1 -0
- package/dist/src/generators/templates/component.template.d.ts +5 -0
- package/dist/src/generators/templates/component.template.d.ts.map +1 -0
- package/dist/src/generators/templates/crud-service.template.d.ts +10 -0
- package/dist/src/generators/templates/crud-service.template.d.ts.map +1 -0
- package/dist/src/generators/templates/custom-hook.template.d.ts +5 -0
- package/dist/src/generators/templates/custom-hook.template.d.ts.map +1 -0
- package/dist/src/generators/templates/hook.template.d.ts +9 -0
- package/dist/src/generators/templates/hook.template.d.ts.map +1 -0
- package/dist/src/generators/templates/page.template.d.ts +18 -0
- package/dist/src/generators/templates/page.template.d.ts.map +1 -0
- package/dist/src/generators/templates/persist.template.d.ts +6 -0
- package/dist/src/generators/templates/persist.template.d.ts.map +1 -0
- package/dist/src/generators/templates/selectors.template.d.ts +6 -0
- package/dist/src/generators/templates/selectors.template.d.ts.map +1 -0
- package/dist/src/generators/templates/service.template.d.ts +5 -0
- package/dist/src/generators/templates/service.template.d.ts.map +1 -0
- package/dist/src/generators/templates/shared-component.template.d.ts +10 -0
- package/dist/src/generators/templates/shared-component.template.d.ts.map +1 -0
- package/dist/src/generators/templates/slice.template.d.ts +6 -0
- package/dist/src/generators/templates/slice.template.d.ts.map +1 -0
- package/dist/src/generators/templates/types.template.d.ts +5 -0
- package/dist/src/generators/templates/types.template.d.ts.map +1 -0
- package/dist/src/generators/types.d.ts +19 -0
- package/dist/src/generators/types.d.ts.map +1 -0
- package/dist/src/modifiers/api-registration.modifier.d.ts +6 -0
- package/dist/src/modifiers/api-registration.modifier.d.ts.map +1 -0
- package/dist/src/modifiers/app-paths.modifier.d.ts +5 -0
- package/dist/src/modifiers/app-paths.modifier.d.ts.map +1 -0
- package/dist/src/modifiers/crud-api-registration.modifier.d.ts +5 -0
- package/dist/src/modifiers/crud-api-registration.modifier.d.ts.map +1 -0
- package/dist/src/modifiers/helpers.d.ts +14 -0
- package/dist/src/modifiers/helpers.d.ts.map +1 -0
- package/dist/src/modifiers/index.d.ts +7 -0
- package/dist/src/modifiers/index.d.ts.map +1 -0
- package/dist/src/modifiers/root-reducer.modifier.d.ts +7 -0
- package/dist/src/modifiers/root-reducer.modifier.d.ts.map +1 -0
- package/dist/src/modifiers/translation.modifier.d.ts +5 -0
- package/dist/src/modifiers/translation.modifier.d.ts.map +1 -0
- package/dist/src/modifiers/types.d.ts +15 -0
- package/dist/src/modifiers/types.d.ts.map +1 -0
- package/dist/src/pipelines/feature.pipeline.d.ts +14 -0
- package/dist/src/pipelines/feature.pipeline.d.ts.map +1 -0
- package/dist/src/pipelines/index.d.ts +9 -0
- package/dist/src/pipelines/index.d.ts.map +1 -0
- package/dist/src/pipelines/runner.d.ts +7 -0
- package/dist/src/pipelines/runner.d.ts.map +1 -0
- package/dist/src/pipelines/service.pipeline.d.ts +8 -0
- package/dist/src/pipelines/service.pipeline.d.ts.map +1 -0
- package/dist/src/pipelines/slice.pipeline.d.ts +9 -0
- package/dist/src/pipelines/slice.pipeline.d.ts.map +1 -0
- package/dist/src/pipelines/types.d.ts +12 -0
- package/dist/src/pipelines/types.d.ts.map +1 -0
- package/dist/src/prompts/component.prompt.d.ts +6 -0
- package/dist/src/prompts/component.prompt.d.ts.map +1 -0
- package/dist/src/prompts/hook.prompt.d.ts +5 -0
- package/dist/src/prompts/hook.prompt.d.ts.map +1 -0
- package/dist/src/prompts/locale.prompt.d.ts +9 -0
- package/dist/src/prompts/locale.prompt.d.ts.map +1 -0
- package/dist/src/prompts/page.prompt.d.ts +7 -0
- package/dist/src/prompts/page.prompt.d.ts.map +1 -0
- package/dist/src/services/init/cleanup/dark-mode.cleanup.d.ts +3 -0
- package/dist/src/services/init/cleanup/dark-mode.cleanup.d.ts.map +1 -0
- package/dist/src/services/init/cleanup/http.cleanup.d.ts +3 -0
- package/dist/src/services/init/cleanup/http.cleanup.d.ts.map +1 -0
- package/dist/src/services/init/cleanup/i18n.cleanup.d.ts +3 -0
- package/dist/src/services/init/cleanup/i18n.cleanup.d.ts.map +1 -0
- package/dist/src/services/init/cleanup/index.d.ts +3 -0
- package/dist/src/services/init/cleanup/index.d.ts.map +1 -0
- package/dist/src/services/init/cleanup/misc.cleanup.d.ts +13 -0
- package/dist/src/services/init/cleanup/misc.cleanup.d.ts.map +1 -0
- package/dist/src/services/init/cleanup/redux.cleanup.d.ts +3 -0
- package/dist/src/services/init/cleanup/redux.cleanup.d.ts.map +1 -0
- package/package.json +9 -7
- package/dist/src/services/common/api-registration.service.d.ts +0 -7
- package/dist/src/services/common/api-registration.service.d.ts.map +0 -1
- package/dist/src/services/feature/detection.service.d.ts.map +0 -1
- package/dist/src/services/feature/registration.service.d.ts +0 -6
- package/dist/src/services/feature/registration.service.d.ts.map +0 -1
- package/dist/src/services/feature/templates.service.d.ts +0 -11
- package/dist/src/services/feature/templates.service.d.ts.map +0 -1
- package/dist/src/services/init/cleanup.service.d.ts +0 -3
- package/dist/src/services/init/cleanup.service.d.ts.map +0 -1
- package/dist/src/services/service/detection.service.d.ts +0 -2
- package/dist/src/services/service/detection.service.d.ts.map +0 -1
- package/dist/src/services/service/service.service.d.ts +0 -8
- package/dist/src/services/service/service.service.d.ts.map +0 -1
- package/dist/src/services/slice/detection.service.d.ts +0 -2
- package/dist/src/services/slice/detection.service.d.ts.map +0 -1
- package/dist/src/services/slice/slice.service.d.ts +0 -7
- package/dist/src/services/slice/slice.service.d.ts.map +0 -1
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 with modern best practices and generate feature-based architecture components including Redux slices
|
|
3
|
+
A powerful CLI tool to scaffold Next.js applications with modern best practices and generate feature-based architecture components including pages, components, Redux slices, API services, and locales.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -31,31 +31,25 @@ npx @teispace/next-maker init [project-name]
|
|
|
31
31
|
|
|
32
32
|
During initialization, you'll be prompted to configure:
|
|
33
33
|
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
34
|
+
- **Package Manager** (npm, yarn, pnpm, bun)
|
|
35
|
+
- **GitHub Repository** (optional - configures remote origin)
|
|
36
|
+
- **HTTP Client** (axios, fetch, both, or none)
|
|
37
|
+
- **Dark Mode** (next-themes integration)
|
|
38
|
+
- **Redux Toolkit** (with redux-persist)
|
|
39
|
+
- **Internationalization** (next-intl)
|
|
40
|
+
- **Community Files** (CODE_OF_CONDUCT, CONTRIBUTING, etc.)
|
|
41
|
+
- **Docker** support
|
|
42
|
+
- **CI/CD** configuration
|
|
43
|
+
- **Pre-commit hooks** (Husky)
|
|
44
44
|
|
|
45
45
|
**Core Features:**
|
|
46
46
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
**Example:**
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npx @teispace/next-maker init my-awesome-app
|
|
58
|
-
```
|
|
47
|
+
- Next.js 16+ with App Router
|
|
48
|
+
- TypeScript (strict mode)
|
|
49
|
+
- Tailwind CSS v4
|
|
50
|
+
- Result-based HTTP clients
|
|
51
|
+
- Feature-based DDD architecture
|
|
52
|
+
- ESLint + Prettier configured
|
|
59
53
|
|
|
60
54
|
---
|
|
61
55
|
|
|
@@ -74,73 +68,97 @@ npx @teispace/next-maker setup [options]
|
|
|
74
68
|
- `--redux` - Setup Redux Toolkit with persistence
|
|
75
69
|
- `--i18n` - Setup next-intl for internationalization
|
|
76
70
|
|
|
77
|
-
**Features:**
|
|
78
|
-
|
|
79
|
-
Each setup command:
|
|
80
|
-
|
|
81
|
-
- ✅ Checks if already configured (exits gracefully)
|
|
82
|
-
- 📁 Copies necessary files from template
|
|
83
|
-
- 🔧 Updates configuration files
|
|
84
|
-
- 📦 Installs required packages
|
|
85
|
-
- 🔗 Integrates with existing providers
|
|
86
|
-
|
|
87
71
|
**Examples:**
|
|
88
72
|
|
|
89
73
|
```bash
|
|
90
74
|
# Interactive menu
|
|
91
75
|
npx @teispace/next-maker setup
|
|
92
76
|
|
|
93
|
-
# Add
|
|
77
|
+
# Add specific features
|
|
94
78
|
npx @teispace/next-maker setup --http-client
|
|
95
|
-
|
|
96
|
-
# Add dark mode
|
|
97
79
|
npx @teispace/next-maker setup --dark-theme
|
|
98
|
-
|
|
99
|
-
# Add Redux
|
|
100
80
|
npx @teispace/next-maker setup --redux
|
|
101
|
-
|
|
102
|
-
# Add internationalization
|
|
103
81
|
npx @teispace/next-maker setup --i18n
|
|
104
82
|
```
|
|
105
83
|
|
|
106
|
-
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### 3. Generate a Page
|
|
87
|
+
|
|
88
|
+
Create a new page/route with locale-aware boilerplate, SEO metadata, and optional loading/error states.
|
|
107
89
|
|
|
108
|
-
|
|
90
|
+
```bash
|
|
91
|
+
npx @teispace/next-maker page <name> [options]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Options:**
|
|
109
95
|
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
96
|
+
- `--dynamic <param>` - Create dynamic route (e.g., `--dynamic id` creates `[id]/page.tsx`)
|
|
97
|
+
- `--loading` - Generate `loading.tsx`
|
|
98
|
+
- `--error` - Generate `error.tsx`
|
|
113
99
|
|
|
114
|
-
**
|
|
100
|
+
**What it generates:**
|
|
115
101
|
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
- Adds
|
|
119
|
-
-
|
|
120
|
-
- Integrates with RootProvider
|
|
121
|
-
- Installs next-themes package
|
|
102
|
+
- `page.tsx` with full locale support (if i18n is set up), `generateMetadata`, `setRequestLocale`
|
|
103
|
+
- Registers route in `src/lib/config/app-paths.ts`
|
|
104
|
+
- Adds translation namespace to `en.json` (if i18n)
|
|
105
|
+
- Optional `loading.tsx` and `error.tsx`
|
|
122
106
|
|
|
123
|
-
**
|
|
107
|
+
**Examples:**
|
|
124
108
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
- Integrates with RootProvider
|
|
129
|
-
- Installs @reduxjs/toolkit, react-redux, redux-persist
|
|
109
|
+
```bash
|
|
110
|
+
# Simple page
|
|
111
|
+
npx @teispace/next-maker page about
|
|
130
112
|
|
|
131
|
-
|
|
113
|
+
# Page with loading and error states
|
|
114
|
+
npx @teispace/next-maker page dashboard --loading --error
|
|
132
115
|
|
|
133
|
-
|
|
134
|
-
-
|
|
135
|
-
|
|
136
|
-
- Updates `next.config.ts` with createNextIntlPlugin
|
|
137
|
-
- Updates RootProvider with NextIntlClientProvider
|
|
138
|
-
- Creates `[locale]` route structure
|
|
139
|
-
- Installs next-intl package
|
|
116
|
+
# Dynamic route (e.g., /products/[id])
|
|
117
|
+
npx @teispace/next-maker page products --dynamic id --loading --error
|
|
118
|
+
```
|
|
140
119
|
|
|
141
120
|
---
|
|
142
121
|
|
|
143
|
-
###
|
|
122
|
+
### 4. Generate a Component
|
|
123
|
+
|
|
124
|
+
Create a shared component with automatic barrel export wiring across all index files.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npx @teispace/next-maker component <name> [options]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Options:**
|
|
131
|
+
|
|
132
|
+
- `--client` - Add `'use client'` directive
|
|
133
|
+
- `--i18n` - Add `useTranslations` hook
|
|
134
|
+
- `--feature <path>` - Generate inside a feature directory
|
|
135
|
+
|
|
136
|
+
**Generated structure (shared):**
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
src/components/common/MyButton/
|
|
140
|
+
├── MyButton.tsx
|
|
141
|
+
└── index.ts
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Auto-updates `src/components/common/index.ts` and `src/components/index.ts`.
|
|
145
|
+
|
|
146
|
+
**Examples:**
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Shared component
|
|
150
|
+
npx @teispace/next-maker component data-table --client
|
|
151
|
+
|
|
152
|
+
# Component with i18n
|
|
153
|
+
npx @teispace/next-maker component nav-bar --client --i18n
|
|
154
|
+
|
|
155
|
+
# Feature-specific component
|
|
156
|
+
npx @teispace/next-maker component user-card --client --feature src/features/auth
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### 5. Generate a Feature Module
|
|
144
162
|
|
|
145
163
|
Create a complete feature module following Domain-Driven Design principles.
|
|
146
164
|
|
|
@@ -182,7 +200,7 @@ src/features/user-dashboard/
|
|
|
182
200
|
# Full feature with Redux and API service
|
|
183
201
|
npx @teispace/next-maker feature user-profile --store persist --service axios
|
|
184
202
|
|
|
185
|
-
# Feature with Redux only
|
|
203
|
+
# Feature with Redux only
|
|
186
204
|
npx @teispace/next-maker feature shopping-cart --store no-persist --skip-service
|
|
187
205
|
|
|
188
206
|
# Feature in custom location
|
|
@@ -191,7 +209,7 @@ npx @teispace/next-maker feature auth --store persist --service fetch --path src
|
|
|
191
209
|
|
|
192
210
|
---
|
|
193
211
|
|
|
194
|
-
###
|
|
212
|
+
### 6. Generate a Redux Slice
|
|
195
213
|
|
|
196
214
|
Create a Redux Toolkit slice with persistence support.
|
|
197
215
|
|
|
@@ -205,18 +223,7 @@ npx @teispace/next-maker slice <name> [options]
|
|
|
205
223
|
- `--no-persist` - Disable persistence
|
|
206
224
|
- `--path <path>` - Custom path (default: create new feature)
|
|
207
225
|
|
|
208
|
-
**
|
|
209
|
-
|
|
210
|
-
```
|
|
211
|
-
src/features/auth/store/auth/
|
|
212
|
-
├── auth.slice.ts
|
|
213
|
-
├── auth.selectors.ts
|
|
214
|
-
├── auth.types.ts
|
|
215
|
-
├── persist.ts (optional)
|
|
216
|
-
└── index.ts
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
**Auto-registers in rootReducer** with correct imports!
|
|
226
|
+
**Auto-registers in rootReducer** with correct imports.
|
|
220
227
|
|
|
221
228
|
**Examples:**
|
|
222
229
|
|
|
@@ -226,16 +233,13 @@ npx @teispace/next-maker slice auth --persist
|
|
|
226
233
|
|
|
227
234
|
# Add slice to existing feature
|
|
228
235
|
npx @teispace/next-maker slice user-settings --path features/auth/store
|
|
229
|
-
|
|
230
|
-
# Slice in custom location
|
|
231
|
-
npx @teispace/next-maker slice theme --no-persist --path src/store/slices
|
|
232
236
|
```
|
|
233
237
|
|
|
234
238
|
---
|
|
235
239
|
|
|
236
|
-
###
|
|
240
|
+
### 7. Generate an API Service
|
|
237
241
|
|
|
238
|
-
Create an API service with HTTP client integration.
|
|
242
|
+
Create an API service with HTTP client integration. Supports both simple and full CRUD generation.
|
|
239
243
|
|
|
240
244
|
```bash
|
|
241
245
|
npx @teispace/next-maker service <name> [options]
|
|
@@ -245,219 +249,191 @@ npx @teispace/next-maker service <name> [options]
|
|
|
245
249
|
|
|
246
250
|
- `--axios` - Use AxiosClient
|
|
247
251
|
- `--fetch` - Use FetchClient
|
|
252
|
+
- `--crud` - Generate full CRUD service (getAll, getById, create, update, delete)
|
|
248
253
|
- `--path <path>` - Custom path (default: create new feature)
|
|
249
254
|
|
|
250
|
-
**
|
|
255
|
+
**CRUD mode** generates:
|
|
251
256
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
**Validates HTTP client setup** before generation!
|
|
257
|
+
- Service with 5 methods: `getAll`, `getById`, `create`, `update`, `delete`
|
|
258
|
+
- `<Name>Summary` type for list responses (cards, tables) and `<Name>Detail` type for single-item responses (detail pages)
|
|
259
|
+
- DTO types: `Create<Name>Dto`, `Update<Name>Dto`
|
|
260
|
+
- Full API config with dynamic routes (`getById(id)`, `update(id)`, `delete(id)`)
|
|
258
261
|
|
|
259
262
|
**Examples:**
|
|
260
263
|
|
|
261
264
|
```bash
|
|
262
|
-
#
|
|
265
|
+
# Simple service
|
|
263
266
|
npx @teispace/next-maker service payment --axios
|
|
264
267
|
|
|
265
|
-
#
|
|
266
|
-
npx @teispace/next-maker service
|
|
268
|
+
# Full CRUD service with types and endpoints
|
|
269
|
+
npx @teispace/next-maker service users --fetch --crud
|
|
267
270
|
|
|
268
|
-
#
|
|
269
|
-
npx @teispace/next-maker service
|
|
271
|
+
# CRUD service in existing feature
|
|
272
|
+
npx @teispace/next-maker service orders --axios --crud --path features/products/services
|
|
270
273
|
```
|
|
271
274
|
|
|
272
275
|
---
|
|
273
276
|
|
|
274
|
-
|
|
277
|
+
### 8. Add a Locale
|
|
275
278
|
|
|
276
|
-
|
|
279
|
+
Add a new language/locale to your internationalized project.
|
|
277
280
|
|
|
278
281
|
```bash
|
|
279
|
-
|
|
280
|
-
|
|
282
|
+
npx @teispace/next-maker locale [code] [options]
|
|
283
|
+
```
|
|
281
284
|
|
|
282
|
-
|
|
283
|
-
cd my-project
|
|
285
|
+
**Options:**
|
|
284
286
|
|
|
285
|
-
|
|
286
|
-
npx @teispace/next-maker feature auth --store persist --service axios
|
|
287
|
+
- `--copy-translations` - Copy English translations instead of empty values
|
|
287
288
|
|
|
288
|
-
|
|
289
|
-
npm run dev
|
|
290
|
-
```
|
|
289
|
+
**What it does:**
|
|
291
290
|
|
|
292
|
-
|
|
291
|
+
- Creates `src/i18n/translations/<code>.json` (empty or copied from English)
|
|
292
|
+
- Updates `SupportedLocale` type in `src/types/i18n.ts`
|
|
293
|
+
- Adds entry to `src/lib/config/app-locales.ts` with name, flag, country
|
|
293
294
|
|
|
294
|
-
|
|
295
|
-
# Add features to existing Next.js project
|
|
295
|
+
**Examples:**
|
|
296
296
|
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
```bash
|
|
298
|
+
# Add Spanish (interactive prompts for name, country, flag)
|
|
299
|
+
npx @teispace/next-maker locale es
|
|
299
300
|
|
|
300
|
-
# Add
|
|
301
|
-
npx @teispace/next-maker
|
|
301
|
+
# Add French with English translations as starting point
|
|
302
|
+
npx @teispace/next-maker locale fr --copy-translations
|
|
303
|
+
```
|
|
302
304
|
|
|
303
|
-
|
|
304
|
-
npx @teispace/next-maker setup --redux
|
|
305
|
+
---
|
|
305
306
|
|
|
306
|
-
|
|
307
|
-
npx @teispace/next-maker setup --i18n
|
|
308
|
-
```
|
|
307
|
+
### 9. Generate a Hook
|
|
309
308
|
|
|
310
|
-
|
|
309
|
+
Create a custom React hook with loading/error state boilerplate.
|
|
311
310
|
|
|
312
311
|
```bash
|
|
313
|
-
|
|
314
|
-
npx @teispace/next-maker feature products --store persist --service axios
|
|
315
|
-
npx @teispace/next-maker feature cart --store persist --skip-service
|
|
316
|
-
npx @teispace/next-maker slice checkout --path features/cart/store
|
|
317
|
-
npx @teispace/next-maker service orders --axios --path features/products/services
|
|
318
|
-
|
|
319
|
-
# Dashboard example
|
|
320
|
-
npx @teispace/next-maker feature dashboard --store no-persist --service fetch
|
|
321
|
-
npx @teispace/next-maker slice analytics --path features/dashboard/store
|
|
322
|
-
npx @teispace/next-maker service metrics --fetch --path features/dashboard/services
|
|
312
|
+
npx @teispace/next-maker hook <name> [options]
|
|
323
313
|
```
|
|
324
314
|
|
|
325
|
-
|
|
315
|
+
**Options:**
|
|
316
|
+
|
|
317
|
+
- `--client` - Add `'use client'` directive (default: true)
|
|
318
|
+
- `--feature <path>` - Generate in feature directory
|
|
319
|
+
|
|
320
|
+
**Examples:**
|
|
326
321
|
|
|
327
322
|
```bash
|
|
328
|
-
#
|
|
329
|
-
npx @teispace/next-maker
|
|
323
|
+
# Shared hook in src/hooks/
|
|
324
|
+
npx @teispace/next-maker hook auth-session
|
|
330
325
|
|
|
331
|
-
#
|
|
332
|
-
npx @teispace/next-maker
|
|
333
|
-
npx @teispace/next-maker setup --help
|
|
334
|
-
npx @teispace/next-maker feature --help
|
|
335
|
-
npx @teispace/next-maker slice --help
|
|
336
|
-
npx @teispace/next-maker service --help
|
|
326
|
+
# Hook inside a feature
|
|
327
|
+
npx @teispace/next-maker hook user-profile --feature src/features/auth
|
|
337
328
|
```
|
|
338
329
|
|
|
339
330
|
---
|
|
340
331
|
|
|
341
|
-
##
|
|
332
|
+
## Usage Examples
|
|
342
333
|
|
|
343
|
-
###
|
|
334
|
+
### Quick Start - New Project
|
|
344
335
|
|
|
345
|
-
|
|
336
|
+
```bash
|
|
337
|
+
# Create a new Next.js app with interactive setup
|
|
338
|
+
npx @teispace/next-maker init my-project
|
|
339
|
+
cd my-project
|
|
346
340
|
|
|
347
|
-
|
|
348
|
-
-
|
|
349
|
-
-
|
|
350
|
-
- Internationalization with routing and middleware
|
|
351
|
-
- Smart detection prevents duplicate setups
|
|
352
|
-
- Automatic package installation
|
|
341
|
+
# Generate pages
|
|
342
|
+
npx @teispace/next-maker page dashboard --loading --error
|
|
343
|
+
npx @teispace/next-maker page settings --loading
|
|
353
344
|
|
|
354
|
-
|
|
345
|
+
# Generate features with CRUD
|
|
346
|
+
npx @teispace/next-maker feature users --store persist --service fetch
|
|
347
|
+
npx @teispace/next-maker service users --fetch --crud --path features/users/services
|
|
355
348
|
|
|
356
|
-
|
|
349
|
+
# Add a locale
|
|
350
|
+
npx @teispace/next-maker locale es
|
|
357
351
|
|
|
358
|
-
|
|
352
|
+
# Start development
|
|
353
|
+
npm run dev
|
|
354
|
+
```
|
|
359
355
|
|
|
360
|
-
|
|
361
|
-
- Correct import paths for any custom location
|
|
362
|
-
- Optional redux-persist configuration
|
|
363
|
-
- Demo actions included (setLoading, setError, resetState)
|
|
364
|
-
- Can be added post-initialization via `setup --redux`
|
|
356
|
+
### Feature-Based Development
|
|
365
357
|
|
|
366
|
-
|
|
358
|
+
```bash
|
|
359
|
+
# E-commerce example
|
|
360
|
+
npx @teispace/next-maker feature products --store persist --service axios
|
|
361
|
+
npx @teispace/next-maker service products --axios --crud --path features/products/services
|
|
362
|
+
npx @teispace/next-maker page products --dynamic id --loading --error
|
|
363
|
+
npx @teispace/next-maker component product-card --client --feature src/features/products
|
|
367
364
|
|
|
368
|
-
-
|
|
369
|
-
-
|
|
370
|
-
|
|
371
|
-
- Type-safe API calls with generics
|
|
372
|
-
- Can be added later via `setup --http-client`
|
|
365
|
+
npx @teispace/next-maker feature cart --store persist --skip-service
|
|
366
|
+
npx @teispace/next-maker page checkout --loading --error
|
|
367
|
+
```
|
|
373
368
|
|
|
374
|
-
###
|
|
369
|
+
### Get Help
|
|
375
370
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
-
|
|
379
|
-
-
|
|
380
|
-
-
|
|
371
|
+
```bash
|
|
372
|
+
npx @teispace/next-maker --help
|
|
373
|
+
npx @teispace/next-maker page --help
|
|
374
|
+
npx @teispace/next-maker component --help
|
|
375
|
+
npx @teispace/next-maker locale --help
|
|
376
|
+
```
|
|
381
377
|
|
|
382
|
-
|
|
378
|
+
---
|
|
383
379
|
|
|
384
|
-
|
|
385
|
-
- Translation management system
|
|
386
|
-
- Locale type safety
|
|
387
|
-
- [locale] route structure
|
|
388
|
-
- Can be added via `setup --i18n`
|
|
380
|
+
## Key Features
|
|
389
381
|
|
|
390
|
-
###
|
|
382
|
+
### Pages with Full Locale Support
|
|
391
383
|
|
|
392
|
-
|
|
384
|
+
Auto-generates `generateMetadata`, `setRequestLocale`, typed Props, SEO metadata, and translation namespace. Supports dynamic routes with `--dynamic`.
|
|
393
385
|
|
|
394
|
-
|
|
395
|
-
- Absolute: `src/modules/auth` → `src/modules/auth`
|
|
396
|
-
- Auto-creates directory structure
|
|
397
|
-
- Adapts imports based on location
|
|
386
|
+
### Shared Components with Auto-Wiring
|
|
398
387
|
|
|
399
|
-
|
|
388
|
+
Creates component in `src/components/common/<Name>/` and auto-updates all barrel exports so you can immediately `import { MyComponent } from '@/components'`.
|
|
400
389
|
|
|
401
|
-
|
|
402
|
-
- Prevents duplicate generation and setups
|
|
403
|
-
- Validates naming conventions (kebab-case)
|
|
404
|
-
- Ensures consistent project structure
|
|
405
|
-
- Validates GitHub repository URLs
|
|
390
|
+
### CRUD Service Generation
|
|
406
391
|
|
|
407
|
-
|
|
392
|
+
`--crud` flag generates a complete service with 5 REST methods, separate `Summary` and `Detail` response types (list vs detail views), typed DTOs, and full API config with dynamic route helpers.
|
|
408
393
|
|
|
409
|
-
|
|
394
|
+
### Locale Management
|
|
410
395
|
|
|
411
|
-
|
|
396
|
+
One command adds a new language: translation file, type update, and config entry. No manual file editing.
|
|
412
397
|
|
|
413
|
-
|
|
398
|
+
### Feature-First Architecture
|
|
414
399
|
|
|
415
|
-
|
|
416
|
-
- `--path <path>` - Custom generation path
|
|
417
|
-
- `--help` - Show command help
|
|
400
|
+
All generators follow a feature-based DDD approach, organizing code by business domain rather than technical layers.
|
|
418
401
|
|
|
419
|
-
###
|
|
402
|
+
### Smart Redux Integration
|
|
420
403
|
|
|
421
|
-
|
|
404
|
+
Auto-registers slices in `rootReducer` with correct import paths and optional redux-persist configuration.
|
|
422
405
|
|
|
423
|
-
|
|
424
|
-
- Package manager selection
|
|
425
|
-
- GitHub repository (optional)
|
|
426
|
-
- HTTP client selection
|
|
427
|
-
- Dark mode, Redux, i18n toggles
|
|
428
|
-
- Docker, CI/CD, pre-commit hooks
|
|
406
|
+
### HTTP Client Support
|
|
429
407
|
|
|
430
|
-
|
|
408
|
+
- **AxiosClient**: Result-based error handling
|
|
409
|
+
- **FetchClient**: Same Result pattern with native fetch
|
|
410
|
+
- Auto-detects available clients
|
|
431
411
|
|
|
432
|
-
|
|
433
|
-
--http-client <type> # Setup HTTP client (axios|fetch|both)
|
|
434
|
-
--dark-theme # Setup dark theme support
|
|
435
|
-
--redux # Setup Redux Toolkit
|
|
436
|
-
--i18n # Setup internationalization
|
|
437
|
-
```
|
|
412
|
+
### Intelligent Path Handling
|
|
438
413
|
|
|
439
|
-
|
|
414
|
+
All commands support `--path` for custom locations. Relative paths like `features/auth` are resolved to `src/features/auth`.
|
|
440
415
|
|
|
441
|
-
|
|
442
|
-
--store <persist|no-persist> # Generate Redux store
|
|
443
|
-
--skip-store # Don't generate store
|
|
444
|
-
--service <axios|fetch> # Generate API service
|
|
445
|
-
--skip-service # Don't generate service
|
|
446
|
-
```
|
|
416
|
+
### Built-in Validations
|
|
447
417
|
|
|
448
|
-
|
|
418
|
+
- Checks for required dependencies (Redux, HTTP clients, i18n)
|
|
419
|
+
- Prevents duplicate generation
|
|
420
|
+
- Validates naming conventions (kebab-case)
|
|
449
421
|
|
|
450
|
-
|
|
451
|
-
--persist # Enable redux-persist
|
|
452
|
-
--no-persist # Disable persistence
|
|
453
|
-
```
|
|
422
|
+
---
|
|
454
423
|
|
|
455
|
-
|
|
424
|
+
## Command Reference
|
|
456
425
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
426
|
+
| Command | Description |
|
|
427
|
+
| ------------------ | -------------------------------- |
|
|
428
|
+
| `init [name]` | Create a new Next.js application |
|
|
429
|
+
| `setup` | Add features to existing project |
|
|
430
|
+
| `page <name>` | Generate a new page/route |
|
|
431
|
+
| `component <name>` | Generate a shared component |
|
|
432
|
+
| `feature <name>` | Generate a feature module |
|
|
433
|
+
| `slice <name>` | Generate a Redux slice |
|
|
434
|
+
| `service <name>` | Generate an API service |
|
|
435
|
+
| `locale [code]` | Add a new locale/language |
|
|
436
|
+
| `hook <name>` | Generate a custom React hook |
|
|
461
437
|
|
|
462
438
|
---
|
|
463
439
|
|
|
@@ -469,6 +445,7 @@ Generated apps follow this structure:
|
|
|
469
445
|
my-project/
|
|
470
446
|
├── src/
|
|
471
447
|
│ ├── app/ # Next.js App Router
|
|
448
|
+
│ │ └── [locale]/ # Locale-aware routes (if i18n)
|
|
472
449
|
│ ├── features/ # Feature modules (DDD)
|
|
473
450
|
│ │ └── counter/
|
|
474
451
|
│ │ ├── components/
|
|
@@ -477,21 +454,18 @@ my-project/
|
|
|
477
454
|
│ │ ├── types/
|
|
478
455
|
│ │ └── index.ts
|
|
479
456
|
│ ├── components/ # Shared components
|
|
457
|
+
│ │ └── common/ # Reusable UI components
|
|
480
458
|
│ ├── lib/
|
|
481
459
|
│ │ ├── config/ # App configuration
|
|
482
460
|
│ │ ├── utils/
|
|
483
461
|
│ │ │ └── http/ # AxiosClient & FetchClient
|
|
484
|
-
│ │
|
|
485
|
-
│ │ └── validations/ # Validation schemas
|
|
462
|
+
│ │ └── errors/ # Error classes
|
|
486
463
|
│ ├── providers/ # React providers
|
|
487
464
|
│ ├── store/ # Redux store setup
|
|
488
|
-
│ ├── services/ # Global services
|
|
489
465
|
│ ├── i18n/ # Internationalization
|
|
466
|
+
│ │ └── translations/ # Translation files
|
|
490
467
|
│ └── styles/ # Global styles
|
|
491
468
|
├── public/ # Static assets
|
|
492
|
-
├── .husky/ # Git hooks
|
|
493
|
-
├── Dockerfile
|
|
494
|
-
├── docker-compose.yml
|
|
495
469
|
└── package.json
|
|
496
470
|
```
|
|
497
471
|
|
|
@@ -501,20 +475,11 @@ my-project/
|
|
|
501
475
|
|
|
502
476
|
**CLI:**
|
|
503
477
|
|
|
504
|
-
- TypeScript
|
|
505
|
-
- esbuild - Fast bundling
|
|
506
|
-
- Commander.js - CLI framework
|
|
507
|
-
- Enquirer - Interactive prompts
|
|
478
|
+
- TypeScript, esbuild, Commander.js, Enquirer, Vitest
|
|
508
479
|
|
|
509
480
|
**Generated Apps:**
|
|
510
481
|
|
|
511
|
-
- Next.js 16
|
|
512
|
-
- TypeScript - Static typing
|
|
513
|
-
- Redux Toolkit - State management
|
|
514
|
-
- Tailwind CSS v4 - Styling
|
|
515
|
-
- next-intl - Internationalization
|
|
516
|
-
- Axios - HTTP client
|
|
517
|
-
- ESLint + Prettier - Code quality
|
|
482
|
+
- Next.js 16+, TypeScript, Redux Toolkit, Tailwind CSS v4, next-intl, Axios, ESLint + Prettier
|
|
518
483
|
|
|
519
484
|
---
|
|
520
485
|
|
|
@@ -525,46 +490,32 @@ my-project/
|
|
|
525
490
|
```bash
|
|
526
491
|
git clone <repository-url>
|
|
527
492
|
cd npm-packages/packages/next-maker
|
|
528
|
-
|
|
493
|
+
npm install
|
|
529
494
|
```
|
|
530
495
|
|
|
531
496
|
### Build
|
|
532
497
|
|
|
533
498
|
```bash
|
|
534
|
-
|
|
499
|
+
npm run build
|
|
535
500
|
```
|
|
536
501
|
|
|
537
|
-
### Test
|
|
502
|
+
### Test
|
|
538
503
|
|
|
539
504
|
```bash
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
# Navigate to test project
|
|
544
|
-
cd test-project
|
|
545
|
-
|
|
546
|
-
# Test setup commands
|
|
547
|
-
node ../dist/index.js setup --http-client
|
|
548
|
-
node ../dist/index.js setup --dark-theme
|
|
549
|
-
node ../dist/index.js setup --redux
|
|
550
|
-
node ../dist/index.js setup --i18n
|
|
551
|
-
|
|
552
|
-
# Test feature generation
|
|
553
|
-
node ../dist/index.js feature auth --store persist --service axios
|
|
554
|
-
|
|
555
|
-
# Test slice generation
|
|
556
|
-
node ../dist/index.js slice user-profile --persist
|
|
557
|
-
|
|
558
|
-
# Test service generation
|
|
559
|
-
node ../dist/index.js service payment --axios
|
|
505
|
+
npm test
|
|
506
|
+
npm run test:watch
|
|
560
507
|
```
|
|
561
508
|
|
|
562
|
-
###
|
|
509
|
+
### Test Locally
|
|
563
510
|
|
|
564
511
|
```bash
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
512
|
+
node dist/index.js init test-project
|
|
513
|
+
cd test-project
|
|
514
|
+
node ../dist/index.js page dashboard --loading --error
|
|
515
|
+
node ../dist/index.js component sidebar --client
|
|
516
|
+
node ../dist/index.js feature auth --store persist --service axios
|
|
517
|
+
node ../dist/index.js service users --fetch --crud
|
|
518
|
+
node ../dist/index.js locale es
|
|
568
519
|
```
|
|
569
520
|
|
|
570
521
|
---
|