@bleedingdev/modern-js-create 3.2.0-ultramodern.4 → 3.2.0-ultramodern.40

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 (68) hide show
  1. package/README.md +129 -14
  2. package/dist/index.js +4745 -472
  3. package/dist/types/locale/en.d.ts +2 -0
  4. package/dist/types/locale/zh.d.ts +2 -0
  5. package/dist/types/ultramodern-workspace.d.ts +13 -0
  6. package/package.json +8 -5
  7. package/template/.agents/skills-lock.json +34 -0
  8. package/template/.github/renovate.json +53 -0
  9. package/template/.github/workflows/ultramodern-gates.yml.handlebars +34 -10
  10. package/template/.mise.toml.handlebars +2 -0
  11. package/template/AGENTS.md +27 -0
  12. package/template/README.md +115 -14
  13. package/template/api/effect/index.ts.handlebars +7 -45
  14. package/template/config/public/locales/cs/translation.json +39 -0
  15. package/template/config/public/locales/en/translation.json +39 -0
  16. package/template/modern.config.ts.handlebars +44 -23
  17. package/template/oxfmt.config.ts +8 -0
  18. package/template/oxlint.config.ts +12 -0
  19. package/template/package.json.handlebars +59 -30
  20. package/template/pnpm-workspace.yaml +26 -0
  21. package/template/rstest.config.mts +7 -0
  22. package/template/scripts/bootstrap-agent-skills.mjs +103 -0
  23. package/template/scripts/check-i18n-strings.mjs +83 -0
  24. package/template/scripts/validate-ultramodern.mjs.handlebars +438 -16
  25. package/template/shared/effect/api.ts.handlebars +1 -2
  26. package/template/src/modern-app-env.d.ts +2 -0
  27. package/template/src/modern.runtime.ts.handlebars +17 -3
  28. package/template/src/routes/[lang]/page.tsx.handlebars +210 -0
  29. package/template/src/routes/index.css.handlebars +14 -3
  30. package/template/src/routes/layout.tsx.handlebars +2 -1
  31. package/template/tests/tsconfig.json +7 -0
  32. package/template/tests/ultramodern.contract.test.ts.handlebars +78 -0
  33. package/template/tsconfig.json +106 -2
  34. package/template-workspace/.agents/agent-reference-repos.json +24 -0
  35. package/template-workspace/.agents/rstackjs-agent-skills-LICENSE +21 -0
  36. package/template-workspace/.agents/skills/rsbuild-best-practices/SKILL.md +57 -0
  37. package/template-workspace/.agents/skills/rsdoctor-analysis/SKILL.md +96 -0
  38. package/template-workspace/.agents/skills/rsdoctor-analysis/references/command-map.md +113 -0
  39. package/template-workspace/.agents/skills/rsdoctor-analysis/references/common-analysis-patterns.md +190 -0
  40. package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-common.md +88 -0
  41. package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-rspack.md +138 -0
  42. package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-webpack.md +71 -0
  43. package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor.md +39 -0
  44. package/template-workspace/.agents/skills/rsdoctor-analysis/references/rsdoctor-data-types.md +103 -0
  45. package/template-workspace/.agents/skills/rslib-best-practices/SKILL.md +58 -0
  46. package/template-workspace/.agents/skills/rslib-modern-package/SKILL.md +173 -0
  47. package/template-workspace/.agents/skills/rspack-best-practices/SKILL.md +70 -0
  48. package/template-workspace/.agents/skills/rspack-tracing/SKILL.md +75 -0
  49. package/template-workspace/.agents/skills/rspack-tracing/references/bottlenecks.md +47 -0
  50. package/template-workspace/.agents/skills/rspack-tracing/references/tracing-guide.md +38 -0
  51. package/template-workspace/.agents/skills/rspack-tracing/scripts/analyze_trace.js +184 -0
  52. package/template-workspace/.agents/skills/rstest-best-practices/SKILL.md +133 -0
  53. package/template-workspace/.agents/skills-lock.json +114 -0
  54. package/template-workspace/.github/renovate.json +29 -0
  55. package/template-workspace/.github/workflows/ultramodern-workspace-gates.yml.handlebars +54 -0
  56. package/template-workspace/.gitignore.handlebars +5 -0
  57. package/template-workspace/.mise.toml.handlebars +2 -0
  58. package/template-workspace/AGENTS.md +61 -0
  59. package/template-workspace/README.md.handlebars +26 -5
  60. package/template-workspace/oxfmt.config.ts +16 -0
  61. package/template-workspace/oxlint.config.ts +19 -0
  62. package/template-workspace/pnpm-workspace.yaml +34 -8
  63. package/template-workspace/scripts/assert-mf-types.mjs +44 -0
  64. package/template-workspace/scripts/bootstrap-agent-skills.mjs +163 -0
  65. package/template-workspace/scripts/setup-agent-reference-repos.mjs +364 -0
  66. package/template-workspace/scripts/validate-ultramodern-workspace.mjs.handlebars +755 -87
  67. package/template/biome.json +0 -41
  68. package/template/src/routes/page.tsx.handlebars +0 -119
package/README.md CHANGED
@@ -12,6 +12,37 @@
12
12
 
13
13
  Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
14
14
 
15
+ For UltraModern.js, use the BleedingDev create package. It defaults to the
16
+ canonical Tractor SuperApp workspace and published BleedingDev package aliases:
17
+
18
+ ```bash
19
+ pnpm dlx @bleedingdev/modern-js-create my-super-app
20
+ ```
21
+
22
+ The default workspace is a full-stack reference, not a visual-only commerce
23
+ boundary demo. It generates:
24
+
25
+ - `apps/shell-super-app` as the Module Federation host and topology owner.
26
+ - `apps/remotes/remote-explore` for discovery UI plus
27
+ `/explore-api/effect/explore/*`.
28
+ - `apps/remotes/remote-decide` for product selection UI plus
29
+ `/decide-api/effect/decide/*`.
30
+ - `apps/remotes/remote-checkout` for cart and checkout UI plus
31
+ `/checkout-api/effect/checkout/*`.
32
+ - `packages/shared-design-tokens` as the shared CSS token owner.
33
+ - `.modernjs/ultramodern-generated-contract.json` with MF, Effect, i18n,
34
+ federated CSS, Cloudflare, and Zephyr dependency metadata.
35
+
36
+ Validate the generated workspace before making application changes:
37
+
38
+ ```bash
39
+ cd my-super-app
40
+ mise install
41
+ mise exec -- pnpm install
42
+ mise exec -- pnpm ultramodern:check
43
+ mise exec -- pnpm build
44
+ ```
45
+
15
46
  ### Router Template
16
47
 
17
48
  You can scaffold a TanStack Router first template:
@@ -22,16 +53,17 @@ npx @modern-js/create my-app --router tanstack
22
53
 
23
54
  ### Tailwind Template
24
55
 
25
- You can scaffold Tailwind CSS v4 setup (PostCSS + starter utility classes):
56
+ Tailwind CSS v4 setup is generated by default. Disable it explicitly when you
57
+ need a plain CSS starter:
26
58
 
27
59
  ```bash
28
- npx @modern-js/create my-app --tailwind
60
+ npx @modern-js/create my-app --no-tailwind
29
61
  ```
30
62
 
31
- You can combine both options:
63
+ TanStack Router and Tailwind CSS work together without extra flags:
32
64
 
33
65
  ```bash
34
- npx @modern-js/create my-app --router tanstack --tailwind
66
+ npx @modern-js/create my-app --router tanstack
35
67
  ```
36
68
 
37
69
  ### BFF Runtime Template
@@ -58,26 +90,36 @@ Generated starters expose `presetUltramodern(...)` as the public opinionated
58
90
  config wrapper when you want the full Ultramodern setup surface in
59
91
  `modern.config.ts`.
60
92
 
61
- You can combine TanStack Router + Tailwind + Effect BFF in one command:
93
+ You can combine TanStack Router + default Tailwind + Effect BFF in one command:
62
94
 
63
95
  ```bash
64
- npx @modern-js/create my-app --router tanstack --tailwind --bff-runtime effect
96
+ npx @modern-js/create my-app --router tanstack --bff-runtime effect
65
97
  ```
66
98
 
67
99
  ### Micro Vertical Workspace Recipes
68
100
 
69
- Use the existing create flags to scaffold packages inside a Micro Vertical
70
- workspace. The shell and remotes use TanStack Router; services use Effect by
71
- default, with Hono kept as an explicit compatibility lane.
101
+ Use the workspace add flow from the UltraModern workspace root. It derives the
102
+ package path, package name, port, Module Federation name, topology entry, local
103
+ overlay, ownership entry, and root `dev:*` script from the requested name and
104
+ kind.
72
105
 
73
106
  ```bash
74
- npx @modern-js/create apps/shell --router tanstack --tailwind --workspace --sub
75
- npx @modern-js/create apps/remotes/catalog --router tanstack --tailwind --workspace --sub
76
- npx @modern-js/create apps/remotes/design-system --router tanstack --tailwind --workspace --sub
77
- npx @modern-js/create services/catalog-api --bff-runtime effect --workspace --sub
78
- npx @modern-js/create services/legacy-api --bff-runtime hono --workspace --sub
107
+ npx @modern-js/create catalog --microvertical remote
108
+ npx @modern-js/create design-system --microvertical horizontal-remote
109
+ npx @modern-js/create catalog-api --microvertical service
110
+ npx @modern-js/create catalog-contracts --microvertical shared
79
111
  ```
80
112
 
113
+ Use this decision table before adding a package:
114
+
115
+ | Need | Keep inside current vertical | Create a new vertical/package |
116
+ | --- | --- | --- |
117
+ | Route or widget changes with the same product owner, release train, and fallback behavior | Yes | No |
118
+ | Route subtree needs independent rollout, rollback, or incident ownership | No | `--microvertical remote` |
119
+ | Cross-vertical operation needs strict trace, auth, locale, and session propagation | No | `--microvertical service` |
120
+ | Design tokens, primitives, generated clients, or domain-neutral utilities | No | `--microvertical shared` |
121
+ | Feature composites or workflow state shared across verticals | No | Revisit ownership; do not hide it in `shared` |
122
+
81
123
  When a design system needs independent deployment, treat it as a horizontal
82
124
  Module Federation remote with the same topology, trust, SSR, compatibility, and
83
125
  fallback expectations as feature remotes. Otherwise shared packages should be
@@ -85,10 +127,73 @@ regular workspace packages for tokens, primitives, generated clients, or
85
127
  domain-neutral utilities. Keep feature composites and workflow logic owned by a
86
128
  shell, remote, or service package.
87
129
 
130
+ The lower-level `--router`, `--workspace`, and `--sub` flags remain available
131
+ for manual package scaffolding, but UltraModern MicroVertical additions should
132
+ prefer `--microvertical` to avoid hand-writing workspace paths and topology
133
+ metadata.
134
+
88
135
  See
89
136
  `docs/super-app-rfc-adr/WORKSPACE-0001-micro-vertical-workspace-scaffolding.md`
90
137
  for the canonical workspace topology and local orchestration model.
91
138
 
139
+ The published `@bleedingdev/modern-js-create` package is the preferred
140
+ UltraModern.js entrypoint. The lower-level `--ultramodern-*` flags remain
141
+ available for release engineering and local package-source testing, but users
142
+ should not need them for normal app creation.
143
+
144
+ ### Tractor Architecture Contracts
145
+
146
+ The generated shell owns route assembly and policy. The generated Explore,
147
+ Decide, and Checkout remotes own their own route subtree, MF exposes, Effect BFF
148
+ contract, generated client, `localisedUrls`, locale JSON, CSS layer, and
149
+ Cloudflare Worker output. The shell consumes remote UI through MF manifests and
150
+ remote APIs through generated Effect clients exported by the remote packages.
151
+
152
+ Route localization is route-owned. Each app writes
153
+ `src/routes/ultramodern-route-metadata` and passes
154
+ `ultramodernLocalisedUrls` into `@modern-js/plugin-i18n`. Locale JSON is served
155
+ from `/locales/{{lng}}/{{ns}}.json`; Czech and English routes are generated from
156
+ the route owner, not from shell rewrites.
157
+
158
+ CSS federation is explicit:
159
+
160
+ - `packages/shared-design-tokens` exports `./tokens.css` and owns
161
+ `ultramodern-shared-tokens`.
162
+ - The shell owns shell base and overlay CSS only.
163
+ - Vertical remotes own their remote CSS layer and `[data-app-id="<remote>"]`
164
+ root marker.
165
+ - Tailwind CSS v4 is configured per app through `@tailwindcss/postcss`.
166
+ - Duplicate base styles are forbidden; SSR first paint depends on shared token
167
+ CSS plus Modern/Rspack-emitted app CSS.
168
+
169
+ Version switching evidence must keep UI, Effect API, CSS, i18n JSON, and MF
170
+ manifest markers in lockstep for the same vertical version.
171
+
172
+ ### Cloudflare And Zephyr Proof
173
+
174
+ Each generated app has:
175
+
176
+ - `cloudflare:build`, `cloudflare:deploy`, `cloudflare:preview`, and
177
+ `cloudflare:proof` scripts.
178
+ - Cloudflare metadata in `.modernjs/ultramodern-generated-contract.json`.
179
+ - `zephyr:dependencies` for any consumed remotes.
180
+ - `zephyr-rspack-plugin` wired through the generated Modern.js Rspack bridge.
181
+
182
+ Public URL proof is intentionally separate from local build validation:
183
+
184
+ ```bash
185
+ ULTRAMODERN_PUBLIC_URL_REMOTE_EXPLORE=https://remote-explore.example.workers.dev \
186
+ ULTRAMODERN_PUBLIC_URL_REMOTE_DECIDE=https://remote-decide.example.workers.dev \
187
+ ULTRAMODERN_PUBLIC_URL_REMOTE_CHECKOUT=https://remote-checkout.example.workers.dev \
188
+ ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP=https://shell-super-app.example.workers.dev \
189
+ pnpm cloudflare:proof -- --require-public-urls
190
+ ```
191
+
192
+ Live Zephyr switching proof requires Zephyr credentials and public runtime,
193
+ manifest, and API URLs for v1 and v2 of Explore, Decide, and Checkout. Without
194
+ public URLs and credentials, use dry-run evidence only; do not claim live
195
+ Zephyr selection has been proven.
196
+
92
197
  ### Local Monorepo Testing
93
198
 
94
199
  When testing unreleased Modern.js packages from a local monorepo checkout, use
@@ -98,6 +203,16 @@ workspace protocol dependencies:
98
203
  npx @modern-js/create my-app --router tanstack --bff-runtime effect --workspace
99
204
  ```
100
205
 
206
+ For package-source validation of the full Tractor workspace, generate with the
207
+ workspace package source, then run the generated contract gate:
208
+
209
+ ```bash
210
+ npx @modern-js/create tractor-super-app --workspace
211
+ cd tractor-super-app
212
+ mise exec -- pnpm install
213
+ mise exec -- pnpm ultramodern:check
214
+ ```
215
+
101
216
  ## Documentation
102
217
 
103
218
  - [English Documentation](https://modernjs.dev/en/)