@teispace/next-maker 1.14.0 → 1.15.1

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 (54) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +149 -40
  3. package/dist/index.js +483 -248
  4. package/dist/index.js.map +4 -4
  5. package/dist/src/commands/component.d.ts.map +1 -1
  6. package/dist/src/commands/hook.d.ts.map +1 -1
  7. package/dist/src/commands/index.d.ts.map +1 -1
  8. package/dist/src/commands/setup.d.ts.map +1 -1
  9. package/dist/src/commands/slice.d.ts.map +1 -1
  10. package/dist/src/commands/test.d.ts +3 -0
  11. package/dist/src/commands/test.d.ts.map +1 -0
  12. package/dist/src/config/packages.d.ts +11 -1
  13. package/dist/src/config/packages.d.ts.map +1 -1
  14. package/dist/src/config/paths.d.ts +5 -2
  15. package/dist/src/config/paths.d.ts.map +1 -1
  16. package/dist/src/core/package-manager.d.ts +2 -0
  17. package/dist/src/core/package-manager.d.ts.map +1 -1
  18. package/dist/src/detection/project.detector.d.ts +1 -0
  19. package/dist/src/detection/project.detector.d.ts.map +1 -1
  20. package/dist/src/generators/index.d.ts +2 -0
  21. package/dist/src/generators/index.d.ts.map +1 -1
  22. package/dist/src/generators/templates/test.template.d.ts +27 -0
  23. package/dist/src/generators/templates/test.template.d.ts.map +1 -0
  24. package/dist/src/generators/test.generator.d.ts +19 -0
  25. package/dist/src/generators/test.generator.d.ts.map +1 -0
  26. package/dist/src/prompts/create-app.prompt.d.ts +3 -0
  27. package/dist/src/prompts/create-app.prompt.d.ts.map +1 -1
  28. package/dist/src/services/common/test-utils.d.ts +12 -0
  29. package/dist/src/services/common/test-utils.d.ts.map +1 -0
  30. package/dist/src/services/init/cleanup/bundle-analyzer.cleanup.d.ts +3 -0
  31. package/dist/src/services/init/cleanup/bundle-analyzer.cleanup.d.ts.map +1 -0
  32. package/dist/src/services/init/cleanup/i18n.cleanup.d.ts.map +1 -1
  33. package/dist/src/services/init/cleanup/index.d.ts.map +1 -1
  34. package/dist/src/services/init/cleanup/react-compiler.cleanup.d.ts +3 -0
  35. package/dist/src/services/init/cleanup/react-compiler.cleanup.d.ts.map +1 -0
  36. package/dist/src/services/init/cleanup/redux.cleanup.d.ts.map +1 -1
  37. package/dist/src/services/init/cleanup/tests.cleanup.d.ts +3 -0
  38. package/dist/src/services/init/cleanup/tests.cleanup.d.ts.map +1 -0
  39. package/dist/src/services/init/config.service.d.ts.map +1 -1
  40. package/dist/src/services/init/providers.service.d.ts.map +1 -1
  41. package/dist/src/services/setup/bundle-analyzer/index.d.ts +2 -0
  42. package/dist/src/services/setup/bundle-analyzer/index.d.ts.map +1 -0
  43. package/dist/src/services/setup/dark-theme/checks.d.ts.map +1 -1
  44. package/dist/src/services/setup/dark-theme/injectors.d.ts.map +1 -1
  45. package/dist/src/services/setup/i18n/index.d.ts.map +1 -1
  46. package/dist/src/services/setup/i18n/injectors.d.ts.map +1 -1
  47. package/dist/src/services/setup/react-compiler/index.d.ts +2 -0
  48. package/dist/src/services/setup/react-compiler/index.d.ts.map +1 -0
  49. package/dist/src/services/setup/redux/index.d.ts.map +1 -1
  50. package/dist/src/services/setup/redux/injectors.d.ts +1 -1
  51. package/dist/src/services/setup/redux/injectors.d.ts.map +1 -1
  52. package/dist/src/services/setup/tests/index.d.ts +2 -0
  53. package/dist/src/services/setup/tests/index.d.ts.map +1 -0
  54. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.15.1](https://github.com/teispace/npm-packages/compare/next-maker-v1.15.0...next-maker-v1.15.1) (2026-04-24)
4
+
5
+
6
+ ### Documentation
7
+
8
+ * **next-maker:** react compiler is stable, not experimental ([591392b](https://github.com/teispace/npm-packages/commit/591392bb594478adc44edeb34eea067d774ef105))
9
+
10
+ ## [1.15.0](https://github.com/teispace/npm-packages/compare/next-maker-v1.14.0...next-maker-v1.15.0) (2026-04-24)
11
+
12
+
13
+ ### Features
14
+
15
+ * **next-maker:** biome + @teispace/next-themes migration, new prompts, test generation ([e30eb1a](https://github.com/teispace/npm-packages/commit/e30eb1a8dc3075868315bcf97cea10dfc001fc2e))
16
+
17
+
18
+ ### Documentation
19
+
20
+ * **next-maker:** sync README with current tooling, prompts, structure, and test generation ([dc599aa](https://github.com/teispace/npm-packages/commit/dc599aab194669c63a57aa45c70230bb937c6260))
21
+
3
22
  ## [1.14.0](https://github.com/teispace/npm-packages/compare/next-maker-v1.13.1...next-maker-v1.14.0) (2026-04-10)
4
23
 
5
24
 
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 pages, components, Redux slices, API services, and locales.
3
+ A CLI that scaffolds Next.js 16+ applications (TypeScript, Tailwind v4, Biome, Pino, Zod, Redux Toolkit, next-intl, Vitest) and co-generates feature-based architecture pages, components, hooks, Redux slices, API services, locales, and tests.
4
4
 
5
5
  ## Installation
6
6
 
@@ -34,22 +34,27 @@ During initialization, you'll be prompted to configure:
34
34
  - **Package Manager** (npm, yarn, pnpm, bun)
35
35
  - **GitHub Repository** (optional - configures remote origin)
36
36
  - **HTTP Client** (axios, fetch, both, or none)
37
- - **Dark Mode** (next-themes integration)
37
+ - **Dark Mode** (@teispace/next-themes integration)
38
38
  - **Redux Toolkit** (with redux-persist)
39
39
  - **Internationalization** (next-intl)
40
+ - **Testing** (Vitest + React Testing Library)
41
+ - **React Compiler** (stable — on by default)
42
+ - **Bundle Analyzer** (@next/bundle-analyzer — off by default)
40
43
  - **Community Files** (CODE_OF_CONDUCT, CONTRIBUTING, etc.)
41
44
  - **Docker** support
42
45
  - **CI/CD** configuration
43
46
  - **Pre-commit hooks** (Husky)
44
47
 
45
- **Core Features:**
48
+ **Core Features (always shipped):**
46
49
 
47
50
  - Next.js 16+ with App Router
48
51
  - TypeScript (strict mode)
49
52
  - Tailwind CSS v4
50
- - Result-based HTTP clients
53
+ - Biome (single-tool lint + format; replaces ESLint + Prettier)
54
+ - Pino structured logger with redaction
55
+ - Zod-validated env schema
51
56
  - Feature-based DDD architecture
52
- - ESLint + Prettier configured
57
+ - Result-based HTTP clients (axios / fetch)
53
58
 
54
59
  ---
55
60
 
@@ -64,9 +69,12 @@ npx @teispace/next-maker setup [options]
64
69
  **Options:**
65
70
 
66
71
  - `--http-client` - Setup HTTP client (Interactive: axios|fetch|both)
67
- - `--dark-theme` - Setup dark theme support (next-themes)
72
+ - `--dark-theme` - Setup dark theme support (@teispace/next-themes)
68
73
  - `--redux` - Setup Redux Toolkit with persistence
69
74
  - `--i18n` - Setup next-intl for internationalization
75
+ - `--tests` - Setup testing (Vitest + React Testing Library)
76
+ - `--react-compiler` - Enable the React Compiler
77
+ - `--bundle-analyzer` - Add @next/bundle-analyzer
70
78
 
71
79
  **Examples:**
72
80
 
@@ -79,6 +87,9 @@ npx @teispace/next-maker setup --http-client
79
87
  npx @teispace/next-maker setup --dark-theme
80
88
  npx @teispace/next-maker setup --redux
81
89
  npx @teispace/next-maker setup --i18n
90
+ npx @teispace/next-maker setup --tests
91
+ npx @teispace/next-maker setup --react-compiler
92
+ npx @teispace/next-maker setup --bundle-analyzer
82
93
  ```
83
94
 
84
95
  ---
@@ -132,6 +143,7 @@ npx @teispace/next-maker component <name> [options]
132
143
  - `--client` - Add `'use client'` directive
133
144
  - `--i18n` - Add `useTranslations` hook
134
145
  - `--feature <path>` - Generate inside a feature directory
146
+ - `--test` / `--no-test` - Co-generate a sibling `*.test.tsx` (default: on when tests are installed)
135
147
 
136
148
  **Generated structure (shared):**
137
149
 
@@ -222,6 +234,7 @@ npx @teispace/next-maker slice <name> [options]
222
234
  - `--persist` - Enable redux-persist for this slice
223
235
  - `--no-persist` - Disable persistence
224
236
  - `--path <path>` - Custom path (default: create new feature)
237
+ - `--test` / `--no-test` - Co-generate a sibling `*.slice.test.ts` (default: on when tests are installed)
225
238
 
226
239
  **Auto-registers in rootReducer** with correct imports.
227
240
 
@@ -316,6 +329,7 @@ npx @teispace/next-maker hook <name> [options]
316
329
 
317
330
  - `--client` - Add `'use client'` directive (default: true)
318
331
  - `--feature <path>` - Generate in feature directory
332
+ - `--test` / `--no-test` - Co-generate a sibling `*.test.ts` (default: on when tests are installed)
319
333
 
320
334
  **Examples:**
321
335
 
@@ -329,6 +343,40 @@ npx @teispace/next-maker hook user-profile --feature src/features/auth
329
343
 
330
344
  ---
331
345
 
346
+ ### 10. Generate a Test
347
+
348
+ Scaffold a sibling `*.test.{ts,tsx}` next to an existing component, hook, or slice. Handy for retrofitting tests onto code that pre-dates the `--with-test` flag.
349
+
350
+ ```bash
351
+ npx @teispace/next-maker test <file> [options]
352
+ ```
353
+
354
+ **Options:**
355
+
356
+ - `--kind <kind>` - Override inferred kind: `component` | `hook` | `slice`
357
+ - `--force` - Overwrite an existing test file
358
+
359
+ **Inference rules:**
360
+
361
+ - `*.slice.ts` → slice reducer test
362
+ - `use*.ts` / content starts with `export function useX` → hook test (`renderHook`)
363
+ - `*.tsx` → component test (`renderWithProviders`)
364
+
365
+ The generated file imports `renderWithProviders` / `TestProviders` from `test/test-utils` using a path resolved relative to the source file, so tests work whether they're under `src/features/*/components/`, `src/hooks/`, or anywhere else in the tree.
366
+
367
+ **Examples:**
368
+
369
+ ```bash
370
+ npx @teispace/next-maker test src/features/auth/components/LoginForm.tsx
371
+ npx @teispace/next-maker test src/features/auth/hooks/useLogin.ts
372
+ npx @teispace/next-maker test src/features/auth/store/auth.slice.ts
373
+ npx @teispace/next-maker test src/hooks/use-debounce.ts --kind hook --force
374
+ ```
375
+
376
+ Requires testing to be installed (`next-maker setup --tests` if not).
377
+
378
+ ---
379
+
332
380
  ## Usage Examples
333
381
 
334
382
  ### Quick Start - New Project
@@ -419,56 +467,114 @@ All commands support `--path` for custom locations. Relative paths like `feature
419
467
  - Prevents duplicate generation
420
468
  - Validates naming conventions (kebab-case)
421
469
 
470
+ ### Test Generation
471
+
472
+ - `component`, `hook`, and `slice` generators accept `--test` / `--no-test`; the default is **on** when Vitest is installed in the target project (detected via `vitest.config.ts` or the `vitest` dep).
473
+ - Component tests use `renderWithProviders` and forward `messages: {}` / `preloadedState: {}` based on detected i18n / Redux.
474
+ - Hook tests use `renderHook`; wrap with `TestProviders` when a Redux store is detected and the hook lives inside a feature.
475
+ - Slice tests exercise the reducer directly (`setLoading`, `setError`, `resetState`, initial-state invariants) — no providers needed.
476
+ - Standalone `test <file>` retrofits tests onto existing code, inferring kind from filename (`*.slice.ts`, `use*.ts`, `*.tsx`) and source content.
477
+ - Import paths to `test/test-utils` are resolved relative to the source file, so co-generated tests compile no matter how deep in the tree they live.
478
+
422
479
  ---
423
480
 
424
481
  ## Command Reference
425
482
 
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 |
483
+ | Command | Description |
484
+ | ------------------ | -------------------------------------------------------- |
485
+ | `init [name]` | Create a new Next.js application |
486
+ | `setup` | Add features to an existing project |
487
+ | `page <name>` | Generate a new page/route |
488
+ | `component <name>` | Generate a shared component (optional sibling test) |
489
+ | `feature <name>` | Generate a feature module |
490
+ | `slice <name>` | Generate a Redux slice (optional sibling test) |
491
+ | `service <name>` | Generate an API service |
492
+ | `locale [code]` | Add a new locale/language |
493
+ | `hook <name>` | Generate a custom React hook (optional sibling test) |
494
+ | `test <file>` | Generate a sibling test for a component/hook/slice |
437
495
 
438
496
  ---
439
497
 
440
498
  ## Project Structure
441
499
 
442
- Generated apps follow this structure:
500
+ The full shape of a scaffolded app (branches marked `(opt)` are stripped when the matching prompt is declined during `init`):
443
501
 
444
502
  ```
445
503
  my-project/
446
504
  ├── src/
447
- │ ├── app/ # Next.js App Router
448
- │ │ └── [locale]/ # Locale-aware routes (if i18n)
449
- │ ├── features/ # Feature modules (DDD)
450
- │ │ └── counter/
505
+ │ ├── app/ # Next.js App Router
506
+ │ │ ├── [locale]/ # (opt, i18n) locale-aware routes
507
+ │ │ ├── layout.tsx
508
+ │ │ │ ├── page.tsx
509
+ │ │ │ ├── error.tsx
510
+ │ │ │ └── not-found.tsx
511
+ │ │ ├── global-error.tsx
512
+ │ │ ├── not-found.tsx
513
+ │ │ ├── robots.ts
514
+ │ │ ├── sitemap.ts
515
+ │ │ └── favicon.ico
516
+ │ ├── proxy.ts # (opt, i18n) Next 16 middleware replacement
517
+ │ ├── features/ # Feature modules (feature-first DDD)
518
+ │ │ └── counter/ # (opt, redux) example feature
451
519
  │ │ ├── components/
452
- │ │ ├── hooks/
453
- │ │ ├── store/
454
- │ │ ├── types/
455
- │ │ └── index.ts
456
- ├── components/ # Shared components
457
- │ └── common/ # Reusable UI components
520
+ │ │ ├── Counter.tsx
521
+ │ │ │ └── Counter.test.tsx # (opt, tests)
522
+ │ │ ├── hooks/useCounter.ts
523
+ │ │ ├── store/ # slice + selectors + persist + barrel
524
+ │ └── types/counter.types.ts
525
+ ├── components/
526
+ │ │ ├── common/ # Shared UI (auto-wired barrel exports)
527
+ │ │ └── index.ts
528
+ │ ├── providers/
529
+ │ │ ├── RootProvider.tsx # Composes Store → Theme → Intl
530
+ │ │ ├── StoreProvider.tsx # (opt, redux) useRef + PersistGate
531
+ │ │ ├── CustomThemeProvider.tsx # (opt, dark-mode) @teispace/next-themes
532
+ │ │ └── index.ts
533
+ │ ├── store/ # (opt, redux) makeStore, rootReducer, typed hooks, SSR-safe storage
534
+ │ ├── services/
535
+ │ │ ├── api/ # API service barrel
536
+ │ │ └── storage/ # react-secure-storage wrapper
458
537
  │ ├── lib/
459
- │ │ ├── config/ # App configuration
460
- │ │ ├── utils/
461
- │ │ │ └── http/ # AxiosClient & FetchClient
462
- │ │ └── errors/ # Error classes
463
- │ ├── providers/ # React providers
464
- ├── store/ # Redux store setup
465
- │ ├── i18n/ # Internationalization
466
- │ │ └── translations/ # Translation files
467
- └── styles/ # Global styles
468
- ├── public/ # Static assets
538
+ │ │ ├── config/ # seo, app-apis, app-paths, app-locales, constants
539
+ │ │ ├── env/ # Zod-validated env schema (schema.ts, validate.ts)
540
+ │ │ ├── logger/ # Pino logger with auto-redaction
541
+ │ │ ├── errors/ # ApiException, catchError
542
+ ├── enums/
543
+ │ └── utils/
544
+ ├── http/ # (opt, http-client)
545
+ │ │ ├── axios-client/ # interceptors, token refresh, Result-based
546
+ │ │ ├── fetch-client/ # same Result pattern on native fetch
547
+ │ │ │ ├── client-utils.ts
548
+ │ │ │ └── token-store.ts
549
+ │ │ └── validations/
550
+ │ ├── i18n/ # (opt, i18n) routing, request, navigation, translations/
551
+ │ ├── styles/globals.css # Tailwind v4 directives
552
+ │ └── types/ # common/, utility/ (Result, Either), i18n.ts
553
+ ├── test/ # (opt, tests)
554
+ │ ├── setup.ts # testing-library + jsdom setup
555
+ │ └── test-utils.tsx # renderWithProviders, TestProviders
556
+ ├── scripts/
557
+ │ ├── sync-env.ts # .env.example ← .env (respects `-public` markers)
558
+ │ └── check-deprecated.ts # fails build if @deprecated APIs are referenced
559
+ ├── public/
560
+ ├── biome.json # single-tool lint + format
561
+ ├── next.config.ts # headers, reactCompiler (opt), bundleAnalyzer (opt), withNextIntl (opt, i18n)
562
+ ├── vitest.config.ts # (opt, tests)
563
+ ├── postcss.config.mjs # @tailwindcss/postcss
564
+ ├── tsconfig.json
565
+ ├── .env.example
566
+ ├── .husky/ # (opt, pre-commit hooks)
567
+ ├── .lintstagedrc.mjs # (opt, pre-commit hooks) runs `biome check --write`
568
+ ├── commitlint.config.mjs # (opt, pre-commit hooks)
569
+ ├── Dockerfile # (opt, docker) multi-stage, standalone mode
570
+ ├── docker-compose.yml # (opt, docker)
571
+ ├── AGENTS.md # Agent coding rules (referenced from CLAUDE.md)
572
+ ├── CLAUDE.md
469
573
  └── package.json
470
574
  ```
471
575
 
576
+ Features that have first-class opt-out prompts during `init`: `httpClient`, `darkMode`, `redux`, `i18n`, `tests`, `reactCompiler`, `bundleAnalyzer`, `docker`, `ci`, `preCommitHooks`, `commitizen`, `communityFiles`, `readme`. Each has a matching `setup --<feature>` command to re-add it later.
577
+
472
578
  ---
473
579
 
474
580
  ## Tech Stack
@@ -479,7 +585,7 @@ my-project/
479
585
 
480
586
  **Generated Apps:**
481
587
 
482
- - Next.js 16+, TypeScript, Redux Toolkit, Tailwind CSS v4, next-intl, Axios, ESLint + Prettier
588
+ - Next.js 16+, TypeScript, Tailwind CSS v4, Biome, Pino, Zod, Redux Toolkit, @teispace/next-themes, next-intl, Axios, Vitest + RTL, React Compiler
483
589
 
484
590
  ---
485
591
 
@@ -512,9 +618,12 @@ npm run test:watch
512
618
  node dist/index.js init test-project
513
619
  cd test-project
514
620
  node ../dist/index.js page dashboard --loading --error
515
- node ../dist/index.js component sidebar --client
621
+ node ../dist/index.js component sidebar --client # co-generates Sidebar.test.tsx if tests installed
622
+ node ../dist/index.js hook debounce # co-generates useDebounce.test.ts
623
+ node ../dist/index.js slice filters --persist # co-generates filters.slice.test.ts
516
624
  node ../dist/index.js feature auth --store persist --service axios
517
625
  node ../dist/index.js service users --fetch --crud
626
+ node ../dist/index.js test src/hooks/useDebounce.ts --force # retrofit sibling test
518
627
  node ../dist/index.js locale es
519
628
  ```
520
629