@teispace/next-maker 1.20.1 → 2.1.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 (38) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +28 -9
  3. package/dist/index.js +359 -217
  4. package/dist/index.js.map +4 -4
  5. package/dist/src/commands/setup.d.ts.map +1 -1
  6. package/dist/src/config/paths.d.ts +12 -0
  7. package/dist/src/config/paths.d.ts.map +1 -1
  8. package/dist/src/detection/project.detector.d.ts +7 -0
  9. package/dist/src/detection/project.detector.d.ts.map +1 -1
  10. package/dist/src/generators/templates/crud-service.template.d.ts.map +1 -1
  11. package/dist/src/manifests/http-client.manifest.d.ts.map +1 -1
  12. package/dist/src/manifests/index.d.ts +2 -1
  13. package/dist/src/manifests/index.d.ts.map +1 -1
  14. package/dist/src/manifests/ws.manifest.d.ts +3 -0
  15. package/dist/src/manifests/ws.manifest.d.ts.map +1 -0
  16. package/dist/src/modifiers/api-registration.modifier.d.ts.map +1 -1
  17. package/dist/src/prompts/create-app.prompt.d.ts +6 -0
  18. package/dist/src/prompts/create-app.prompt.d.ts.map +1 -1
  19. package/dist/src/services/init/cleanup/http.cleanup.d.ts.map +1 -1
  20. package/dist/src/services/init/cleanup/index.d.ts.map +1 -1
  21. package/dist/src/services/init/cleanup/seo.cleanup.d.ts +15 -0
  22. package/dist/src/services/init/cleanup/seo.cleanup.d.ts.map +1 -0
  23. package/dist/src/services/init/cleanup/ws.cleanup.d.ts +15 -0
  24. package/dist/src/services/init/cleanup/ws.cleanup.d.ts.map +1 -0
  25. package/dist/src/services/init/providers.service.d.ts.map +1 -1
  26. package/dist/src/services/setup/http-client/assets.d.ts.map +1 -1
  27. package/dist/src/services/setup/http-client/index.d.ts.map +1 -1
  28. package/dist/src/services/setup/http-client/injectors.d.ts +72 -0
  29. package/dist/src/services/setup/http-client/injectors.d.ts.map +1 -1
  30. package/dist/src/services/setup/ws/assets.d.ts +21 -0
  31. package/dist/src/services/setup/ws/assets.d.ts.map +1 -0
  32. package/dist/src/services/setup/ws/checks.d.ts +18 -0
  33. package/dist/src/services/setup/ws/checks.d.ts.map +1 -0
  34. package/dist/src/services/setup/ws/index.d.ts +21 -0
  35. package/dist/src/services/setup/ws/index.d.ts.map +1 -0
  36. package/dist/src/services/setup/ws/injectors.d.ts +57 -0
  37. package/dist/src/services/setup/ws/injectors.d.ts.map +1 -0
  38. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.0](https://github.com/teispace/npm-packages/compare/next-maker-v2.0.0...next-maker-v2.1.0) (2026-05-15)
4
+
5
+
6
+ ### Features
7
+
8
+ * **next-maker:** add WebSocket setup service + manifest ([#79](https://github.com/teispace/npm-packages/issues/79)) ([7e2dc3f](https://github.com/teispace/npm-packages/commit/7e2dc3f72616309da18b6d815a60a7e727d571f8))
9
+ * **next-maker:** add ws prompt + detection (data flow only) ([#78](https://github.com/teispace/npm-packages/issues/78)) ([f79c4d1](https://github.com/teispace/npm-packages/commit/f79c4d1002995ac0b3f55c1d1f4e96ee3788a6c2))
10
+ * **next-maker:** cleanup WebSocket layer when opted out at init ([#80](https://github.com/teispace/npm-packages/issues/80)) ([4d3d421](https://github.com/teispace/npm-packages/commit/4d3d421a5056097f7fdefa88f2340f3523faa850))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **next-maker:** strip intl from seo.ts and sitemap.ts when i18n is off ([#75](https://github.com/teispace/npm-packages/issues/75)) ([a99d566](https://github.com/teispace/npm-packages/commit/a99d566ee634f551679525fff129bf62fcf0f578))
16
+ * **next-maker:** sync http-client with universal/server entry split + bundle sentinel ([#77](https://github.com/teispace/npm-packages/issues/77)) ([cebc885](https://github.com/teispace/npm-packages/commit/cebc88569bbe3b65ccba9e40ea64fe8d262af908))
17
+
18
+
19
+ ### Documentation
20
+
21
+ * **next-maker:** document ws feature + http universal/server entry split ([#81](https://github.com/teispace/npm-packages/issues/81)) ([e804700](https://github.com/teispace/npm-packages/commit/e80470001ec8ca03df2182e306340de4de0d6fbd))
22
+
23
+ ## [2.0.0](https://github.com/teispace/npm-packages/compare/next-maker-v1.20.1...next-maker-v2.0.0) (2026-05-15)
24
+
25
+
26
+ ### ⚠ BREAKING CHANGES
27
+
28
+ * **next-maker:** apps generated before this release are missing shared/ and api-url.ts. Run `next-maker doctor --fix` or `next-maker setup http-client` to restore them.
29
+ * **next-maker:** services generated by `next-maker service <name>` or `next-maker service <name> --crud` now emit bare-path endpoints. Any hand-rolled endpoints in app-apis.ts that still use \`\${API_PREFIX}\` will double-prefix once the rest of the template (getApiBaseUrl) lands — strip the interpolation when migrating.
30
+ * **next-maker:** apps generated before this release are missing shared/ and api-url.ts. Run `next-maker doctor --fix` or `next-maker setup http-client` to restore them.
31
+
32
+ ### Features
33
+
34
+ * **next-maker:** emit bare-path endpoints in generated AppApis entries ([#71](https://github.com/teispace/npm-packages/issues/71)) ([0d836b3](https://github.com/teispace/npm-packages/commit/0d836b3dab9dd84dae3b04f74c4671b59e28b75b))
35
+ * **next-maker:** sync http-client setup with shared/ + api-url layout ([#70](https://github.com/teispace/npm-packages/issues/70)) ([3df79a4](https://github.com/teispace/npm-packages/commit/3df79a4c6de1698f1488311ab22f7fd80b662cdc))
36
+
37
+
38
+ ### Documentation
39
+
40
+ * **next-maker:** sync README with shared/ + api-url layout ([#72](https://github.com/teispace/npm-packages/issues/72)) ([3d64863](https://github.com/teispace/npm-packages/commit/3d648636ce1b88fa88c6f0788eb6538ea717b154))
41
+
42
+
43
+ ### Tests
44
+
45
+ * **next-maker:** cover copyHttpClientFiles and crudApiConfigTemplate ([#73](https://github.com/teispace/npm-packages/issues/73)) ([10597cf](https://github.com/teispace/npm-packages/commit/10597cfee2ec70000d79419a7f25669351caffcc))
46
+
3
47
  ## [1.20.1](https://github.com/teispace/npm-packages/compare/next-maker-v1.20.0...next-maker-v1.20.1) (2026-05-06)
4
48
 
5
49
 
package/README.md CHANGED
@@ -76,7 +76,7 @@ npx @teispace/next-maker init my-app -y --package-manager pnpm
76
76
  | HTTP client | `fetch` |
77
77
  | dark mode, redux, i18n, tests, react-compiler | ✅ on |
78
78
  | pre-commit hooks, commitizen, copy `.env` | ✅ on |
79
- | docker, GitHub Actions, bundle-analyzer, community files (CODE_OF_CONDUCT etc.) | ⏭ off |
79
+ | WebSocket (requires Redux), docker, GitHub Actions, bundle-analyzer, community files (CODE_OF_CONDUCT etc.) | ⏭ off |
80
80
 
81
81
  Anything you don't want? `next-maker remove <feature>` after init.
82
82
 
@@ -87,7 +87,7 @@ The starter at [`teispace/nextjs-starter`](https://github.com/teispace/nextjs-st
87
87
  | Section | Prompts |
88
88
  | --- | --- |
89
89
  | Identity | project name, description, author, version, support email, package manager, GitHub repo / issues / homepage |
90
- | Architecture | HTTP client (axios / fetch / both / none), dark mode, Redux Toolkit, i18n, testing, React Compiler, Bundle Analyzer |
90
+ | Architecture | HTTP client (axios / fetch / both / none), dark mode, Redux Toolkit, WebSocket (requires Redux), i18n, testing, React Compiler, Bundle Analyzer |
91
91
  | Tooling | community files (CODE_OF_CONDUCT, CONTRIBUTING, SECURITY), README, Docker, CI/CD, pre-commit hooks (Husky/Commitlint/Lint-staged), Commitizen, copy `.env.example` → `.env` |
92
92
  | Templates | keep GitHub issue/PR templates? include `react-secure-storage`? |
93
93
 
@@ -100,7 +100,8 @@ The starter at [`teispace/nextjs-starter`](https://github.com/teispace/nextjs-st
100
100
  - Pino structured logger with redaction
101
101
  - Zod-validated env schema in `src/lib/env/`
102
102
  - Feature-based DDD architecture
103
- - Result-based HTTP clients (when enabled)
103
+ - Dual HTTP clients (`fetchClient` + `axiosClient`) on a shared foundation: two entry points (`@/lib/utils/http` universal, `@/lib/utils/http/server` for Server Components), automatic `X-Request-Id` correlation, single `parseApiError` pipeline, cookie-mode auth by default, typed query params via `{ params }`. A build-time `__bundle-sentinel__` rejects future regressions of the universal/server split.
104
+ - WebSocket transport — **opt-in via the `ws` prompt** (requires Redux): typed `socket.io-client` wrapper, lazy singleton, `useWsEvent` / `useWsEmit` / `useWsStatus` hooks, Redux bridge into a dedicated (non-persisted) `wsReducer`. Cookie-mode auth by default; browser-only (SSR throws).
104
105
  - Hardened security headers in `next.config.ts`
105
106
  - `scripts/sync-env.ts` and `scripts/check-deprecated.ts` (used by the `validate` chain)
106
107
 
@@ -119,6 +120,7 @@ npx @teispace/next-maker setup [options]
119
120
  | `--http-client` | Adds the axios and/or fetch Result-based clients under `src/lib/utils/http/` |
120
121
  | `--dark-theme` | Installs `@teispace/next-themes` and adds `CustomThemeProvider` |
121
122
  | `--redux` | Redux Toolkit + `react-redux` + `redux-persist`, `StoreProvider`, `src/store` |
123
+ | `--ws` | WebSocket transport — `socket.io-client@^4.8.3`, `src/lib/utils/ws/` subtree, non-persisted `wsReducer`, `attachWsBridge` mount in `StoreProvider`. Requires `--redux` to be installed first. |
122
124
  | `--i18n` | `next-intl` + `[locale]` routing + `proxy.ts` + `RootProvider` wiring |
123
125
  | `--tests` | Vitest + React Testing Library + jsdom + `test/test-utils.tsx` |
124
126
  | `--react-compiler` | `reactCompiler: true` in `next.config.ts` + `babel-plugin-react-compiler` |
@@ -135,6 +137,7 @@ npx @teispace/next-maker setup
135
137
 
136
138
  # Specific feature
137
139
  npx @teispace/next-maker setup --redux
140
+ npx @teispace/next-maker setup --ws # adds WebSocket layer (run after --redux)
138
141
  npx @teispace/next-maker setup --security-headers
139
142
  npx @teispace/next-maker setup --validate-scripts
140
143
  ```
@@ -393,6 +396,8 @@ npx @teispace/next-maker service <name> [options]
393
396
 
394
397
  CRUD mode also generates `<Name>Summary` (list view) and `<Name>Detail` (detail view) types, `Create<Name>Dto`, `Update<Name>Dto`, and registers the endpoints in `app-apis.ts`.
395
398
 
399
+ Endpoints are emitted as **bare paths** (e.g. `'/users'`, `` `/users/${id}` ``) — the `/api/v{n}` prefix is owned by `getApiBaseUrl()` in `src/lib/config/api-url.ts` and applied at request time. Don't add `${API_PREFIX}` interpolation in `app-apis.ts`; the base URL composer handles it.
400
+
396
401
  ```bash
397
402
  npx @teispace/next-maker service payment --axios
398
403
  npx @teispace/next-maker service users --fetch --crud
@@ -745,21 +750,34 @@ my-project/
745
750
  │ │ ├── CustomThemeProvider.tsx # (opt, dark-mode) @teispace/next-themes
746
751
  │ │ └── index.ts # Barrel — `next-maker provider <name>` keeps it sorted
747
752
  │ ├── store/ # (opt, redux) makeStore, rootReducer, typed hooks
753
+ │ │ └── slices/ws.slice.ts # (opt, ws) non-persisted connection state slice
748
754
  │ ├── services/
749
755
  │ │ ├── api/ # API service barrel
750
756
  │ │ └── storage/ # react-secure-storage wrapper
751
757
  │ ├── lib/
752
- │ │ ├── config/ # seo, app-apis, app-paths, app-locales, constants
758
+ │ │ ├── config/ # seo, app-apis, app-paths, app-locales, constants, api-url (getApiBaseUrl)
753
759
  │ │ ├── env/ # Zod-validated env schema (schema.ts, validate.ts)
754
760
  │ │ ├── logger/ # Pino logger with auto-redaction
755
- │ │ ├── errors/ # ApiException, catchError
761
+ │ │ ├── errors/ # ApiException (carries requestId), catchError
756
762
  │ │ ├── enums/
757
763
  │ │ └── utils/
758
764
  │ │ ├── http/ # (opt, http-client)
765
+ │ │ │ ├── shared/ # runtime guards, request-id, parseApiError, toSearchParams
759
766
  │ │ │ ├── axios-client/ # interceptors, token refresh, Result-based
760
- │ │ │ ├── fetch-client/ # same Result pattern on native fetch
767
+ │ │ │ ├── fetch-client/ # same Result pattern on native fetch, typed `params`
768
+ │ │ │ ├── __bundle-sentinel__/ # build-time regression gate ('use client' check)
761
769
  │ │ │ ├── client-utils.ts
762
- │ │ │ └── token-store.ts
770
+ │ │ │ ├── token-store.ts # inert in cookie-mode (the default)
771
+ │ │ │ ├── index.ts # universal entry — safe in client/server/edge
772
+ │ │ │ └── server.ts # server-only entry — forwards next/headers cookies
773
+ │ │ ├── ws/ # (opt, ws) socket.io-client wrapper, hooks, Redux bridge
774
+ │ │ │ ├── client/ # WsClient + lazy `wsClient` singleton (Proxy)
775
+ │ │ │ ├── hooks/ # useWsStatus, useWsEvent, useWsEmit
776
+ │ │ │ ├── redux/ # bridge (the only WS dispatcher) + selectors
777
+ │ │ │ ├── shared/ # SSR guard, auth carrier, URL composer
778
+ │ │ │ ├── types/ # ClientToServerEvents/ServerToClientEvents, payloads
779
+ │ │ │ ├── constants.ts # namespace, heartbeat, reconnection bounds
780
+ │ │ │ └── index.ts # public barrel
763
781
  │ │ └── validations/
764
782
  │ ├── i18n/ # (opt, i18n) routing, request, navigation, translations/
765
783
  │ ├── styles/globals.css # Tailwind v4 directives
@@ -788,7 +806,7 @@ my-project/
788
806
  └── package.json
789
807
  ```
790
808
 
791
- Features that have first-class opt-out prompts during `init`: `httpClient`, `darkMode`, `redux`, `i18n`, `tests`, `reactCompiler`, `bundleAnalyzer`, `docker`, `ci`, `preCommitHooks`, `commitizen`, `communityFiles`, `readme`, `copyEnv`. Each opt-out has a matching `setup --<feature>` to re-add later. `doctor` and `remove` cover the whole installed footprint via manifests.
809
+ Features that have first-class opt-in/opt-out prompts during `init`: `httpClient`, `darkMode`, `redux`, `ws` (opt-in, requires `redux`), `i18n`, `tests`, `reactCompiler`, `bundleAnalyzer`, `docker`, `ci`, `preCommitHooks`, `commitizen`, `communityFiles`, `readme`, `copyEnv`. Each opt-out has a matching `setup --<feature>` to re-add later. `doctor` and `remove` cover the whole installed footprint via manifests.
792
810
 
793
811
  ---
794
812
 
@@ -796,7 +814,7 @@ Features that have first-class opt-out prompts during `init`: `httpClient`, `dar
796
814
 
797
815
  **CLI:** TypeScript, esbuild, Commander.js, Enquirer, Vitest, degit.
798
816
 
799
- **Generated apps:** Next.js 16+, TypeScript, Tailwind CSS v4, Biome, Pino, Zod, Redux Toolkit, `@teispace/next-themes`, next-intl, Axios, Vitest + RTL, React Compiler.
817
+ **Generated apps:** Next.js 16+, TypeScript, Tailwind CSS v4, Biome, Pino, Zod, Redux Toolkit, `@teispace/next-themes`, next-intl, Fetch / Axios HTTP clients (shared foundation), `socket.io-client` (opt-in via `ws` prompt), Vitest + RTL, React Compiler.
800
818
 
801
819
  ---
802
820
 
@@ -846,6 +864,7 @@ node ../dist/index.js test src/hooks/useDebounce.ts --force
846
864
 
847
865
  # Maintenance
848
866
  node ../dist/index.js doctor
867
+ node ../dist/index.js setup --ws # add WebSocket layer (project must already have --redux)
849
868
  node ../dist/index.js remove redux --dry-run
850
869
  ```
851
870