@bleedingdev/modern-js-create 3.4.0-ultramodern.9 → 3.5.0-ultramodern.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.
- package/README.md +49 -23
- package/dist/cjs/index.cjs +37 -4
- package/dist/cjs/locale/en.cjs +12 -2
- package/dist/cjs/locale/zh.cjs +12 -2
- package/dist/cjs/ultramodern-tooling/commands.cjs +431 -0
- package/dist/cjs/ultramodern-tooling/config.cjs +172 -0
- package/dist/cjs/ultramodern-workspace/add-vertical.cjs +87 -75
- package/dist/cjs/ultramodern-workspace/{effect-api.cjs → api.cjs} +207 -208
- package/dist/cjs/ultramodern-workspace/bridge-config.cjs +327 -0
- package/dist/cjs/ultramodern-workspace/codesmith.cjs +1 -0
- package/dist/cjs/ultramodern-workspace/contracts.cjs +128 -657
- package/dist/cjs/ultramodern-workspace/demo-components.cjs +12 -12
- package/dist/cjs/ultramodern-workspace/descriptors.cjs +25 -25
- package/dist/cjs/ultramodern-workspace/fs-io.cjs +117 -0
- package/dist/cjs/ultramodern-workspace/generation-result.cjs +5 -5
- package/dist/cjs/ultramodern-workspace/index.cjs +4 -0
- package/dist/cjs/ultramodern-workspace/mf-validation.cjs +571 -0
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +39 -12
- package/dist/cjs/ultramodern-workspace/overlays.cjs +2 -2
- package/dist/cjs/ultramodern-workspace/package-json.cjs +58 -41
- package/dist/cjs/ultramodern-workspace/policy.cjs +4 -4
- package/dist/cjs/ultramodern-workspace/public-api.cjs +4 -0
- package/dist/cjs/ultramodern-workspace/public-surface.cjs +2 -2
- package/dist/cjs/ultramodern-workspace/versions.cjs +15 -0
- package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +120 -50
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +64 -21
- package/dist/esm/index.js +37 -4
- package/dist/esm/locale/en.js +12 -2
- package/dist/esm/locale/zh.js +12 -2
- package/dist/esm/ultramodern-tooling/commands.js +378 -0
- package/dist/esm/ultramodern-tooling/config.js +120 -0
- package/dist/esm/ultramodern-workspace/add-vertical.js +88 -79
- package/dist/esm/ultramodern-workspace/{effect-api.js → api.js} +146 -147
- package/dist/esm/ultramodern-workspace/bridge-config.js +270 -0
- package/dist/esm/ultramodern-workspace/codesmith.js +1 -0
- package/dist/esm/ultramodern-workspace/contracts.js +130 -611
- package/dist/esm/ultramodern-workspace/demo-components.js +13 -13
- package/dist/esm/ultramodern-workspace/descriptors.js +11 -11
- package/dist/esm/ultramodern-workspace/fs-io.js +116 -2
- package/dist/esm/ultramodern-workspace/generation-result.js +6 -6
- package/dist/esm/ultramodern-workspace/index.js +1 -0
- package/dist/esm/ultramodern-workspace/mf-validation.js +516 -0
- package/dist/esm/ultramodern-workspace/module-federation.js +40 -13
- package/dist/esm/ultramodern-workspace/overlays.js +2 -2
- package/dist/esm/ultramodern-workspace/package-json.js +57 -40
- package/dist/esm/ultramodern-workspace/policy.js +5 -5
- package/dist/esm/ultramodern-workspace/public-api.js +1 -0
- package/dist/esm/ultramodern-workspace/public-surface.js +2 -2
- package/dist/esm/ultramodern-workspace/versions.js +7 -1
- package/dist/esm/ultramodern-workspace/workspace-scripts.js +108 -34
- package/dist/esm/ultramodern-workspace/write-workspace.js +66 -26
- package/dist/esm-node/index.js +37 -4
- package/dist/esm-node/locale/en.js +12 -2
- package/dist/esm-node/locale/zh.js +12 -2
- package/dist/esm-node/ultramodern-tooling/commands.js +379 -0
- package/dist/esm-node/ultramodern-tooling/config.js +121 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical.js +88 -79
- package/dist/esm-node/ultramodern-workspace/{effect-api.js → api.js} +146 -147
- package/dist/esm-node/ultramodern-workspace/bridge-config.js +271 -0
- package/dist/esm-node/ultramodern-workspace/codesmith.js +1 -0
- package/dist/esm-node/ultramodern-workspace/contracts.js +130 -611
- package/dist/esm-node/ultramodern-workspace/demo-components.js +13 -13
- package/dist/esm-node/ultramodern-workspace/descriptors.js +11 -11
- package/dist/esm-node/ultramodern-workspace/fs-io.js +116 -2
- package/dist/esm-node/ultramodern-workspace/generation-result.js +6 -6
- package/dist/esm-node/ultramodern-workspace/index.js +1 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation.js +517 -0
- package/dist/esm-node/ultramodern-workspace/module-federation.js +40 -13
- package/dist/esm-node/ultramodern-workspace/overlays.js +2 -2
- package/dist/esm-node/ultramodern-workspace/package-json.js +57 -40
- package/dist/esm-node/ultramodern-workspace/policy.js +5 -5
- package/dist/esm-node/ultramodern-workspace/public-api.js +1 -0
- package/dist/esm-node/ultramodern-workspace/public-surface.js +2 -2
- package/dist/esm-node/ultramodern-workspace/versions.js +7 -1
- package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +108 -34
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +66 -26
- package/dist/types/locale/en.d.ts +10 -0
- package/dist/types/locale/index.d.ts +20 -0
- package/dist/types/locale/zh.d.ts +10 -0
- package/dist/types/ultramodern-tooling/commands.d.ts +1 -0
- package/dist/types/ultramodern-tooling/config.d.ts +43 -0
- package/dist/types/ultramodern-workspace/add-vertical.d.ts +5 -2
- package/dist/types/ultramodern-workspace/api.d.ts +73 -0
- package/dist/types/ultramodern-workspace/bridge-config.d.ts +64 -0
- package/dist/types/ultramodern-workspace/codesmith.d.ts +1 -0
- package/dist/types/ultramodern-workspace/contracts.d.ts +2 -17
- package/dist/types/ultramodern-workspace/descriptors.d.ts +10 -10
- package/dist/types/ultramodern-workspace/fs-io.d.ts +1 -0
- package/dist/types/ultramodern-workspace/index.d.ts +2 -0
- package/dist/types/ultramodern-workspace/mf-validation.d.ts +27 -0
- package/dist/types/ultramodern-workspace/package-json.d.ts +5 -4
- package/dist/types/ultramodern-workspace/public-api.d.ts +2 -0
- package/dist/types/ultramodern-workspace/types.d.ts +9 -7
- package/dist/types/ultramodern-workspace/versions.d.ts +6 -0
- package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +2 -7
- package/dist/types/ultramodern-workspace/write-workspace.d.ts +4 -2
- package/package.json +5 -3
- package/template-workspace/{.agents → .codex}/skills-lock.json +12 -12
- package/template-workspace/.github/workflows/ultramodern-workspace-gates.yml.handlebars +2 -0
- package/template-workspace/.gitignore.handlebars +3 -0
- package/template-workspace/AGENTS.md.handlebars +11 -5
- package/template-workspace/README.md.handlebars +55 -13
- package/template-workspace/oxfmt.config.ts +1 -0
- package/template-workspace/oxlint.config.ts +1 -0
- package/template-workspace/patches/@tanstack__router-core@1.171.13.patch +51 -0
- package/template-workspace/pnpm-workspace.yaml.handlebars +7 -0
- package/template-workspace/scripts/bootstrap-agent-skills.mjs +77 -67
- package/templates/workspace-scripts/assert-mf-types.mjs.handlebars +51 -8
- package/templates/workspace-scripts/check-ultramodern-api-boundaries.mts +366 -0
- package/templates/workspace-scripts/{check-ultramodern-i18n-boundaries.mjs → check-ultramodern-i18n-boundaries.mts} +1 -1
- package/templates/workspace-scripts/generate-public-surface-assets.mjs +246 -9
- package/templates/workspace-scripts/proof-cloudflare-version.mjs +277 -9
- package/templates/workspace-scripts/ultramodern-cloudflare-proof.mjs +35 -10
- package/templates/workspace-scripts/ultramodern-performance-readiness.mjs +165 -2
- package/templates/workspace-scripts/ultramodern-typecheck.mjs +4 -2
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +842 -84
- package/dist/types/ultramodern-workspace/effect-api.d.ts +0 -73
- /package/template-workspace/{.agents → .codex}/rstackjs-agent-skills-LICENSE +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsbuild-best-practices/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/command-map.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/common-analysis-patterns.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-common.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-rspack.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-webpack.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/rsdoctor-data-types.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rslib-best-practices/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rslib-modern-package/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-best-practices/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/references/bottlenecks.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/references/tracing-guide.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/scripts/analyze_trace.js +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rstest-best-practices/SKILL.md +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { WORKSPACE_PACKAGE_VERSION, modernPackageSpecifier } from "../ultramodern-package-source.js";
|
|
2
|
-
import {
|
|
2
|
+
import { appHasApi, remoteDependencyAlias, resolveRemoteRefs, sharedPackages, shellApp, verticalApiApps, zephyrRemoteDependency } from "./descriptors.js";
|
|
3
3
|
import { readFileTemplate } from "./fs-io.js";
|
|
4
4
|
import { packageName, relativeRootFor } from "./naming.js";
|
|
5
5
|
import { createPublicSurfaceGenerationCommand } from "./public-surface.js";
|
|
6
6
|
import { EFFECT_TSGO_VERSION, I18NEXT_VERSION, LEFTHOOK_VERSION, MODULE_FEDERATION_VERSION, NODE_FETCH_VERSION, OXFMT_VERSION, OXLINT_VERSION, PNPM_VERSION, POSTCSS_VERSION, REACT_DOM_VERSION, REACT_ROUTER_VERSION, REACT_VERSION, TAILWIND_POSTCSS_VERSION, TAILWIND_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, TYPESCRIPT_VERSION, TYPES_REACT_DOM_VERSION, TYPES_REACT_VERSION, ULTRACITE_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "./versions.js";
|
|
7
|
-
const
|
|
7
|
+
const createStrictTsgoTypecheckCommand = (packageDir)=>`node ${relativeRootFor(packageDir)}/scripts/ultramodern-typecheck.mts --project tsconfig.json`;
|
|
8
8
|
const effectDiagnostics = [
|
|
9
9
|
'anyUnknownInErrorContext',
|
|
10
10
|
'classSelfMismatch',
|
|
@@ -80,7 +80,7 @@ const effectDiagnostics = [
|
|
|
80
80
|
'unnecessaryPipe',
|
|
81
81
|
'unnecessaryPipeChain'
|
|
82
82
|
];
|
|
83
|
-
function appDependencies(scope, packageSource, app, remotes = []) {
|
|
83
|
+
function appDependencies(scope, packageSource, app, remotes = [], bridge) {
|
|
84
84
|
const dependencies = {
|
|
85
85
|
'@modern-js/plugin-tanstack': modernPackageSpecifier('@modern-js/plugin-tanstack', packageSource),
|
|
86
86
|
'@modern-js/plugin-i18n': modernPackageSpecifier('@modern-js/plugin-i18n', packageSource),
|
|
@@ -95,14 +95,16 @@ function appDependencies(scope, packageSource, app, remotes = []) {
|
|
|
95
95
|
[packageName(scope, 'shared-design-tokens')]: WORKSPACE_PACKAGE_VERSION,
|
|
96
96
|
react: REACT_VERSION,
|
|
97
97
|
'react-dom': REACT_DOM_VERSION,
|
|
98
|
-
'react-router': REACT_ROUTER_VERSION
|
|
98
|
+
'react-router': REACT_ROUTER_VERSION,
|
|
99
|
+
'react-router-dom': REACT_ROUTER_VERSION
|
|
99
100
|
};
|
|
101
|
+
for (const dependency of bridge?.dependencies ?? [])dependencies[dependency] = WORKSPACE_PACKAGE_VERSION;
|
|
100
102
|
if ('shell' === app.kind) {
|
|
101
103
|
dependencies['@modern-js/plugin-bff'] = modernPackageSpecifier('@modern-js/plugin-bff', packageSource);
|
|
102
|
-
for (const remote of
|
|
104
|
+
for (const remote of verticalApiApps(remotes))dependencies[packageName(scope, remote.packageSuffix)] = WORKSPACE_PACKAGE_VERSION;
|
|
103
105
|
}
|
|
104
106
|
for (const remote of resolveRemoteRefs(app, remotes))dependencies[packageName(scope, remote.packageSuffix)] = WORKSPACE_PACKAGE_VERSION;
|
|
105
|
-
if (
|
|
107
|
+
if (appHasApi(app)) dependencies['@modern-js/plugin-bff'] = modernPackageSpecifier('@modern-js/plugin-bff', packageSource);
|
|
106
108
|
return dependencies;
|
|
107
109
|
}
|
|
108
110
|
function appDevDependencies(packageSource, enableTailwind) {
|
|
@@ -123,12 +125,28 @@ function appDevDependencies(packageSource, enableTailwind) {
|
|
|
123
125
|
wrangler: WRANGLER_VERSION
|
|
124
126
|
};
|
|
125
127
|
}
|
|
126
|
-
function createRootPackageJson(scope, packageSource, remotes = []) {
|
|
128
|
+
function createRootPackageJson(scope, packageSource, remotes = [], bridge) {
|
|
127
129
|
const shellFilter = `--filter ${packageName(scope, shellApp.packageSuffix)}`;
|
|
128
130
|
const remoteFilters = remotes.map((remote)=>`--filter ${packageName(scope, remote.packageSuffix)}`);
|
|
129
131
|
const remoteBuildPrefix = remotes.length > 0 ? 'ULTRAMODERN_ZEPHYR=false pnpm -r --filter "./verticals/*" run build && ' : '';
|
|
130
132
|
const remoteCloudflareBuildPrefix = remotes.length > 0 ? 'pnpm -r --filter "./verticals/*" run cloudflare:build && ' : '';
|
|
131
133
|
const remoteCloudflareDeployPrefix = remotes.length > 0 ? 'pnpm -r --filter "./verticals/*" run cloudflare:deploy && ' : '';
|
|
134
|
+
const generatedPackageTypecheck = 'pnpm -r --filter "./apps/*" --filter "./verticals/*" --filter "./packages/*" run typecheck';
|
|
135
|
+
const typecheck = bridge ? generatedPackageTypecheck : "node ./scripts/ultramodern-typecheck.mts --build tsconfig.json";
|
|
136
|
+
const bridgeScripts = bridge ? {
|
|
137
|
+
...Object.fromEntries(bridge.gates.map((gate)=>[
|
|
138
|
+
`bridge:${gate.name}`,
|
|
139
|
+
`${gate.cwd ? `cd ${gate.cwd} && ` : ''}${gate.command}`
|
|
140
|
+
])),
|
|
141
|
+
'bridge:check': bridge.gates.map((gate)=>`pnpm run bridge:${gate.name}`).join(' && ')
|
|
142
|
+
} : {};
|
|
143
|
+
const bridgeCheck = bridge ? ' && pnpm bridge:check' : '';
|
|
144
|
+
const workspacePackages = [
|
|
145
|
+
'apps/*',
|
|
146
|
+
'verticals/*',
|
|
147
|
+
'packages/*',
|
|
148
|
+
...bridge?.workspacePackages.map((entry)=>entry.pattern) ?? []
|
|
149
|
+
];
|
|
132
150
|
return {
|
|
133
151
|
private: true,
|
|
134
152
|
name: scope,
|
|
@@ -150,30 +168,29 @@ function createRootPackageJson(scope, packageSource, remotes = []) {
|
|
|
150
168
|
'format:check': "oxfmt --check . '!repos/**'",
|
|
151
169
|
lint: 'oxlint apps verticals packages',
|
|
152
170
|
'lint:fix': 'oxlint apps verticals packages --fix',
|
|
153
|
-
typecheck
|
|
171
|
+
typecheck,
|
|
154
172
|
'cloudflare:build': `${remoteCloudflareBuildPrefix}pnpm --filter "./apps/shell-super-app" run cloudflare:build && pnpm mf:types`,
|
|
155
173
|
'cloudflare:deploy': `${remoteCloudflareDeployPrefix}pnpm --filter "./apps/shell-super-app" run cloudflare:deploy`,
|
|
156
|
-
'cloudflare:proof': "node ./scripts/proof-cloudflare-version.
|
|
157
|
-
'skills:install': "node ./scripts/bootstrap-agent-skills.
|
|
158
|
-
'skills:check': "node ./scripts/bootstrap-agent-skills.
|
|
159
|
-
'agents:refs:install': "node ./scripts/setup-agent-reference-repos.
|
|
160
|
-
'agents:refs:check': "node ./scripts/setup-agent-reference-repos.
|
|
161
|
-
'mf:types': "node ./scripts/assert-mf-types.
|
|
162
|
-
'performance:readiness': "node ./scripts/ultramodern-performance-readiness.
|
|
163
|
-
'
|
|
164
|
-
'
|
|
165
|
-
|
|
166
|
-
|
|
174
|
+
'cloudflare:proof': "node ./scripts/proof-cloudflare-version.mts --out .codex/reports/cloudflare-version-proof/public-url-proof.json",
|
|
175
|
+
'skills:install': "node ./scripts/bootstrap-agent-skills.mts",
|
|
176
|
+
'skills:check': "node ./scripts/bootstrap-agent-skills.mts --check",
|
|
177
|
+
'agents:refs:install': "node ./scripts/setup-agent-reference-repos.mts",
|
|
178
|
+
'agents:refs:check': "node ./scripts/setup-agent-reference-repos.mts --check",
|
|
179
|
+
'mf:types': "node ./scripts/assert-mf-types.mts",
|
|
180
|
+
'performance:readiness': "node ./scripts/ultramodern-performance-readiness.mts",
|
|
181
|
+
'migrate:strict-effect': "node ./scripts/migrate-strict-effect.mts",
|
|
182
|
+
'contract:check': "node ./scripts/validate-ultramodern-workspace.mts",
|
|
183
|
+
'api:check': "node ./scripts/check-ultramodern-api-boundaries.mts",
|
|
184
|
+
'i18n:boundaries': "node ./scripts/check-ultramodern-i18n-boundaries.mts",
|
|
185
|
+
...bridgeScripts,
|
|
186
|
+
postinstall: "oxfmt . '!repos/**' && node ./scripts/bootstrap-agent-skills.mts --postinstall",
|
|
187
|
+
check: `pnpm format:check && pnpm lint && pnpm typecheck && pnpm skills:check && pnpm i18n:boundaries && pnpm api:check && pnpm contract:check && pnpm performance:readiness${bridgeCheck}`
|
|
167
188
|
},
|
|
168
189
|
engines: {
|
|
169
190
|
node: '>=26',
|
|
170
191
|
pnpm: '>=11'
|
|
171
192
|
},
|
|
172
|
-
workspaces:
|
|
173
|
-
'apps/*',
|
|
174
|
-
'verticals/*',
|
|
175
|
-
'packages/*'
|
|
176
|
-
],
|
|
193
|
+
workspaces: workspacePackages,
|
|
177
194
|
modernjs: {
|
|
178
195
|
preset: 'presetUltramodern',
|
|
179
196
|
workspace: 'ultramodern-superapp',
|
|
@@ -181,7 +198,7 @@ function createRootPackageJson(scope, packageSource, remotes = []) {
|
|
|
181
198
|
ownership: './topology/ownership.json',
|
|
182
199
|
packageSource: {
|
|
183
200
|
strategy: packageSource.strategy,
|
|
184
|
-
config: './.modernjs/ultramodern
|
|
201
|
+
config: './.modernjs/ultramodern.json'
|
|
185
202
|
}
|
|
186
203
|
},
|
|
187
204
|
devDependencies: {
|
|
@@ -300,10 +317,10 @@ function createPackageTsConfig(packageDir, options = {}) {
|
|
|
300
317
|
function createAppTsConfig(app, remotes = []) {
|
|
301
318
|
const references = [
|
|
302
319
|
...sharedPackages.map((sharedPackage)=>sharedPackage.directory),
|
|
303
|
-
...'shell' === app.kind ?
|
|
320
|
+
...'shell' === app.kind ? verticalApiApps(remotes).map((remote)=>remote.directory) : resolveRemoteRefs(app, remotes).map((remote)=>remote.directory)
|
|
304
321
|
];
|
|
305
322
|
return createPackageTsConfig(app.directory, {
|
|
306
|
-
includeApi:
|
|
323
|
+
includeApi: appHasApi(app),
|
|
307
324
|
references
|
|
308
325
|
});
|
|
309
326
|
}
|
|
@@ -339,7 +356,7 @@ function createRootTsConfig(apps = []) {
|
|
|
339
356
|
]
|
|
340
357
|
};
|
|
341
358
|
}
|
|
342
|
-
function createAppPackage(scope, app, packageSource, enableTailwind, remotes = []) {
|
|
359
|
+
function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [], bridge) {
|
|
343
360
|
const publicSurfaceBuildCommand = createPublicSurfaceGenerationCommand(app, 'dist');
|
|
344
361
|
const publicSurfaceCloudflareBuildCommand = createPublicSurfaceGenerationCommand(app, 'dist');
|
|
345
362
|
const publicSurfaceCloudflareOutputCommand = createPublicSurfaceGenerationCommand(app, 'cloudflare');
|
|
@@ -353,33 +370,33 @@ function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [
|
|
|
353
370
|
version: '0.1.0',
|
|
354
371
|
scripts: {
|
|
355
372
|
dev: 'modern dev',
|
|
356
|
-
build: app.exposes ? `ULTRAMODERN_ZEPHYR=false modern build && ${publicSurfaceBuildCommand} && node ${relativeRootFor(app.directory)}/scripts/assert-mf-types.
|
|
373
|
+
build: app.exposes ? `ULTRAMODERN_ZEPHYR=false modern build && ${publicSurfaceBuildCommand} && node ${relativeRootFor(app.directory)}/scripts/assert-mf-types.mts` : `ULTRAMODERN_ZEPHYR=false modern build && ${publicSurfaceBuildCommand}`,
|
|
357
374
|
'cloudflare:build': `ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern build && ${publicSurfaceCloudflareBuildCommand} && ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy && ${publicSurfaceCloudflareOutputCommand}`,
|
|
358
375
|
'cloudflare:deploy': 'ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json',
|
|
359
376
|
'cloudflare:preview': 'pnpm run cloudflare:build && wrangler dev --config .output/wrangler.json',
|
|
360
|
-
'cloudflare:proof': `node ${relativeRootFor(app.directory)}/scripts/proof-cloudflare-version.
|
|
377
|
+
'cloudflare:proof': `node ${relativeRootFor(app.directory)}/scripts/proof-cloudflare-version.mts --app ${app.id}`,
|
|
361
378
|
serve: 'modern serve',
|
|
362
|
-
typecheck:
|
|
379
|
+
typecheck: createStrictTsgoTypecheckCommand(app.directory)
|
|
363
380
|
},
|
|
364
381
|
modernjs: {
|
|
365
382
|
preset: 'presetUltramodern',
|
|
366
383
|
role: 'shell' === app.kind ? 'shell' : 'module-federation-remote',
|
|
367
384
|
appId: app.id,
|
|
368
385
|
topology: `${relativeRootFor(app.directory)}/topology/reference-topology.json`,
|
|
369
|
-
...
|
|
370
|
-
apiRuntime: 'effect
|
|
386
|
+
...appHasApi(app) ? {
|
|
387
|
+
apiRuntime: 'effect'
|
|
371
388
|
} : {}
|
|
372
389
|
},
|
|
373
390
|
'zephyr:dependencies': createZephyrDependencies(scope, app, remotes),
|
|
374
|
-
dependencies: appDependencies(scope, packageSource, app, remotes),
|
|
391
|
+
dependencies: appDependencies(scope, packageSource, app, remotes, bridge),
|
|
375
392
|
devDependencies: appDevDependencies(packageSource, enableTailwind)
|
|
376
393
|
};
|
|
377
|
-
if (
|
|
378
|
-
'./
|
|
379
|
-
'./
|
|
394
|
+
if (appHasApi(app)) Object.assign(packageExports, {
|
|
395
|
+
'./api': './shared/api.ts',
|
|
396
|
+
'./api/client': `./src/api/${app.api.stem}-client.ts`
|
|
380
397
|
});
|
|
381
398
|
else if ('shell' === app.kind) Object.assign(packageExports, {
|
|
382
|
-
'./
|
|
399
|
+
'./api/clients': './src/api/vertical-clients.ts'
|
|
383
400
|
});
|
|
384
401
|
if (Object.keys(packageExports).length > 0) packageJson.exports = packageExports;
|
|
385
402
|
return packageJson;
|
|
@@ -395,7 +412,7 @@ function createSharedPackage(scope, id, description) {
|
|
|
395
412
|
'.': './src/index.ts'
|
|
396
413
|
},
|
|
397
414
|
scripts: {
|
|
398
|
-
typecheck:
|
|
415
|
+
typecheck: createStrictTsgoTypecheckCommand(`packages/${id}`)
|
|
399
416
|
},
|
|
400
417
|
devDependencies: {
|
|
401
418
|
'@effect/tsgo': EFFECT_TSGO_VERSION,
|
|
@@ -411,4 +428,4 @@ function createSharedPackage(scope, id, description) {
|
|
|
411
428
|
function createSharedContractsIndex() {
|
|
412
429
|
return readFileTemplate('packages/shared-contracts-index.ts');
|
|
413
430
|
}
|
|
414
|
-
export { appDependencies, appDevDependencies, createAppMfTypesTsConfig, createAppPackage, createAppTsConfig,
|
|
431
|
+
export { appDependencies, appDevDependencies, createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createPackageTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createStrictTsgoTypecheckCommand, createTsConfigBase, createZephyrDependencies, effectDiagnostics };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { appHasApi, appI18nNamespace, createCloudflarePublicUrlEnv, createCloudflareWorkerName, resolveApiPrefix, resolveApiStem } from "./descriptors.js";
|
|
2
2
|
import { createLocalisedUrlsMap } from "./routes.js";
|
|
3
3
|
import { isRecord } from "./types.js";
|
|
4
4
|
import { CLOUDFLARE_COMPATIBILITY_DATE } from "./versions.js";
|
|
@@ -15,8 +15,8 @@ function createCloudflareProofRoute(app) {
|
|
|
15
15
|
ssr: localizedPath ?? '/en',
|
|
16
16
|
mfManifest: '/mf-manifest.json',
|
|
17
17
|
locale: `/locales/en/${appI18nNamespace(app)}.json`,
|
|
18
|
-
...
|
|
19
|
-
|
|
18
|
+
...appHasApi(app) ? {
|
|
19
|
+
apiReadiness: `${resolveApiPrefix(app)}/${resolveApiStem(app)}/readiness`
|
|
20
20
|
} : {}
|
|
21
21
|
};
|
|
22
22
|
}
|
|
@@ -107,7 +107,7 @@ const PUBLIC_WEBSITE_POLICY = {
|
|
|
107
107
|
requireWebManifestWhenPresent: true
|
|
108
108
|
},
|
|
109
109
|
statusCodes: {
|
|
110
|
-
notFoundRoute: '/__ultramodern-smoke-missing',
|
|
110
|
+
notFoundRoute: '/__ultramodern-smoke-missing/nope',
|
|
111
111
|
unknownRouteStatus: 404
|
|
112
112
|
},
|
|
113
113
|
indexing: {
|
|
@@ -175,7 +175,7 @@ function createCloudflareDeployContract(scope, app) {
|
|
|
175
175
|
security: createCloudflareSecurityContract(),
|
|
176
176
|
qualityGates: createPublicWebsiteQualityGateContract(),
|
|
177
177
|
evidence: {
|
|
178
|
-
proofScript: "scripts/proof-cloudflare-version.
|
|
178
|
+
proofScript: "scripts/proof-cloudflare-version.mts",
|
|
179
179
|
reportDefault: '.codex/reports/cloudflare-version-proof/public-url-proof.json'
|
|
180
180
|
}
|
|
181
181
|
};
|
|
@@ -48,7 +48,7 @@ function createPublicSurfaceOutputFiles(app) {
|
|
|
48
48
|
];
|
|
49
49
|
}
|
|
50
50
|
function createPublicSurfaceGenerationCommand(app, target, requirePublicOrigin = false) {
|
|
51
|
-
return `node ${relativeRootFor(app.directory)}/scripts/generate-public-surface-assets.
|
|
51
|
+
return `node ${relativeRootFor(app.directory)}/scripts/generate-public-surface-assets.mts --app ${app.id} --target ${target}${requirePublicOrigin ? ' --require-public-origin' : ''}`;
|
|
52
52
|
}
|
|
53
53
|
function rewriteWorkspaceAssetsForApp(workspaceRoot, app) {
|
|
54
54
|
for (const relativePath of publicSurfaceManagedSourceAssetPaths)node_fs.rmSync(node_path.join(workspaceRoot, app.directory, relativePath), {
|
|
@@ -64,7 +64,7 @@ function createPublicSurfaceContract(app) {
|
|
|
64
64
|
generatedManifest: './src/routes/ultramodern-route-metadata',
|
|
65
65
|
source: 'route-owned-public-routes',
|
|
66
66
|
metadataExport: './src/routes/ultramodern-route-metadata',
|
|
67
|
-
generator: "scripts/generate-public-surface-assets.
|
|
67
|
+
generator: "scripts/generate-public-surface-assets.mts",
|
|
68
68
|
outputRoot: 'dist/public',
|
|
69
69
|
cloudflareOutputRoot: '.output/public',
|
|
70
70
|
privateRoutePolicy: 'omit-from-generated-public-surface',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const TANSTACK_ROUTER_VERSION = '1.170.16';
|
|
2
|
+
const TANSTACK_ROUTER_CORE_VERSION = '1.171.13';
|
|
2
3
|
const MODULE_FEDERATION_VERSION = '2.6.0';
|
|
3
4
|
const ZEPHYR_RSPACK_PLUGIN_VERSION = '1.1.1';
|
|
4
5
|
const ZEPHYR_AGENT_VERSION = '1.1.1';
|
|
@@ -7,6 +8,8 @@ const CLOUDFLARE_COMPATIBILITY_DATE = '2026-06-02';
|
|
|
7
8
|
const TAILWIND_VERSION = '4.3.1';
|
|
8
9
|
const TAILWIND_POSTCSS_VERSION = '4.3.1';
|
|
9
10
|
const POSTCSS_VERSION = '8.5.15';
|
|
11
|
+
const EFFECT_VERSION = '4.0.0-beta.89';
|
|
12
|
+
const EFFECT_VITEST_VERSION = '4.0.0-beta.89';
|
|
10
13
|
const EFFECT_TSGO_VERSION = '0.14.6';
|
|
11
14
|
const TYPESCRIPT_STABLE_VERSION = '6.0.3';
|
|
12
15
|
const TYPESCRIPT_NATIVE_PREVIEW_VERSION = '7.0.0-dev.20260624.1';
|
|
@@ -28,8 +31,11 @@ const RSTACK_AGENT_SKILLS_COMMIT = '61c948b42512e223bad44b83af4080eba48b2677';
|
|
|
28
31
|
const MODULE_FEDERATION_AGENT_SKILLS_COMMIT = '07bb5b6c43ad457609e00c081b72d4c42508ec76';
|
|
29
32
|
const ultramodernWorkspaceVersions = {
|
|
30
33
|
tanstackRouter: TANSTACK_ROUTER_VERSION,
|
|
34
|
+
tanstackRouterCore: TANSTACK_ROUTER_CORE_VERSION,
|
|
31
35
|
moduleFederation: MODULE_FEDERATION_VERSION,
|
|
36
|
+
effect: EFFECT_VERSION,
|
|
37
|
+
effectVitest: EFFECT_VITEST_VERSION,
|
|
32
38
|
tailwind: TAILWIND_VERSION,
|
|
33
39
|
tailwindPostcss: TAILWIND_POSTCSS_VERSION
|
|
34
40
|
};
|
|
35
|
-
export { CLOUDFLARE_COMPATIBILITY_DATE, EFFECT_TSGO_VERSION, I18NEXT_VERSION, LEFTHOOK_VERSION, MODULE_FEDERATION_AGENT_SKILLS_COMMIT, MODULE_FEDERATION_VERSION, NODE_FETCH_VERSION, NODE_VERSION, OXFMT_VERSION, OXLINT_VERSION, PNPM_VERSION, POSTCSS_VERSION, REACT_DOM_VERSION, REACT_ROUTER_VERSION, REACT_VERSION, RSTACK_AGENT_SKILLS_COMMIT, TAILWIND_POSTCSS_VERSION, TAILWIND_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, TYPESCRIPT_STABLE_VERSION, TYPESCRIPT_VERSION, TYPES_REACT_DOM_VERSION, TYPES_REACT_VERSION, ULTRACITE_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION, ultramodernWorkspaceVersions };
|
|
41
|
+
export { CLOUDFLARE_COMPATIBILITY_DATE, EFFECT_TSGO_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, I18NEXT_VERSION, LEFTHOOK_VERSION, MODULE_FEDERATION_AGENT_SKILLS_COMMIT, MODULE_FEDERATION_VERSION, NODE_FETCH_VERSION, NODE_VERSION, OXFMT_VERSION, OXLINT_VERSION, PNPM_VERSION, POSTCSS_VERSION, REACT_DOM_VERSION, REACT_ROUTER_VERSION, REACT_VERSION, RSTACK_AGENT_SKILLS_COMMIT, TAILWIND_POSTCSS_VERSION, TAILWIND_VERSION, TANSTACK_ROUTER_CORE_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, TYPESCRIPT_STABLE_VERSION, TYPESCRIPT_VERSION, TYPES_REACT_DOM_VERSION, TYPES_REACT_VERSION, ULTRACITE_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION, ultramodernWorkspaceVersions };
|
|
@@ -1,27 +1,110 @@
|
|
|
1
|
+
import node_fs from "node:fs";
|
|
2
|
+
import node_path from "node:path";
|
|
3
|
+
import { verticalApiGroupName } from "./api.js";
|
|
1
4
|
import { remoteComponentOutputPath } from "./demo-components.js";
|
|
2
|
-
import {
|
|
3
|
-
import { verticalEffectGroupName } from "./effect-api.js";
|
|
5
|
+
import { appHasApi, appI18nNamespace, remoteDependencyAlias, shellApp } from "./descriptors.js";
|
|
4
6
|
import { readFileTemplate, renderFileTemplate, writeFileReplacing } from "./fs-io.js";
|
|
5
7
|
import { packageName, tailwindPrefixForApp } from "./naming.js";
|
|
6
8
|
import { createCloudflareSecurityContract } from "./policy.js";
|
|
7
9
|
import { publicSurfaceManagedSourceAssetPaths } from "./public-surface.js";
|
|
8
10
|
import { createLocalisedUrlsMap, createRouteMetaFilePath, createRouteOwnedI18nPaths, createRoutePageFilePath } from "./routes.js";
|
|
9
11
|
import { CLOUDFLARE_COMPATIBILITY_DATE, NODE_VERSION, PNPM_VERSION } from "./versions.js";
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
function createToolWrapperScript(command, extraArgs = []) {
|
|
13
|
+
const commandJson = JSON.stringify(command);
|
|
14
|
+
const extraArgsJson = JSON.stringify(extraArgs);
|
|
15
|
+
return `#!/usr/bin/env node
|
|
16
|
+
import { spawnSync } from 'node:child_process';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
19
|
+
|
|
20
|
+
const createBin = process.env.ULTRAMODERN_CREATE_BIN;
|
|
21
|
+
const forwardedArgs = process.argv.slice(2);
|
|
22
|
+
const workspaceRoot =
|
|
23
|
+
process.env.ULTRAMODERN_WORKSPACE_ROOT ??
|
|
24
|
+
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
25
|
+
const ultramodernArgs = ['ultramodern', ${commandJson}, ...${extraArgsJson}, ...forwardedArgs];
|
|
26
|
+
const result = createBin
|
|
27
|
+
? spawnSync(process.execPath, [createBin, ...ultramodernArgs], {
|
|
28
|
+
env: { ...process.env, ULTRAMODERN_WORKSPACE_ROOT: workspaceRoot },
|
|
29
|
+
stdio: 'inherit',
|
|
30
|
+
})
|
|
31
|
+
: spawnSync('modern-js-create', ultramodernArgs, {
|
|
32
|
+
env: { ...process.env, ULTRAMODERN_WORKSPACE_ROOT: workspaceRoot },
|
|
33
|
+
shell: process.platform === 'win32',
|
|
34
|
+
stdio: 'inherit',
|
|
13
35
|
});
|
|
36
|
+
|
|
37
|
+
if (result.error) {
|
|
38
|
+
console.error(result.error.message);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
process.exit(result.status ?? 1);
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
function createSkillsToolWrapperScript() {
|
|
46
|
+
return `#!/usr/bin/env node
|
|
47
|
+
import { spawnSync } from 'node:child_process';
|
|
48
|
+
import path from 'node:path';
|
|
49
|
+
import { fileURLToPath } from 'node:url';
|
|
50
|
+
|
|
51
|
+
const createBin = process.env.ULTRAMODERN_CREATE_BIN;
|
|
52
|
+
const forwardedArgs = process.argv.slice(2);
|
|
53
|
+
const workspaceRoot =
|
|
54
|
+
process.env.ULTRAMODERN_WORKSPACE_ROOT ??
|
|
55
|
+
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
56
|
+
const checkOnly = forwardedArgs.includes('--check');
|
|
57
|
+
const skillArgs = checkOnly
|
|
58
|
+
? ['skills', 'check', ...forwardedArgs.filter(arg => arg !== '--check')]
|
|
59
|
+
: ['skills', 'install', ...forwardedArgs];
|
|
60
|
+
const ultramodernArgs = ['ultramodern', ...skillArgs];
|
|
61
|
+
const result = createBin
|
|
62
|
+
? spawnSync(process.execPath, [createBin, ...ultramodernArgs], {
|
|
63
|
+
env: { ...process.env, ULTRAMODERN_WORKSPACE_ROOT: workspaceRoot },
|
|
64
|
+
stdio: 'inherit',
|
|
65
|
+
})
|
|
66
|
+
: spawnSync('modern-js-create', ultramodernArgs, {
|
|
67
|
+
env: { ...process.env, ULTRAMODERN_WORKSPACE_ROOT: workspaceRoot },
|
|
68
|
+
shell: process.platform === 'win32',
|
|
69
|
+
stdio: 'inherit',
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (result.error) {
|
|
73
|
+
console.error(result.error.message);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
process.exit(result.status ?? 1);
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
function removeLegacyWorkspaceScript(targetDir, relativePath) {
|
|
81
|
+
node_fs.rmSync(node_path.join(targetDir, relativePath), {
|
|
82
|
+
force: true
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function writeWorkspaceOwnedMtsScript(targetDir, name, content) {
|
|
86
|
+
writeFileReplacing(targetDir, `scripts/${name}.mts`, content);
|
|
87
|
+
removeLegacyWorkspaceScript(targetDir, `scripts/${name}.mjs`);
|
|
88
|
+
}
|
|
89
|
+
function migrateCopiedWorkspaceScriptToMts(targetDir, name) {
|
|
90
|
+
const legacyPath = node_path.join(targetDir, `scripts/${name}.mjs`);
|
|
91
|
+
const migratedPath = node_path.join(targetDir, `scripts/${name}.mts`);
|
|
92
|
+
if (!node_fs.existsSync(legacyPath)) return;
|
|
93
|
+
if (node_fs.existsSync(migratedPath)) return void node_fs.rmSync(legacyPath, {
|
|
94
|
+
force: true
|
|
95
|
+
});
|
|
96
|
+
node_fs.renameSync(legacyPath, migratedPath);
|
|
14
97
|
}
|
|
15
98
|
function createWorkspaceValidationScript(scope, enableTailwind, remotes = []) {
|
|
16
|
-
const verticals = remotes.filter(
|
|
99
|
+
const verticals = remotes.filter(appHasApi).map((remote)=>({
|
|
17
100
|
id: remote.id,
|
|
18
101
|
domain: remote.domain,
|
|
19
|
-
stem: remote.
|
|
20
|
-
group:
|
|
102
|
+
stem: remote.api.stem,
|
|
103
|
+
group: verticalApiGroupName(remote),
|
|
21
104
|
path: remote.directory,
|
|
22
105
|
port: remote.port,
|
|
23
106
|
mfName: remote.mfName,
|
|
24
|
-
apiPrefix: remote.
|
|
107
|
+
apiPrefix: remote.api.prefix,
|
|
25
108
|
tailwindPrefix: tailwindPrefixForApp(remote),
|
|
26
109
|
zephyrAlias: remoteDependencyAlias(remote),
|
|
27
110
|
packageName: packageName(scope, remote.packageSuffix),
|
|
@@ -62,35 +145,26 @@ function createWorkspaceValidationScript(scope, enableTailwind, remotes = []) {
|
|
|
62
145
|
});
|
|
63
146
|
}
|
|
64
147
|
function createWorkspaceI18nBoundaryValidationScript() {
|
|
65
|
-
return readFileTemplate("workspace-scripts/check-ultramodern-i18n-boundaries.
|
|
66
|
-
}
|
|
67
|
-
function createPublicSurfaceAssetsScript() {
|
|
68
|
-
return readFileTemplate("workspace-scripts/generate-public-surface-assets.mjs");
|
|
148
|
+
return readFileTemplate("workspace-scripts/check-ultramodern-i18n-boundaries.mts");
|
|
69
149
|
}
|
|
70
|
-
function
|
|
71
|
-
return readFileTemplate("workspace-scripts/ultramodern-
|
|
72
|
-
}
|
|
73
|
-
function createCloudflareVersionProofScript() {
|
|
74
|
-
return readFileTemplate("workspace-scripts/proof-cloudflare-version.mjs");
|
|
150
|
+
function createWorkspaceApiBoundaryValidationScript() {
|
|
151
|
+
return readFileTemplate("workspace-scripts/check-ultramodern-api-boundaries.mts");
|
|
75
152
|
}
|
|
76
153
|
function createPerformanceReadinessConfigScript() {
|
|
77
154
|
return readFileTemplate("workspace-scripts/ultramodern-performance-readiness.config.mjs");
|
|
78
155
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
writeFileReplacing(targetDir, "scripts/assert-mf-types.mjs", createAssertMfTypesScript(remotes));
|
|
87
|
-
writeFileReplacing(targetDir, "scripts/validate-ultramodern-workspace.mjs", createWorkspaceValidationScript(scope, enableTailwind, remotes));
|
|
88
|
-
writeFileReplacing(targetDir, "scripts/check-ultramodern-i18n-boundaries.mjs", createWorkspaceI18nBoundaryValidationScript());
|
|
89
|
-
writeFileReplacing(targetDir, "scripts/generate-public-surface-assets.mjs", createPublicSurfaceAssetsScript());
|
|
90
|
-
writeFileReplacing(targetDir, "scripts/ultramodern-cloudflare-proof.mjs", createCloudflareProofHelperScript());
|
|
91
|
-
writeFileReplacing(targetDir, "scripts/proof-cloudflare-version.mjs", createCloudflareVersionProofScript());
|
|
156
|
+
function writeGeneratedWorkspaceScripts(targetDir, _scope, _enableTailwind, _remotes = []) {
|
|
157
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'assert-mf-types', createToolWrapperScript('mf-types'));
|
|
158
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'validate-ultramodern-workspace', createToolWrapperScript('validate'));
|
|
159
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'check-ultramodern-i18n-boundaries', createWorkspaceI18nBoundaryValidationScript());
|
|
160
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'check-ultramodern-api-boundaries', createWorkspaceApiBoundaryValidationScript());
|
|
161
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'generate-public-surface-assets', createToolWrapperScript('public-surface'));
|
|
162
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'proof-cloudflare-version', createToolWrapperScript('cloudflare-proof'));
|
|
92
163
|
writeFileReplacing(targetDir, "scripts/ultramodern-performance-readiness.config.mjs", createPerformanceReadinessConfigScript());
|
|
93
|
-
|
|
94
|
-
|
|
164
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'ultramodern-performance-readiness', createToolWrapperScript('performance-readiness'));
|
|
165
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'migrate-strict-effect', createToolWrapperScript('migrate-strict-effect'));
|
|
166
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'ultramodern-typecheck', createToolWrapperScript('typecheck'));
|
|
167
|
+
writeWorkspaceOwnedMtsScript(targetDir, 'bootstrap-agent-skills', createSkillsToolWrapperScript());
|
|
168
|
+
migrateCopiedWorkspaceScriptToMts(targetDir, 'setup-agent-reference-repos');
|
|
95
169
|
}
|
|
96
|
-
export {
|
|
170
|
+
export { createPerformanceReadinessConfigScript, createWorkspaceApiBoundaryValidationScript, createWorkspaceI18nBoundaryValidationScript, createWorkspaceValidationScript, writeGeneratedWorkspaceScripts };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import node_fs from "node:fs";
|
|
2
|
+
import { createApiClient, createApiServiceEntry, createSharedApi, createShellApiClient } from "./api.js";
|
|
2
3
|
import { createAppEnvDts, createAppRuntimeConfig, createAppStyles, createPostcssConfig, createSharedDesignTokensCss, createShellFrameComponent, createTailwindConfig } from "./app-files.js";
|
|
3
|
-
import {
|
|
4
|
+
import { normalizeUltramodernBridgeConfig } from "./bridge-config.js";
|
|
5
|
+
import { createDevelopmentOverlay, createOwnership, createTopology, createUltramodernConfig } from "./contracts.js";
|
|
4
6
|
import { createLayout, createRemoteEntry, createRemoteExposeComponent, createRemotePage, createShellPage, createShellRemoteComponents, remoteComponentOutputPath } from "./demo-components.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { copyRootTemplate, writeFile, writeJson } from "./fs-io.js";
|
|
7
|
+
import { ULTRAMODERN_CONFIG_PATH, appHasApi, appI18nNamespace, createShellHost, sharedPackages, shellApp } from "./descriptors.js";
|
|
8
|
+
import { copyRootTemplate, formatGeneratedWorkspaceFiles, writeFile, writeFileReplacing, writeJson } from "./fs-io.js";
|
|
8
9
|
import { createFileSnapshot, createGenerationResult, diffFileSnapshots } from "./generation-result.js";
|
|
9
10
|
import { createAppPublicLocaleMessages } from "./locales.js";
|
|
10
11
|
import { createAppModernConfig, createRemoteModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, createUltramodernBuildReexportModule } from "./module-federation.js";
|
|
@@ -13,15 +14,15 @@ import { runCodeSmithOverlays } from "./overlays.js";
|
|
|
13
14
|
import { createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase } from "./package-json.js";
|
|
14
15
|
import { resolvePackageSource } from "./package-source.js";
|
|
15
16
|
import { createPublicWebAppArtifacts } from "./public-surface.js";
|
|
16
|
-
import { NODE_FETCH_VERSION, NODE_VERSION, PNPM_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_VERSION } from "./versions.js";
|
|
17
|
+
import { EFFECT_VERSION, EFFECT_VITEST_VERSION, NODE_FETCH_VERSION, NODE_VERSION, PNPM_VERSION, TANSTACK_ROUTER_CORE_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_VERSION } from "./versions.js";
|
|
17
18
|
import { writeGeneratedWorkspaceScripts } from "./workspace-scripts.js";
|
|
18
|
-
function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes = []) {
|
|
19
|
+
function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes = [], bridge) {
|
|
19
20
|
const resolvedApp = 'shell' === app.kind ? createShellHost(remotes) : app;
|
|
20
21
|
const publicWeb = createPublicWebAppArtifacts(resolvedApp);
|
|
21
22
|
const writeAppFile = (relativePath, content)=>{
|
|
22
23
|
writeFile(targetDir, `${resolvedApp.directory}/${relativePath}`, content);
|
|
23
24
|
};
|
|
24
|
-
writeJson(targetDir, `${resolvedApp.directory}/package.json`, createAppPackage(scope, resolvedApp, packageSource, enableTailwind, remotes));
|
|
25
|
+
writeJson(targetDir, `${resolvedApp.directory}/package.json`, createAppPackage(scope, resolvedApp, packageSource, enableTailwind, remotes, bridge));
|
|
25
26
|
writeJson(targetDir, `${resolvedApp.directory}/tsconfig.json`, createAppTsConfig(resolvedApp, remotes));
|
|
26
27
|
writeJson(targetDir, `${resolvedApp.directory}/tsconfig.mf-types.json`, createAppMfTypesTsConfig(resolvedApp));
|
|
27
28
|
writeFile(targetDir, `${resolvedApp.directory}/src/modern-app-env.d.ts`, createAppEnvDts(resolvedApp, remotes));
|
|
@@ -49,12 +50,12 @@ function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes
|
|
|
49
50
|
if ('shell' === resolvedApp.kind) {
|
|
50
51
|
writeAppFile('src/routes/vertical-components.tsx', createShellRemoteComponents(scope, remotes));
|
|
51
52
|
writeAppFile('src/routes/shell-frame.tsx', createShellFrameComponent());
|
|
52
|
-
writeFile(targetDir, `${resolvedApp.directory}/src/
|
|
53
|
+
writeFile(targetDir, `${resolvedApp.directory}/src/api/vertical-clients.ts`, createShellApiClient(scope, remotes));
|
|
53
54
|
}
|
|
54
|
-
if (
|
|
55
|
-
writeFile(targetDir, `${resolvedApp.directory}/shared/
|
|
56
|
-
writeFile(targetDir, `${resolvedApp.directory}/api/
|
|
57
|
-
writeFile(targetDir, `${resolvedApp.directory}/src/
|
|
55
|
+
if (appHasApi(resolvedApp)) {
|
|
56
|
+
writeFile(targetDir, `${resolvedApp.directory}/shared/api.ts`, createSharedApi(resolvedApp));
|
|
57
|
+
writeFile(targetDir, `${resolvedApp.directory}/api/index.ts`, createApiServiceEntry(resolvedApp, '../shared/api.ts'));
|
|
58
|
+
writeFile(targetDir, `${resolvedApp.directory}/src/api/${resolvedApp.api.stem}-client.ts`, createApiClient(resolvedApp, '../../shared/api'));
|
|
58
59
|
}
|
|
59
60
|
if ('vertical' === resolvedApp.kind) {
|
|
60
61
|
writeAppFile('src/federation-entry.tsx', createRemoteEntry(resolvedApp));
|
|
@@ -80,10 +81,36 @@ function writeSharedPackages(targetDir, scope) {
|
|
|
80
81
|
`);
|
|
81
82
|
writeFile(targetDir, 'packages/shared-design-tokens/src/tokens.css', createSharedDesignTokensCss());
|
|
82
83
|
}
|
|
84
|
+
function createCompactRootPackageJson(scope, packageSource, remotes, bridge) {
|
|
85
|
+
const rootPackage = createRootPackageJson(scope, packageSource, remotes, bridge);
|
|
86
|
+
if (rootPackage.modernjs?.packageSource && 'object' == typeof rootPackage.modernjs.packageSource) rootPackage.modernjs.packageSource.config = `./${ULTRAMODERN_CONFIG_PATH}`;
|
|
87
|
+
return rootPackage;
|
|
88
|
+
}
|
|
89
|
+
function createCompactUltramodernConfig(scope, modernVersion, packageSource, apps = [
|
|
90
|
+
createShellHost()
|
|
91
|
+
], enableTailwind = true, bridge) {
|
|
92
|
+
const config = createUltramodernConfig(scope, modernVersion, packageSource, apps, enableTailwind, bridge);
|
|
93
|
+
if (config.packageSource && 'object' == typeof config.packageSource && !Array.isArray(config.packageSource)) delete config.packageSource.metadata;
|
|
94
|
+
return config;
|
|
95
|
+
}
|
|
96
|
+
function writePnpmWorkspacePackages(targetDir, bridge) {
|
|
97
|
+
if (!bridge) return;
|
|
98
|
+
const pnpmWorkspacePath = `${targetDir}/pnpm-workspace.yaml`;
|
|
99
|
+
const pnpmWorkspace = node_fs.readFileSync(pnpmWorkspacePath, 'utf-8');
|
|
100
|
+
const packages = [
|
|
101
|
+
'apps/*',
|
|
102
|
+
'verticals/*',
|
|
103
|
+
'packages/*',
|
|
104
|
+
...bridge.workspacePackages.map((entry)=>entry.pattern)
|
|
105
|
+
];
|
|
106
|
+
const renderedPackages = packages.map((pattern)=>` - ${pattern}`).join('\n');
|
|
107
|
+
writeFileReplacing(targetDir, 'pnpm-workspace.yaml', pnpmWorkspace.replace(/^packages:\n(?: {2}- .+\n)+/u, `packages:\n${renderedPackages}\n`));
|
|
108
|
+
}
|
|
83
109
|
function generateUltramodernWorkspace(options) {
|
|
84
110
|
const beforeFiles = createFileSnapshot(options.targetDir);
|
|
85
111
|
const scope = toPackageScope(options.packageName);
|
|
86
112
|
const packageSource = resolvePackageSource(options);
|
|
113
|
+
const bridge = normalizeUltramodernBridgeConfig(options.bridge);
|
|
87
114
|
const enableTailwind = false !== options.enableTailwind;
|
|
88
115
|
const initialVerticals = [];
|
|
89
116
|
const createdApps = [
|
|
@@ -103,39 +130,52 @@ function generateUltramodernWorkspace(options) {
|
|
|
103
130
|
nodeVersion: NODE_VERSION,
|
|
104
131
|
pnpmVersion: PNPM_VERSION,
|
|
105
132
|
nodeFetchVersion: NODE_FETCH_VERSION,
|
|
133
|
+
effectVersion: EFFECT_VERSION,
|
|
134
|
+
effectVitestVersion: EFFECT_VITEST_VERSION,
|
|
135
|
+
tanstackRouterCoreVersion: TANSTACK_ROUTER_CORE_VERSION,
|
|
106
136
|
tanstackRouterVersion: TANSTACK_ROUTER_VERSION,
|
|
107
137
|
typescriptVersion: TYPESCRIPT_VERSION,
|
|
108
138
|
tailwindEnabled: String(enableTailwind)
|
|
109
139
|
});
|
|
110
|
-
|
|
140
|
+
writePnpmWorkspacePackages(options.targetDir, bridge);
|
|
141
|
+
writeJson(options.targetDir, 'package.json', createCompactRootPackageJson(scope, packageSource, initialVerticals, bridge));
|
|
111
142
|
writeJson(options.targetDir, 'tsconfig.base.json', createTsConfigBase());
|
|
112
143
|
writeJson(options.targetDir, 'tsconfig.json', createRootTsConfig(createdApps));
|
|
113
144
|
writeJson(options.targetDir, 'topology/reference-topology.json', createTopology(scope, initialVerticals));
|
|
114
145
|
writeJson(options.targetDir, 'topology/ownership.json', createOwnership(scope, initialVerticals));
|
|
115
146
|
writeJson(options.targetDir, 'topology/local-overlays/development.json', createDevelopmentOverlay(initialVerticals));
|
|
116
|
-
writeJson(options.targetDir,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
writeApp(options.targetDir, scope, shellApp, packageSource, enableTailwind, initialVerticals);
|
|
120
|
-
for (const remote of initialVerticals)writeApp(options.targetDir, scope, remote, packageSource, enableTailwind, initialVerticals);
|
|
147
|
+
writeJson(options.targetDir, ULTRAMODERN_CONFIG_PATH, createCompactUltramodernConfig(scope, options.modernVersion, packageSource, createdApps, enableTailwind, bridge));
|
|
148
|
+
writeApp(options.targetDir, scope, shellApp, packageSource, enableTailwind, initialVerticals, bridge);
|
|
149
|
+
for (const remote of initialVerticals)writeApp(options.targetDir, scope, remote, packageSource, enableTailwind, initialVerticals, bridge);
|
|
121
150
|
writeSharedPackages(options.targetDir, scope);
|
|
122
151
|
writeGeneratedWorkspaceScripts(options.targetDir, scope, enableTailwind, initialVerticals);
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
152
|
+
const preliminaryAfterFiles = createFileSnapshot(options.targetDir);
|
|
153
|
+
const preliminaryDiff = diffFileSnapshots(beforeFiles, preliminaryAfterFiles);
|
|
154
|
+
const preliminaryResult = createGenerationResult({
|
|
126
155
|
operation: 'workspace',
|
|
127
156
|
workspaceRoot: options.targetDir,
|
|
128
157
|
packageScope: scope,
|
|
129
158
|
packageSource,
|
|
130
159
|
createdApps,
|
|
131
|
-
createdPaths,
|
|
132
|
-
rewrittenPaths
|
|
160
|
+
createdPaths: preliminaryDiff.createdPaths,
|
|
161
|
+
rewrittenPaths: preliminaryDiff.rewrittenPaths
|
|
133
162
|
});
|
|
134
163
|
runCodeSmithOverlays({
|
|
135
164
|
workspaceRoot: options.targetDir,
|
|
136
165
|
overlays: options.overlays,
|
|
137
|
-
result
|
|
166
|
+
result: preliminaryResult
|
|
167
|
+
});
|
|
168
|
+
formatGeneratedWorkspaceFiles(options.targetDir);
|
|
169
|
+
const afterFiles = createFileSnapshot(options.targetDir);
|
|
170
|
+
const { createdPaths, rewrittenPaths } = diffFileSnapshots(beforeFiles, afterFiles);
|
|
171
|
+
return createGenerationResult({
|
|
172
|
+
operation: 'workspace',
|
|
173
|
+
workspaceRoot: options.targetDir,
|
|
174
|
+
packageScope: scope,
|
|
175
|
+
packageSource,
|
|
176
|
+
createdApps,
|
|
177
|
+
createdPaths,
|
|
178
|
+
rewrittenPaths
|
|
138
179
|
});
|
|
139
|
-
return result;
|
|
140
180
|
}
|
|
141
|
-
export { generateUltramodernWorkspace, writeApp, writeSharedPackages };
|
|
181
|
+
export { createCompactUltramodernConfig, generateUltramodernWorkspace, writeApp, writeSharedPackages };
|