@teispace/next-maker 1.11.0 → 1.12.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 +196 -272
- package/dist/index.js +341 -223
- 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.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx @teispace/next-maker page <name> [options]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Options:**
|
|
95
|
+
|
|
96
|
+
- `--dynamic <param>` - Create dynamic route (e.g., `--dynamic id` creates `[id]/page.tsx`)
|
|
97
|
+
- `--loading` - Generate `loading.tsx`
|
|
98
|
+
- `--error` - Generate `error.tsx`
|
|
99
|
+
|
|
100
|
+
**What it generates:**
|
|
101
|
+
|
|
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`
|
|
106
|
+
|
|
107
|
+
**Examples:**
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Simple page
|
|
111
|
+
npx @teispace/next-maker page about
|
|
112
|
+
|
|
113
|
+
# Page with loading and error states
|
|
114
|
+
npx @teispace/next-maker page dashboard --loading --error
|
|
115
|
+
|
|
116
|
+
# Dynamic route (e.g., /products/[id])
|
|
117
|
+
npx @teispace/next-maker page products --dynamic id --loading --error
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
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:**
|
|
107
131
|
|
|
108
|
-
|
|
132
|
+
- `--client` - Add `'use client'` directive
|
|
133
|
+
- `--i18n` - Add `useTranslations` hook
|
|
134
|
+
- `--feature <path>` - Generate inside a feature directory
|
|
109
135
|
|
|
110
|
-
|
|
111
|
-
- Updates `src/lib/utils/http/index.ts` with exports
|
|
112
|
-
- Installs axios package (if selected)
|
|
136
|
+
**Generated structure (shared):**
|
|
113
137
|
|
|
114
|
-
|
|
138
|
+
```
|
|
139
|
+
src/components/common/MyButton/
|
|
140
|
+
├── MyButton.tsx
|
|
141
|
+
└── index.ts
|
|
142
|
+
```
|
|
115
143
|
|
|
116
|
-
-
|
|
117
|
-
- Adds `@custom-variant dark` to `src/styles/globals.css`
|
|
118
|
-
- Adds CSS variables `--color-dark` and `--color-light`
|
|
119
|
-
- Updates layout.tsx with `bg-light dark:bg-dark` classes
|
|
120
|
-
- Integrates with RootProvider
|
|
121
|
-
- Installs next-themes package
|
|
144
|
+
Auto-updates `src/components/common/index.ts` and `src/components/index.ts`.
|
|
122
145
|
|
|
123
|
-
**
|
|
146
|
+
**Examples:**
|
|
124
147
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
- Integrates with RootProvider
|
|
129
|
-
- Installs @reduxjs/toolkit, react-redux, redux-persist
|
|
148
|
+
```bash
|
|
149
|
+
# Shared component
|
|
150
|
+
npx @teispace/next-maker component data-table --client
|
|
130
151
|
|
|
131
|
-
|
|
152
|
+
# Component with i18n
|
|
153
|
+
npx @teispace/next-maker component nav-bar --client --i18n
|
|
132
154
|
|
|
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
|
|
155
|
+
# Feature-specific component
|
|
156
|
+
npx @teispace/next-maker component user-card --client --feature src/features/auth
|
|
157
|
+
```
|
|
140
158
|
|
|
141
159
|
---
|
|
142
160
|
|
|
143
|
-
###
|
|
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,66 +249,82 @@ 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
|
+
- DTO types: `Create<Name>Dto`, `Update<Name>Dto`, `<Name>` response interface
|
|
259
|
+
- Full API config with dynamic routes (`getById(id)`, `update(id)`, `delete(id)`)
|
|
258
260
|
|
|
259
261
|
**Examples:**
|
|
260
262
|
|
|
261
263
|
```bash
|
|
262
|
-
#
|
|
264
|
+
# Simple service
|
|
263
265
|
npx @teispace/next-maker service payment --axios
|
|
264
266
|
|
|
265
|
-
#
|
|
266
|
-
npx @teispace/next-maker service
|
|
267
|
+
# Full CRUD service with types and endpoints
|
|
268
|
+
npx @teispace/next-maker service users --fetch --crud
|
|
267
269
|
|
|
268
|
-
#
|
|
269
|
-
npx @teispace/next-maker service
|
|
270
|
+
# CRUD service in existing feature
|
|
271
|
+
npx @teispace/next-maker service orders --axios --crud --path features/products/services
|
|
270
272
|
```
|
|
271
273
|
|
|
272
274
|
---
|
|
273
275
|
|
|
274
|
-
|
|
276
|
+
### 8. Add a Locale
|
|
275
277
|
|
|
276
|
-
|
|
278
|
+
Add a new language/locale to your internationalized project.
|
|
277
279
|
|
|
278
280
|
```bash
|
|
279
|
-
|
|
280
|
-
|
|
281
|
+
npx @teispace/next-maker locale [code] [options]
|
|
282
|
+
```
|
|
281
283
|
|
|
282
|
-
|
|
283
|
-
cd my-project
|
|
284
|
+
**Options:**
|
|
284
285
|
|
|
285
|
-
|
|
286
|
-
npx @teispace/next-maker feature auth --store persist --service axios
|
|
286
|
+
- `--copy-translations` - Copy English translations instead of empty values
|
|
287
287
|
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
**What it does:**
|
|
289
|
+
|
|
290
|
+
- Creates `src/i18n/translations/<code>.json` (empty or copied from English)
|
|
291
|
+
- Updates `SupportedLocale` type in `src/types/i18n.ts`
|
|
292
|
+
- Adds entry to `src/lib/config/app-locales.ts` with name, flag, country
|
|
293
|
+
|
|
294
|
+
**Examples:**
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Add Spanish (interactive prompts for name, country, flag)
|
|
298
|
+
npx @teispace/next-maker locale es
|
|
299
|
+
|
|
300
|
+
# Add French with English translations as starting point
|
|
301
|
+
npx @teispace/next-maker locale fr --copy-translations
|
|
290
302
|
```
|
|
291
303
|
|
|
292
|
-
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Usage Examples
|
|
307
|
+
|
|
308
|
+
### Quick Start - New Project
|
|
293
309
|
|
|
294
310
|
```bash
|
|
295
|
-
#
|
|
311
|
+
# Create a new Next.js app with interactive setup
|
|
312
|
+
npx @teispace/next-maker init my-project
|
|
313
|
+
cd my-project
|
|
296
314
|
|
|
297
|
-
#
|
|
298
|
-
npx @teispace/next-maker
|
|
315
|
+
# Generate pages
|
|
316
|
+
npx @teispace/next-maker page dashboard --loading --error
|
|
317
|
+
npx @teispace/next-maker page settings --loading
|
|
299
318
|
|
|
300
|
-
#
|
|
301
|
-
npx @teispace/next-maker
|
|
319
|
+
# Generate features with CRUD
|
|
320
|
+
npx @teispace/next-maker feature users --store persist --service fetch
|
|
321
|
+
npx @teispace/next-maker service users --fetch --crud --path features/users/services
|
|
302
322
|
|
|
303
|
-
# Add
|
|
304
|
-
npx @teispace/next-maker
|
|
323
|
+
# Add a locale
|
|
324
|
+
npx @teispace/next-maker locale es
|
|
305
325
|
|
|
306
|
-
#
|
|
307
|
-
|
|
326
|
+
# Start development
|
|
327
|
+
npm run dev
|
|
308
328
|
```
|
|
309
329
|
|
|
310
330
|
### Feature-Based Development
|
|
@@ -312,152 +332,81 @@ npx @teispace/next-maker setup --i18n
|
|
|
312
332
|
```bash
|
|
313
333
|
# E-commerce example
|
|
314
334
|
npx @teispace/next-maker feature products --store persist --service axios
|
|
315
|
-
npx @teispace/next-maker
|
|
316
|
-
npx @teispace/next-maker
|
|
317
|
-
npx @teispace/next-maker
|
|
335
|
+
npx @teispace/next-maker service products --axios --crud --path features/products/services
|
|
336
|
+
npx @teispace/next-maker page products --dynamic id --loading --error
|
|
337
|
+
npx @teispace/next-maker component product-card --client --feature src/features/products
|
|
318
338
|
|
|
319
|
-
|
|
320
|
-
npx @teispace/next-maker
|
|
321
|
-
npx @teispace/next-maker slice analytics --path features/dashboard/store
|
|
322
|
-
npx @teispace/next-maker service metrics --fetch --path features/dashboard/services
|
|
339
|
+
npx @teispace/next-maker feature cart --store persist --skip-service
|
|
340
|
+
npx @teispace/next-maker page checkout --loading --error
|
|
323
341
|
```
|
|
324
342
|
|
|
325
343
|
### Get Help
|
|
326
344
|
|
|
327
345
|
```bash
|
|
328
|
-
# General help
|
|
329
346
|
npx @teispace/next-maker --help
|
|
330
|
-
|
|
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
|
|
347
|
+
npx @teispace/next-maker page --help
|
|
348
|
+
npx @teispace/next-maker component --help
|
|
349
|
+
npx @teispace/next-maker locale --help
|
|
337
350
|
```
|
|
338
351
|
|
|
339
352
|
---
|
|
340
353
|
|
|
341
354
|
## Key Features
|
|
342
355
|
|
|
343
|
-
###
|
|
356
|
+
### Pages with Full Locale Support
|
|
344
357
|
|
|
345
|
-
|
|
358
|
+
Auto-generates `generateMetadata`, `setRequestLocale`, typed Props, SEO metadata, and translation namespace. Supports dynamic routes with `--dynamic`.
|
|
346
359
|
|
|
347
|
-
|
|
348
|
-
- Dark theme with automatic CSS and layout updates
|
|
349
|
-
- Redux Toolkit with complete store configuration
|
|
350
|
-
- Internationalization with routing and middleware
|
|
351
|
-
- Smart detection prevents duplicate setups
|
|
352
|
-
- Automatic package installation
|
|
360
|
+
### Shared Components with Auto-Wiring
|
|
353
361
|
|
|
354
|
-
|
|
362
|
+
Creates component in `src/components/common/<Name>/` and auto-updates all barrel exports so you can immediately `import { MyComponent } from '@/components'`.
|
|
355
363
|
|
|
356
|
-
|
|
364
|
+
### CRUD Service Generation
|
|
357
365
|
|
|
358
|
-
|
|
366
|
+
`--crud` flag generates a complete service with 5 REST methods, typed DTOs, and full API config with dynamic route helpers.
|
|
359
367
|
|
|
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`
|
|
368
|
+
### Locale Management
|
|
365
369
|
|
|
366
|
-
|
|
370
|
+
One command adds a new language: translation file, type update, and config entry. No manual file editing.
|
|
367
371
|
|
|
368
|
-
|
|
369
|
-
- **FetchClient**: Same Result pattern with native fetch
|
|
370
|
-
- Auto-detects available clients
|
|
371
|
-
- Type-safe API calls with generics
|
|
372
|
-
- Can be added later via `setup --http-client`
|
|
372
|
+
### Feature-First Architecture
|
|
373
373
|
|
|
374
|
-
|
|
374
|
+
All generators follow a feature-based DDD approach, organizing code by business domain rather than technical layers.
|
|
375
375
|
|
|
376
|
-
|
|
377
|
-
- Automatic CSS variable setup (`--color-dark`, `--color-light`)
|
|
378
|
-
- Tailwind CSS v4 custom variant (`@custom-variant dark`)
|
|
379
|
-
- Layout className updates (`bg-light dark:bg-dark`)
|
|
380
|
-
- Can be added via `setup --dark-theme`
|
|
376
|
+
### Smart Redux Integration
|
|
381
377
|
|
|
382
|
-
|
|
378
|
+
Auto-registers slices in `rootReducer` with correct import paths and optional redux-persist configuration.
|
|
383
379
|
|
|
384
|
-
|
|
385
|
-
- Translation management system
|
|
386
|
-
- Locale type safety
|
|
387
|
-
- [locale] route structure
|
|
388
|
-
- Can be added via `setup --i18n`
|
|
380
|
+
### HTTP Client Support
|
|
389
381
|
|
|
390
|
-
|
|
382
|
+
- **AxiosClient**: Result-based error handling
|
|
383
|
+
- **FetchClient**: Same Result pattern with native fetch
|
|
384
|
+
- Auto-detects available clients
|
|
391
385
|
|
|
392
|
-
|
|
386
|
+
### Intelligent Path Handling
|
|
393
387
|
|
|
394
|
-
|
|
395
|
-
- Absolute: `src/modules/auth` → `src/modules/auth`
|
|
396
|
-
- Auto-creates directory structure
|
|
397
|
-
- Adapts imports based on location
|
|
388
|
+
All commands support `--path` for custom locations. Relative paths like `features/auth` are resolved to `src/features/auth`.
|
|
398
389
|
|
|
399
|
-
###
|
|
390
|
+
### Built-in Validations
|
|
400
391
|
|
|
401
|
-
- Checks for required dependencies (Redux, HTTP clients)
|
|
402
|
-
- Prevents duplicate generation
|
|
392
|
+
- Checks for required dependencies (Redux, HTTP clients, i18n)
|
|
393
|
+
- Prevents duplicate generation
|
|
403
394
|
- Validates naming conventions (kebab-case)
|
|
404
|
-
- Ensures consistent project structure
|
|
405
|
-
- Validates GitHub repository URLs
|
|
406
395
|
|
|
407
396
|
---
|
|
408
397
|
|
|
409
398
|
## Command Reference
|
|
410
399
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
Interactive prompts guide you through:
|
|
422
|
-
|
|
423
|
-
- Project name, description, version
|
|
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
|
|
429
|
-
|
|
430
|
-
### Setup Options
|
|
431
|
-
|
|
432
|
-
```bash
|
|
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
|
-
```
|
|
438
|
-
|
|
439
|
-
### Feature Options
|
|
440
|
-
|
|
441
|
-
```bash
|
|
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
|
-
```
|
|
447
|
-
|
|
448
|
-
### Slice Options
|
|
449
|
-
|
|
450
|
-
```bash
|
|
451
|
-
--persist # Enable redux-persist
|
|
452
|
-
--no-persist # Disable persistence
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
### Service Options
|
|
456
|
-
|
|
457
|
-
```bash
|
|
458
|
-
--axios # Use AxiosClient
|
|
459
|
-
--fetch # Use FetchClient
|
|
460
|
-
```
|
|
400
|
+
| Command | Description |
|
|
401
|
+
| ------------------ | -------------------------------- |
|
|
402
|
+
| `init [name]` | Create a new Next.js application |
|
|
403
|
+
| `setup` | Add features to existing project |
|
|
404
|
+
| `page <name>` | Generate a new page/route |
|
|
405
|
+
| `component <name>` | Generate a shared component |
|
|
406
|
+
| `feature <name>` | Generate a feature module |
|
|
407
|
+
| `slice <name>` | Generate a Redux slice |
|
|
408
|
+
| `service <name>` | Generate an API service |
|
|
409
|
+
| `locale [code]` | Add a new locale/language |
|
|
461
410
|
|
|
462
411
|
---
|
|
463
412
|
|
|
@@ -469,6 +418,7 @@ Generated apps follow this structure:
|
|
|
469
418
|
my-project/
|
|
470
419
|
├── src/
|
|
471
420
|
│ ├── app/ # Next.js App Router
|
|
421
|
+
│ │ └── [locale]/ # Locale-aware routes (if i18n)
|
|
472
422
|
│ ├── features/ # Feature modules (DDD)
|
|
473
423
|
│ │ └── counter/
|
|
474
424
|
│ │ ├── components/
|
|
@@ -477,21 +427,18 @@ my-project/
|
|
|
477
427
|
│ │ ├── types/
|
|
478
428
|
│ │ └── index.ts
|
|
479
429
|
│ ├── components/ # Shared components
|
|
430
|
+
│ │ └── common/ # Reusable UI components
|
|
480
431
|
│ ├── lib/
|
|
481
432
|
│ │ ├── config/ # App configuration
|
|
482
433
|
│ │ ├── utils/
|
|
483
434
|
│ │ │ └── http/ # AxiosClient & FetchClient
|
|
484
|
-
│ │
|
|
485
|
-
│ │ └── validations/ # Validation schemas
|
|
435
|
+
│ │ └── errors/ # Error classes
|
|
486
436
|
│ ├── providers/ # React providers
|
|
487
437
|
│ ├── store/ # Redux store setup
|
|
488
|
-
│ ├── services/ # Global services
|
|
489
438
|
│ ├── i18n/ # Internationalization
|
|
439
|
+
│ │ └── translations/ # Translation files
|
|
490
440
|
│ └── styles/ # Global styles
|
|
491
441
|
├── public/ # Static assets
|
|
492
|
-
├── .husky/ # Git hooks
|
|
493
|
-
├── Dockerfile
|
|
494
|
-
├── docker-compose.yml
|
|
495
442
|
└── package.json
|
|
496
443
|
```
|
|
497
444
|
|
|
@@ -501,20 +448,11 @@ my-project/
|
|
|
501
448
|
|
|
502
449
|
**CLI:**
|
|
503
450
|
|
|
504
|
-
- TypeScript
|
|
505
|
-
- esbuild - Fast bundling
|
|
506
|
-
- Commander.js - CLI framework
|
|
507
|
-
- Enquirer - Interactive prompts
|
|
451
|
+
- TypeScript, esbuild, Commander.js, Enquirer, Vitest
|
|
508
452
|
|
|
509
453
|
**Generated Apps:**
|
|
510
454
|
|
|
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
|
|
455
|
+
- Next.js 16+, TypeScript, Redux Toolkit, Tailwind CSS v4, next-intl, Axios, ESLint + Prettier
|
|
518
456
|
|
|
519
457
|
---
|
|
520
458
|
|
|
@@ -525,46 +463,32 @@ my-project/
|
|
|
525
463
|
```bash
|
|
526
464
|
git clone <repository-url>
|
|
527
465
|
cd npm-packages/packages/next-maker
|
|
528
|
-
|
|
466
|
+
npm install
|
|
529
467
|
```
|
|
530
468
|
|
|
531
469
|
### Build
|
|
532
470
|
|
|
533
471
|
```bash
|
|
534
|
-
|
|
472
|
+
npm run build
|
|
535
473
|
```
|
|
536
474
|
|
|
537
|
-
### Test
|
|
475
|
+
### Test
|
|
538
476
|
|
|
539
477
|
```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
|
|
478
|
+
npm test
|
|
479
|
+
npm run test:watch
|
|
560
480
|
```
|
|
561
481
|
|
|
562
|
-
###
|
|
482
|
+
### Test Locally
|
|
563
483
|
|
|
564
484
|
```bash
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
485
|
+
node dist/index.js init test-project
|
|
486
|
+
cd test-project
|
|
487
|
+
node ../dist/index.js page dashboard --loading --error
|
|
488
|
+
node ../dist/index.js component sidebar --client
|
|
489
|
+
node ../dist/index.js feature auth --store persist --service axios
|
|
490
|
+
node ../dist/index.js service users --fetch --crud
|
|
491
|
+
node ../dist/index.js locale es
|
|
568
492
|
```
|
|
569
493
|
|
|
570
494
|
---
|