@bleedingdev/modern-js-create 3.2.0-ultramodern.1 → 3.2.0-ultramodern.100

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 (74) hide show
  1. package/README.md +161 -32
  2. package/bin/run.js +0 -0
  3. package/dist/index.js +5105 -770
  4. package/dist/types/locale/en.d.ts +3 -0
  5. package/dist/types/locale/zh.d.ts +3 -0
  6. package/dist/types/ultramodern-workspace.d.ts +11 -0
  7. package/package.json +8 -5
  8. package/template/.agents/skills-lock.json +34 -0
  9. package/template/.codex/hooks.json +16 -0
  10. package/template/.github/renovate.json +53 -0
  11. package/template/.github/workflows/ultramodern-gates.yml.handlebars +34 -10
  12. package/template/.mise.toml.handlebars +2 -0
  13. package/template/AGENTS.md +23 -0
  14. package/template/README.md +60 -34
  15. package/template/api/effect/index.ts.handlebars +14 -41
  16. package/template/api/lambda/hello.ts.handlebars +5 -5
  17. package/template/config/public/locales/cs/translation.json +39 -0
  18. package/template/config/public/locales/en/translation.json +39 -0
  19. package/template/lefthook.yml +10 -0
  20. package/template/modern.config.ts.handlebars +45 -23
  21. package/template/oxfmt.config.ts +15 -0
  22. package/template/oxlint.config.ts +19 -0
  23. package/template/package.json.handlebars +50 -31
  24. package/template/pnpm-workspace.yaml +29 -0
  25. package/template/rstest.config.mts +5 -0
  26. package/template/scripts/bootstrap-agent-skills.mjs +228 -0
  27. package/template/scripts/check-i18n-strings.mjs +94 -0
  28. package/template/scripts/validate-ultramodern.mjs.handlebars +453 -17
  29. package/template/shared/effect/api.ts.handlebars +1 -2
  30. package/template/src/modern-app-env.d.ts +2 -0
  31. package/template/src/modern.runtime.ts.handlebars +17 -3
  32. package/template/src/routes/[lang]/page.tsx.handlebars +211 -0
  33. package/template/src/routes/index.css.handlebars +14 -3
  34. package/template/src/routes/layout.tsx.handlebars +2 -1
  35. package/template/tailwind.config.ts.handlebars +1 -1
  36. package/template/tests/tsconfig.json +7 -0
  37. package/template/tests/ultramodern.contract.test.ts.handlebars +78 -0
  38. package/template/tsconfig.json +107 -2
  39. package/template-workspace/.agents/agent-reference-repos.json +24 -0
  40. package/template-workspace/.agents/rstackjs-agent-skills-LICENSE +21 -0
  41. package/template-workspace/.agents/skills/rsbuild-best-practices/SKILL.md +57 -0
  42. package/template-workspace/.agents/skills/rsdoctor-analysis/SKILL.md +96 -0
  43. package/template-workspace/.agents/skills/rsdoctor-analysis/references/command-map.md +113 -0
  44. package/template-workspace/.agents/skills/rsdoctor-analysis/references/common-analysis-patterns.md +190 -0
  45. package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-common.md +88 -0
  46. package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-rspack.md +138 -0
  47. package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-webpack.md +71 -0
  48. package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor.md +39 -0
  49. package/template-workspace/.agents/skills/rsdoctor-analysis/references/rsdoctor-data-types.md +103 -0
  50. package/template-workspace/.agents/skills/rslib-best-practices/SKILL.md +58 -0
  51. package/template-workspace/.agents/skills/rslib-modern-package/SKILL.md +173 -0
  52. package/template-workspace/.agents/skills/rspack-best-practices/SKILL.md +70 -0
  53. package/template-workspace/.agents/skills/rspack-tracing/SKILL.md +75 -0
  54. package/template-workspace/.agents/skills/rspack-tracing/references/bottlenecks.md +47 -0
  55. package/template-workspace/.agents/skills/rspack-tracing/references/tracing-guide.md +38 -0
  56. package/template-workspace/.agents/skills/rspack-tracing/scripts/analyze_trace.js +184 -0
  57. package/template-workspace/.agents/skills/rstest-best-practices/SKILL.md +133 -0
  58. package/template-workspace/.agents/skills-lock.json +114 -0
  59. package/template-workspace/.codex/hooks.json +16 -0
  60. package/template-workspace/.github/renovate.json +29 -0
  61. package/template-workspace/.github/workflows/ultramodern-workspace-gates.yml.handlebars +54 -0
  62. package/template-workspace/.gitignore.handlebars +5 -0
  63. package/template-workspace/.mise.toml.handlebars +2 -0
  64. package/template-workspace/AGENTS.md +76 -0
  65. package/template-workspace/README.md.handlebars +61 -11
  66. package/template-workspace/lefthook.yml +10 -0
  67. package/template-workspace/oxfmt.config.ts +17 -0
  68. package/template-workspace/oxlint.config.ts +20 -0
  69. package/template-workspace/pnpm-workspace.yaml +32 -2
  70. package/template-workspace/scripts/bootstrap-agent-skills.mjs +264 -0
  71. package/template-workspace/scripts/setup-agent-reference-repos.mjs +368 -0
  72. package/template/biome.json +0 -41
  73. package/template/src/routes/page.tsx.handlebars +0 -119
  74. package/template-workspace/scripts/validate-ultramodern-workspace.mjs.handlebars +0 -276
package/README.md CHANGED
@@ -12,90 +12,219 @@
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
- ### Router Template
15
+ For UltraModern.js, use the BleedingDev create package. It defaults to a
16
+ production-ready single app with `presetUltramodern(...)`, TanStack Router,
17
+ Tailwind CSS v4, i18n, Effect BFF, generated quality gates, and published
18
+ BleedingDev package aliases:
16
19
 
17
- You can scaffold a TanStack Router first template:
20
+ ```bash
21
+ pnpm dlx @bleedingdev/modern-js-create my-app
22
+ ```
23
+
24
+ To initialize the empty directory you are already in, pass `.` explicitly:
18
25
 
19
26
  ```bash
20
- npx @modern-js/create my-app --router tanstack
27
+ pnpm dlx @bleedingdev/modern-js-create .
21
28
  ```
22
29
 
23
- ### Tailwind Template
30
+ The default is the full UltraModern single-app setup. Create a SuperApp
31
+ workspace explicitly when you need independently owned verticals:
32
+
33
+ ```bash
34
+ pnpm dlx @bleedingdev/modern-js-create my-super-app --ultramodern-workspace
35
+ ```
36
+
37
+ The workspace starts shell-only so the first commit has no fake business
38
+ domains to delete. It generates:
24
39
 
25
- You can scaffold Tailwind CSS v4 setup (PostCSS + starter utility classes):
40
+ - `apps/shell-super-app` as the Module Federation host and topology owner.
41
+ - `verticals/*` empty until you add a real domain with `--vertical`.
42
+ - `packages/shared-*` placeholders for shared contracts, tokens, and API
43
+ support.
44
+ - `.modernjs/ultramodern-generated-contract.json` with MF, Effect, i18n,
45
+ federated CSS, Cloudflare, and Zephyr dependency metadata.
46
+
47
+ Validate the generated workspace before making application changes:
26
48
 
27
49
  ```bash
28
- npx @modern-js/create my-app --tailwind
50
+ cd my-super-app
51
+ mise install
52
+ pnpm install
53
+ pnpm check
54
+ pnpm build
29
55
  ```
30
56
 
31
- You can combine both options:
57
+ ### Router Template
58
+
59
+ TanStack Router is generated by default. Choose React Router only as an explicit
60
+ compatibility lane:
32
61
 
33
62
  ```bash
34
- npx @modern-js/create my-app --router tanstack --tailwind
63
+ pnpm dlx @bleedingdev/modern-js-create my-app --router react-router
35
64
  ```
36
65
 
37
- ### BFF Runtime Template
66
+ ### Tailwind Template
38
67
 
39
- You can scaffold BFF APIs with the current default runtime:
68
+ Tailwind CSS v4 setup is generated by default. Disable it explicitly when you
69
+ need a plain CSS starter:
40
70
 
41
71
  ```bash
42
- npx @modern-js/create my-app --bff
72
+ pnpm dlx @bleedingdev/modern-js-create my-app --no-tailwind
43
73
  ```
44
74
 
45
- You can explicitly scaffold Effect HttpApi runtime for BFF:
75
+ TanStack Router and Tailwind CSS work together without extra flags:
46
76
 
47
77
  ```bash
48
- npx @modern-js/create my-app --bff-runtime effect
78
+ pnpm dlx @bleedingdev/modern-js-create my-app
79
+ ```
80
+
81
+ ### BFF Runtime Template
82
+
83
+ UltraModern app scaffolds include Effect HttpApi BFF by default:
84
+
85
+ ```bash
86
+ pnpm dlx @bleedingdev/modern-js-create my-app
49
87
  ```
50
88
 
51
89
  To scaffold Hono runtime explicitly:
52
90
 
53
91
  ```bash
54
- npx @modern-js/create my-app --bff-runtime hono
92
+ pnpm dlx @bleedingdev/modern-js-create my-app --bff-runtime hono
55
93
  ```
56
94
 
57
95
  Generated starters expose `presetUltramodern(...)` as the public opinionated
58
96
  config wrapper when you want the full Ultramodern setup surface in
59
97
  `modern.config.ts`.
60
98
 
61
- You can combine TanStack Router + Tailwind + Effect BFF in one command:
99
+ TanStack Router, default Tailwind, and Effect BFF are included without extra
100
+ flags. For local monorepo dependency testing, add `--workspace`:
62
101
 
63
102
  ```bash
64
- npx @modern-js/create my-app --router tanstack --tailwind --bff-runtime effect
103
+ pnpm dlx @bleedingdev/modern-js-create my-app --workspace
65
104
  ```
66
105
 
67
- ### Micro Vertical Workspace Recipes
106
+ ### Vertical Workspace Recipes
68
107
 
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.
108
+ Use the workspace add flow from the UltraModern workspace root. It derives the
109
+ package path, package name, port, Module Federation name, topology entry, local
110
+ overlay, ownership entry, Effect BFF surface, and root `dev:*` script from the
111
+ requested vertical name.
72
112
 
73
113
  ```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
114
+ pnpm dlx @bleedingdev/modern-js-create catalog --vertical
79
115
  ```
80
116
 
81
- When a design system needs independent deployment, treat it as a horizontal
82
- Module Federation remote with the same topology, trust, SSR, compatibility, and
83
- fallback expectations as feature remotes. Otherwise shared packages should be
84
- regular workspace packages for tokens, primitives, generated clients, or
85
- domain-neutral utilities. Keep feature composites and workflow logic owned by a
86
- shell, remote, or service package.
117
+ Use this decision table before adding a vertical:
118
+
119
+ | Need | Keep inside current vertical | Create a new vertical |
120
+ | --- | --- | --- |
121
+ | Route or widget changes with the same product owner, release train, and fallback behavior | Yes | No |
122
+ | Route subtree needs independent rollout, rollback, or incident ownership | No | `--vertical` |
123
+ | UI and Effect BFF must version, deploy, and roll back together | No | `--vertical` |
124
+ | Design tokens, primitives, generated clients, or domain-neutral utilities | Yes | Use an ordinary workspace package, not a vertical |
125
+ | Feature composites or workflow state shared across verticals | No | Revisit ownership; do not hide it in shared code |
126
+
127
+ The lower-level `--router react-router`, `--workspace`, and `--sub` flags remain
128
+ available for compatibility and local package scaffolding, but UltraModern
129
+ vertical additions should use `--vertical` so paths, topology, Effect BFF
130
+ contracts, and local overlays stay consistent.
87
131
 
88
132
  See
89
133
  `docs/super-app-rfc-adr/WORKSPACE-0001-micro-vertical-workspace-scaffolding.md`
90
134
  for the canonical workspace topology and local orchestration model.
91
135
 
136
+ The published `@bleedingdev/modern-js-create` package is the preferred
137
+ UltraModern.js entrypoint. The lower-level `--ultramodern-*` flags remain
138
+ available for release engineering and local package-source testing, but users
139
+ should not need them for normal app creation.
140
+
141
+ ### SuperApp Architecture Contracts
142
+
143
+ The generated shell owns route assembly and policy. Each vertical added with
144
+ `--vertical` owns its route subtree, MF exposes, Effect BFF contract, generated
145
+ client, `localisedUrls`, locale JSON, CSS layer, and Cloudflare Worker output.
146
+ The shell consumes vertical UI through MF manifests and vertical APIs through
147
+ generated Effect clients exported by the vertical packages.
148
+
149
+ Route localization is route-owned. Each app writes
150
+ `src/routes/ultramodern-route-metadata` and passes
151
+ `ultramodernLocalisedUrls` into `@modern-js/plugin-i18n`. Locale JSON is served
152
+ from `/locales/{{lng}}/{{ns}}.json`; Czech and English routes are generated from
153
+ the route owner, not from shell rewrites.
154
+
155
+ CSS federation is explicit:
156
+
157
+ - `packages/shared-design-tokens` exports `./tokens.css` and owns
158
+ `ultramodern-shared-tokens`.
159
+ - The shell owns shell base and overlay CSS only.
160
+ - Verticals own their vertical CSS layer and `[data-app-id="<vertical>"]`
161
+ root marker.
162
+ - Tailwind CSS v4 is configured per app through `@tailwindcss/postcss`.
163
+ - Duplicate base styles are forbidden; SSR first paint depends on shared token
164
+ CSS plus Modern/Rspack-emitted app CSS.
165
+ - Apps should not inject remote `async-index.css` paths, hardcode remote
166
+ stylesheet links, or disable filename hashing to make CSS URLs predictable.
167
+ UltraModern SSR resolves federated CSS from build output and MF manifests so
168
+ generated shells and demos can keep normal hashed assets.
169
+
170
+ Version switching evidence must keep UI, Effect API, CSS, i18n JSON, and MF
171
+ manifest markers in lockstep for the same vertical version.
172
+
173
+ ### Cloudflare And Zephyr Proof
174
+
175
+ Each generated workspace app has:
176
+
177
+ - `cloudflare:build`, `cloudflare:deploy`, `cloudflare:preview`, and
178
+ `cloudflare:proof` scripts.
179
+ - Cloudflare metadata in `.modernjs/ultramodern-generated-contract.json`.
180
+ - `zephyr:dependencies` for any consumed verticals.
181
+ - `zephyr-rspack-plugin` wired through the generated Modern.js Rspack bridge.
182
+
183
+ Deploy first, then pass each deployed app's generated public URL env key into
184
+ the proof step. Shell-only workspaces only need the shell URL; added verticals
185
+ use the same `ULTRAMODERN_PUBLIC_URL_<APP_ID>` pattern with hyphens converted
186
+ to underscores and uppercased:
187
+
188
+ ```bash
189
+ pnpm cloudflare:deploy
190
+ ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP=https://shell-super-app.example.workers.dev \
191
+ ULTRAMODERN_PUBLIC_URL_TRANSPORTATION=https://transportation.example.workers.dev \
192
+ pnpm cloudflare:proof -- --require-public-urls
193
+ ```
194
+
195
+ Without public URLs and credentials, use local `pnpm check` and `pnpm build`
196
+ evidence only; do not claim live Cloudflare or Zephyr selection has been
197
+ proven.
198
+
199
+ ### Troubleshooting
200
+
201
+ | Symptom | Current check | Owner |
202
+ | --- | --- | --- |
203
+ | Package cohort mismatch | Regenerate with one package source strategy, run `mise install`, then rerun `pnpm install` from the activated shell. | Generated workspace package source metadata |
204
+ | Install failure | Check the active Node/pnpm from `mise install`; rerun `pnpm install` after the shell sees the pinned versions. | Toolchain setup |
205
+ | Build failure | Run `pnpm check` before `pnpm build`; fix reported format, lint, type, skill, i18n, or generated-contract failures first. | Owning package or generated contract |
206
+ | Missing public URL | Set the env key from `.modernjs/ultramodern-generated-contract.json`, for example `ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP`. | Deployment operator |
207
+ | Cloudflare credentials | Confirm Wrangler credentials before `pnpm cloudflare:deploy`; local checks do not prove live Worker access. | Deployment operator |
208
+ | Asset or CSS 404 | Rebuild with `pnpm build` or `pnpm cloudflare:deploy` and inspect emitted Modern/Rspack asset paths instead of hardcoding CSS URLs. | Framework/runtime asset pipeline |
209
+ | Federation manifest failure | Run the shell and vertical build scripts, then check each deployed `/mf-manifest.json` URL used by the shell. | Module Federation owner |
210
+
92
211
  ### Local Monorepo Testing
93
212
 
94
213
  When testing unreleased Modern.js packages from a local monorepo checkout, use
95
214
  workspace protocol dependencies:
96
215
 
97
216
  ```bash
98
- npx @modern-js/create my-app --router tanstack --bff-runtime effect --workspace
217
+ pnpm dlx @bleedingdev/modern-js-create my-app --workspace
218
+ ```
219
+
220
+ For package-source validation of the full SuperApp workspace, generate with the
221
+ workspace package source, then run the generated contract gate:
222
+
223
+ ```bash
224
+ pnpm dlx @bleedingdev/modern-js-create my-super-app --ultramodern-workspace --ultramodern-package-source workspace
225
+ cd my-super-app
226
+ pnpm install
227
+ pnpm check
99
228
  ```
100
229
 
101
230
  ## Documentation
package/bin/run.js CHANGED
File without changes