@teispace/next-maker 2.0.0 → 2.1.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 (36) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +42 -7
  3. package/dist/index.js +342 -200
  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 +10 -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/manifests/http-client.manifest.d.ts.map +1 -1
  11. package/dist/src/manifests/index.d.ts +2 -1
  12. package/dist/src/manifests/index.d.ts.map +1 -1
  13. package/dist/src/manifests/ws.manifest.d.ts +3 -0
  14. package/dist/src/manifests/ws.manifest.d.ts.map +1 -0
  15. package/dist/src/prompts/create-app.prompt.d.ts +6 -0
  16. package/dist/src/prompts/create-app.prompt.d.ts.map +1 -1
  17. package/dist/src/services/init/cleanup/http.cleanup.d.ts.map +1 -1
  18. package/dist/src/services/init/cleanup/index.d.ts.map +1 -1
  19. package/dist/src/services/init/cleanup/seo.cleanup.d.ts +15 -0
  20. package/dist/src/services/init/cleanup/seo.cleanup.d.ts.map +1 -0
  21. package/dist/src/services/init/cleanup/ws.cleanup.d.ts +15 -0
  22. package/dist/src/services/init/cleanup/ws.cleanup.d.ts.map +1 -0
  23. package/dist/src/services/init/providers.service.d.ts.map +1 -1
  24. package/dist/src/services/setup/http-client/assets.d.ts.map +1 -1
  25. package/dist/src/services/setup/http-client/index.d.ts.map +1 -1
  26. package/dist/src/services/setup/http-client/injectors.d.ts +72 -0
  27. package/dist/src/services/setup/http-client/injectors.d.ts.map +1 -1
  28. package/dist/src/services/setup/ws/assets.d.ts +21 -0
  29. package/dist/src/services/setup/ws/assets.d.ts.map +1 -0
  30. package/dist/src/services/setup/ws/checks.d.ts +18 -0
  31. package/dist/src/services/setup/ws/checks.d.ts.map +1 -0
  32. package/dist/src/services/setup/ws/index.d.ts +21 -0
  33. package/dist/src/services/setup/ws/index.d.ts.map +1 -0
  34. package/dist/src/services/setup/ws/injectors.d.ts +57 -0
  35. package/dist/src/services/setup/ws/injectors.d.ts.map +1 -0
  36. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.1](https://github.com/teispace/npm-packages/compare/next-maker-v2.1.0...next-maker-v2.1.1) (2026-05-15)
4
+
5
+
6
+ ### Documentation
7
+
8
+ * **next-maker:** add Recent changes + Known issues sections ([#82](https://github.com/teispace/npm-packages/issues/82)) ([069006a](https://github.com/teispace/npm-packages/commit/069006a858e13c3ffaf821ea9d10e8d32f0ecddd))
9
+
10
+ ## [2.1.0](https://github.com/teispace/npm-packages/compare/next-maker-v2.0.0...next-maker-v2.1.0) (2026-05-15)
11
+
12
+
13
+ ### Features
14
+
15
+ * **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))
16
+ * **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))
17
+ * **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))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **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))
23
+ * **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))
24
+
25
+
26
+ ### Documentation
27
+
28
+ * **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))
29
+
3
30
  ## [2.0.0](https://github.com/teispace/npm-packages/compare/next-maker-v1.20.1...next-maker-v2.0.0) (2026-05-15)
4
31
 
5
32
 
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
- - Dual HTTP clients (`fetchClient` + `axiosClient`) on a shared foundation: runtime-aware cookie forwarding (browser jar in CSR, `next/headers` injection in RSC), automatic `X-Request-Id` correlation, single `parseApiError` pipeline, cookie-mode auth by default, typed query params via `{ params }`
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
  ```
@@ -747,6 +750,7 @@ my-project/
747
750
  │ │ ├── CustomThemeProvider.tsx # (opt, dark-mode) @teispace/next-themes
748
751
  │ │ └── index.ts # Barrel — `next-maker provider <name>` keeps it sorted
749
752
  │ ├── store/ # (opt, redux) makeStore, rootReducer, typed hooks
753
+ │ │ └── slices/ws.slice.ts # (opt, ws) non-persisted connection state slice
750
754
  │ ├── services/
751
755
  │ │ ├── api/ # API service barrel
752
756
  │ │ └── storage/ # react-secure-storage wrapper
@@ -758,11 +762,22 @@ my-project/
758
762
  │ │ ├── enums/
759
763
  │ │ └── utils/
760
764
  │ │ ├── http/ # (opt, http-client)
761
- │ │ │ ├── shared/ # runtime detection, cookie injection, request-id, parseApiError, toSearchParams
765
+ │ │ │ ├── shared/ # runtime guards, request-id, parseApiError, toSearchParams
762
766
  │ │ │ ├── axios-client/ # interceptors, token refresh, Result-based
763
767
  │ │ │ ├── fetch-client/ # same Result pattern on native fetch, typed `params`
768
+ │ │ │ ├── __bundle-sentinel__/ # build-time regression gate ('use client' check)
764
769
  │ │ │ ├── client-utils.ts
765
- │ │ │ └── token-store.ts # inert in cookie-mode (the default)
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
766
781
  │ │ └── validations/
767
782
  │ ├── i18n/ # (opt, i18n) routing, request, navigation, translations/
768
783
  │ ├── styles/globals.css # Tailwind v4 directives
@@ -791,7 +806,7 @@ my-project/
791
806
  └── package.json
792
807
  ```
793
808
 
794
- 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.
795
810
 
796
811
  ---
797
812
 
@@ -799,7 +814,26 @@ Features that have first-class opt-out prompts during `init`: `httpClient`, `dar
799
814
 
800
815
  **CLI:** TypeScript, esbuild, Commander.js, Enquirer, Vitest, degit.
801
816
 
802
- **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), 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.
818
+
819
+ ---
820
+
821
+ ## Recent changes
822
+
823
+ Behaviour added in **v2.1.0** beyond the headline features. None of these change the user-facing CLI surface — they harden parts of the generated app that previously needed manual cleanup.
824
+
825
+ - **HTTP sentinel + server entry auto-align.** The template ships `src/lib/utils/http/__bundle-sentinel__/client-bundle-sentinel.tsx` and `src/lib/utils/http/server.ts` with imports of **both** axios and fetch client modules. When you pick a single client (at `init` or via `setup --http-client`), the inactive variant's directory is removed — and the two files would normally still reference it, breaking `yarn build`. Both are now rewritten in place to mention only the active client(s). Idempotent: re-running `setup --http-client` against the same configuration is a no-op.
826
+ - **`remove ws` strips cleanly without manual intervention.** The WS manifest's reducer-registration and bridge-mount injections now carry `removePattern` functions, so `next-maker remove ws` deletes the `wsReducer` import, the `ws: wsReducer` entry, the unwrapped-on-purpose JSDoc, and the `attachWsBridge` `useEffect` block — without any "manual cleanup" messages. The init-time `cleanupWs` and the `remove ws` flow share the same pure helpers, so the byte-level output is identical.
827
+ - **`useEffect` import auto-pruned.** When the WS bridge effect is stripped (init opt-out or `remove ws`), the `useEffect` import is dropped from `StoreProvider.tsx`'s React import line if no other `useEffect(` calls remain — avoiding the unused-import lint warning.
828
+ - **Wording-tolerant strip helpers.** The `stripBundleSentinel`, `stripBridgeMount`, and `stripWsReducerRegistration` helpers now anchor on stable code tokens (import paths, function names, the `ws` + `persistReducer` keywords inside JSDoc) rather than literal comment text. Upstream template comment rewording can't silently break cleanup.
829
+ - **`doctor` reports sentinel mount drift.** The HTTP manifest tracks the `<HttpClientBundleSentinel />` mount as a code injection in either `[locale]/layout.tsx` or `src/app/layout.tsx`. If you delete the mount manually, `doctor` reports it; `remove http-client` strips it.
830
+
831
+ ---
832
+
833
+ ## Known issues
834
+
835
+ - **`setup --redux` post-init when `ws` was opted out.** The template's `StoreProvider.tsx` ships with the WS bridge mount inline. `next-maker setup --redux` copies the template's `StoreProvider.tsx` wholesale into the project — so running it on a project where `ws` is **not** wanted leaves `import { attachWsBridge, wsClient } from '@/lib/utils/ws'` in place, and `yarn build` fails because that module doesn't exist. Workaround until a fix lands: also run `next-maker setup --ws` to install the WS layer, then `next-maker remove ws` if you don't actually want it (clean removal handles both layers). Tracked separately; out of scope for v2.1.0.
836
+ - **`doctor --fix` is interactive.** Some setup services (notably `setup --http-client`) prompt for an action when the feature is partially installed. `doctor --fix` invokes `apply()` directly, so the prompt fires during what's meant to be a non-interactive repair. Workaround: run the specific `setup --<feature>` manually and pick the appropriate action. A non-interactive repair path is on the roadmap.
803
837
 
804
838
  ---
805
839
 
@@ -849,6 +883,7 @@ node ../dist/index.js test src/hooks/useDebounce.ts --force
849
883
 
850
884
  # Maintenance
851
885
  node ../dist/index.js doctor
886
+ node ../dist/index.js setup --ws # add WebSocket layer (project must already have --redux)
852
887
  node ../dist/index.js remove redux --dry-run
853
888
  ```
854
889