@bleedingdev/modern-js-create 3.5.0-ultramodern.3 → 3.5.0-ultramodern.30
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 +21 -17
- package/dist/cjs/ultramodern-tooling/commands.cjs +772 -75
- package/dist/cjs/ultramodern-tooling/config.cjs +149 -8
- package/dist/cjs/ultramodern-workspace/add-vertical.cjs +25 -0
- package/dist/cjs/ultramodern-workspace/api.cjs +44 -0
- package/dist/cjs/ultramodern-workspace/app-files.cjs +8 -11
- package/dist/cjs/ultramodern-workspace/backend-federation.cjs +282 -0
- package/dist/cjs/ultramodern-workspace/contracts.cjs +24 -8
- package/dist/cjs/ultramodern-workspace/delivery-unit-sync.cjs +157 -0
- package/dist/cjs/ultramodern-workspace/delivery-unit.cjs +88 -0
- package/dist/cjs/ultramodern-workspace/descriptors.cjs +24 -0
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +161 -50
- package/dist/cjs/ultramodern-workspace/package-json.cjs +26 -43
- package/dist/cjs/ultramodern-workspace/pnpm-workspace-policy-plan.cjs +166 -0
- package/dist/cjs/ultramodern-workspace/tooling-command-catalog.cjs +153 -0
- package/dist/cjs/ultramodern-workspace/versions.cjs +8 -3
- package/dist/cjs/ultramodern-workspace/workspace-script-plan.cjs +175 -0
- package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +104 -63
- package/dist/cjs/ultramodern-workspace/workspace-validation-contract.cjs +97 -0
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +11 -3
- package/dist/cjs/ultramodern-workspace/zerops.cjs +100 -0
- package/dist/esm/ultramodern-tooling/commands.js +775 -78
- package/dist/esm/ultramodern-tooling/config.js +144 -9
- package/dist/esm/ultramodern-workspace/add-vertical.js +26 -1
- package/dist/esm/ultramodern-workspace/api.js +43 -2
- package/dist/esm/ultramodern-workspace/app-files.js +8 -11
- package/dist/esm/ultramodern-workspace/backend-federation.js +217 -0
- package/dist/esm/ultramodern-workspace/contracts.js +24 -8
- package/dist/esm/ultramodern-workspace/delivery-unit-sync.js +108 -0
- package/dist/esm/ultramodern-workspace/delivery-unit.js +31 -0
- package/dist/esm/ultramodern-workspace/descriptors.js +13 -1
- package/dist/esm/ultramodern-workspace/module-federation.js +160 -42
- package/dist/esm/ultramodern-workspace/package-json.js +16 -40
- package/dist/esm/ultramodern-workspace/pnpm-workspace-policy-plan.js +113 -0
- package/dist/esm/ultramodern-workspace/tooling-command-catalog.js +100 -0
- package/dist/esm/ultramodern-workspace/versions.js +6 -4
- package/dist/esm/ultramodern-workspace/workspace-script-plan.js +110 -0
- package/dist/esm/ultramodern-workspace/workspace-scripts.js +88 -65
- package/dist/esm/ultramodern-workspace/workspace-validation-contract.js +59 -0
- package/dist/esm/ultramodern-workspace/write-workspace.js +14 -6
- package/dist/esm/ultramodern-workspace/zerops.js +62 -0
- package/dist/esm-node/ultramodern-tooling/commands.js +775 -78
- package/dist/esm-node/ultramodern-tooling/config.js +144 -9
- package/dist/esm-node/ultramodern-workspace/add-vertical.js +26 -1
- package/dist/esm-node/ultramodern-workspace/api.js +43 -2
- package/dist/esm-node/ultramodern-workspace/app-files.js +8 -11
- package/dist/esm-node/ultramodern-workspace/backend-federation.js +218 -0
- package/dist/esm-node/ultramodern-workspace/contracts.js +24 -8
- package/dist/esm-node/ultramodern-workspace/delivery-unit-sync.js +109 -0
- package/dist/esm-node/ultramodern-workspace/delivery-unit.js +32 -0
- package/dist/esm-node/ultramodern-workspace/descriptors.js +13 -1
- package/dist/esm-node/ultramodern-workspace/module-federation.js +160 -42
- package/dist/esm-node/ultramodern-workspace/package-json.js +16 -40
- package/dist/esm-node/ultramodern-workspace/pnpm-workspace-policy-plan.js +114 -0
- package/dist/esm-node/ultramodern-workspace/tooling-command-catalog.js +101 -0
- package/dist/esm-node/ultramodern-workspace/versions.js +6 -4
- package/dist/esm-node/ultramodern-workspace/workspace-script-plan.js +111 -0
- package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +88 -65
- package/dist/esm-node/ultramodern-workspace/workspace-validation-contract.js +60 -0
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +14 -6
- package/dist/esm-node/ultramodern-workspace/zerops.js +63 -0
- package/dist/types/ultramodern-tooling/config.d.ts +6 -0
- package/dist/types/ultramodern-workspace/api.d.ts +1 -0
- package/dist/types/ultramodern-workspace/backend-federation.d.ts +11 -0
- package/dist/types/ultramodern-workspace/contracts.d.ts +1 -1
- package/dist/types/ultramodern-workspace/delivery-unit-sync.d.ts +6 -0
- package/dist/types/ultramodern-workspace/delivery-unit.d.ts +27 -0
- package/dist/types/ultramodern-workspace/descriptors.d.ts +4 -0
- package/dist/types/ultramodern-workspace/module-federation.d.ts +4 -9
- package/dist/types/ultramodern-workspace/package-json.d.ts +0 -1
- package/dist/types/ultramodern-workspace/pnpm-workspace-policy-plan.d.ts +39 -0
- package/dist/types/ultramodern-workspace/tooling-command-catalog.d.ts +18 -0
- package/dist/types/ultramodern-workspace/versions.d.ts +5 -3
- package/dist/types/ultramodern-workspace/workspace-script-plan.d.ts +72 -0
- package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +13 -0
- package/dist/types/ultramodern-workspace/workspace-validation-contract.d.ts +42 -0
- package/dist/types/ultramodern-workspace/zerops.d.ts +2 -0
- package/package.json +3 -3
- package/template-workspace/.gitignore.handlebars +4 -0
- package/template-workspace/README.md.handlebars +18 -15
- package/template-workspace/patches/@module-federation__bridge-react@2.6.0.patch +140 -0
- package/template-workspace/patches/@module-federation__modern-js-v3@2.6.0.patch +57 -0
- package/template-workspace/patches/drizzle-orm-ts7-strict-declarations.patch +452 -0
- package/template-workspace/patches/effect-schema-error-type-id.patch +18 -0
- package/template-workspace/pnpm-workspace.yaml.handlebars +8 -0
- package/template-workspace/scripts/bootstrap-agent-skills.mjs +11 -3
- package/templates/workspace-scripts/check-ultramodern-api-boundaries.mts +40 -2
- package/templates/workspace-scripts/generate-node-backend-federation.mjs +270 -0
- package/templates/workspace-scripts/materialize-zerops-runtime.mjs +448 -0
- package/templates/workspace-scripts/proof-cloudflare-version.mjs +237 -9
- package/templates/workspace-scripts/proof-node-backend-federation.mjs +729 -0
- package/templates/workspace-scripts/ultramodern-cloudflare-proof.mjs +188 -2
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +434 -18
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { DRIZZLE_ORM_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, MODULE_FEDERATION_VERSION } from "./versions.js";
|
|
3
|
+
const strictEffectPackageVersionPolicyExclusions = [
|
|
4
|
+
`effect@${EFFECT_VERSION}`,
|
|
5
|
+
`@effect/opentelemetry@${EFFECT_VERSION}`
|
|
6
|
+
];
|
|
7
|
+
const moduleFederationModernJsPatchPath = `patches/@module-federation__modern-js-v3@${MODULE_FEDERATION_VERSION}.patch`;
|
|
8
|
+
const moduleFederationBridgeReactPatchPath = `patches/@module-federation__bridge-react@${MODULE_FEDERATION_VERSION}.patch`;
|
|
9
|
+
const effectDeclarationPatchPath = 'patches/effect-schema-error-type-id.patch';
|
|
10
|
+
const drizzleOrmDeclarationPatchPath = 'patches/drizzle-orm-ts7-strict-declarations.patch';
|
|
11
|
+
function createPnpmWorkspacePolicyPlan(options) {
|
|
12
|
+
return {
|
|
13
|
+
yamlActions: [
|
|
14
|
+
{
|
|
15
|
+
kind: 'replace-line',
|
|
16
|
+
pattern: /^ {4}'@effect\/vitest>effect': .+$/mu,
|
|
17
|
+
replacement: ` '@effect/vitest>effect': '${EFFECT_VERSION}'`
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
kind: 'ensure-scalar-map-entry',
|
|
21
|
+
key: 'overrides',
|
|
22
|
+
entryKey: "'@effect/opentelemetry'",
|
|
23
|
+
value: EFFECT_VERSION
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
kind: 'ensure-scalar-map-entry',
|
|
27
|
+
key: 'overrides',
|
|
28
|
+
entryKey: "'@effect/vitest'",
|
|
29
|
+
value: EFFECT_VITEST_VERSION
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
kind: 'ensure-scalar-map-entry',
|
|
33
|
+
key: 'overrides',
|
|
34
|
+
entryKey: 'effect',
|
|
35
|
+
value: EFFECT_VERSION
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
kind: 'ensure-scalar-map-entry',
|
|
39
|
+
key: 'allowBuilds',
|
|
40
|
+
entryKey: "'@parcel/watcher'",
|
|
41
|
+
value: 'true'
|
|
42
|
+
},
|
|
43
|
+
...strictEffectPackageVersionPolicyExclusions.flatMap((item)=>createStrictEffectPackageVersionPolicyActions(item)),
|
|
44
|
+
{
|
|
45
|
+
kind: 'ensure-map-entry',
|
|
46
|
+
key: 'patchedDependencies',
|
|
47
|
+
entryKey: `effect@${EFFECT_VERSION}`,
|
|
48
|
+
value: effectDeclarationPatchPath
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
kind: 'ensure-map-entry',
|
|
52
|
+
key: 'patchedDependencies',
|
|
53
|
+
entryKey: `@module-federation/modern-js-v3@${MODULE_FEDERATION_VERSION}`,
|
|
54
|
+
value: moduleFederationModernJsPatchPath
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
kind: 'ensure-map-entry',
|
|
58
|
+
key: 'patchedDependencies',
|
|
59
|
+
entryKey: `@module-federation/bridge-react@${MODULE_FEDERATION_VERSION}`,
|
|
60
|
+
value: moduleFederationBridgeReactPatchPath
|
|
61
|
+
},
|
|
62
|
+
options.usesDrizzleOrm ? {
|
|
63
|
+
kind: 'ensure-map-entry',
|
|
64
|
+
key: 'patchedDependencies',
|
|
65
|
+
entryKey: `drizzle-orm@${DRIZZLE_ORM_VERSION}`,
|
|
66
|
+
value: drizzleOrmDeclarationPatchPath
|
|
67
|
+
} : {
|
|
68
|
+
kind: 'remove-map-entry',
|
|
69
|
+
entryKey: `drizzle-orm@${DRIZZLE_ORM_VERSION}`
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
declarationPatchActions: [
|
|
73
|
+
{
|
|
74
|
+
kind: 'ensure',
|
|
75
|
+
relativePatchPath: moduleFederationModernJsPatchPath
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
kind: 'ensure',
|
|
79
|
+
relativePatchPath: moduleFederationBridgeReactPatchPath
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
kind: 'ensure',
|
|
83
|
+
relativePatchPath: effectDeclarationPatchPath
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
kind: options.usesDrizzleOrm ? 'ensure' : 'remove-if-unchanged',
|
|
87
|
+
relativePatchPath: drizzleOrmDeclarationPatchPath
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
requiresInstallOnChange: true
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function createStrictEffectPackageVersionPolicyActions(item) {
|
|
94
|
+
const packageName = item.slice(0, item.lastIndexOf('@'));
|
|
95
|
+
const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
96
|
+
return [
|
|
97
|
+
{
|
|
98
|
+
kind: 'replace-line',
|
|
99
|
+
pattern: new RegExp(`^ {2}- '${escapedPackageName}@[^']+'$`, 'gmu'),
|
|
100
|
+
replacement: ` - '${item}'`
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
kind: 'ensure-list-item',
|
|
104
|
+
key: 'minimumReleaseAgeExclude',
|
|
105
|
+
item
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
kind: 'ensure-list-item',
|
|
109
|
+
key: 'trustPolicyExclude',
|
|
110
|
+
item
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
export { createPnpmWorkspacePolicyPlan, drizzleOrmDeclarationPatchPath, effectDeclarationPatchPath, moduleFederationBridgeReactPatchPath, moduleFederationModernJsPatchPath, strictEffectPackageVersionPolicyExclusions };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
const defineToolingCommand = (command)=>({
|
|
3
|
+
...command,
|
|
4
|
+
wrapperPath: `scripts/${command.wrapperName}.mts`
|
|
5
|
+
});
|
|
6
|
+
const generatedToolingCommands = [
|
|
7
|
+
defineToolingCommand({
|
|
8
|
+
id: 'validate',
|
|
9
|
+
command: 'validate',
|
|
10
|
+
wrapperName: 'validate-ultramodern-workspace',
|
|
11
|
+
contractKey: 'validate',
|
|
12
|
+
rootScript: 'contract:check'
|
|
13
|
+
}),
|
|
14
|
+
defineToolingCommand({
|
|
15
|
+
id: 'typecheck',
|
|
16
|
+
command: 'typecheck',
|
|
17
|
+
wrapperName: 'ultramodern-typecheck',
|
|
18
|
+
contractKey: 'typecheck',
|
|
19
|
+
rootScript: 'typecheck',
|
|
20
|
+
templatePath: "templates/workspace-scripts/ultramodern-typecheck.mjs",
|
|
21
|
+
cwd: 'invocation'
|
|
22
|
+
}),
|
|
23
|
+
defineToolingCommand({
|
|
24
|
+
id: 'mfTypes',
|
|
25
|
+
command: 'mf-types',
|
|
26
|
+
wrapperName: 'assert-mf-types',
|
|
27
|
+
contractKey: 'mfTypes',
|
|
28
|
+
rootScript: 'mf:types'
|
|
29
|
+
}),
|
|
30
|
+
defineToolingCommand({
|
|
31
|
+
id: 'publicSurface',
|
|
32
|
+
command: 'public-surface',
|
|
33
|
+
wrapperName: 'generate-public-surface-assets',
|
|
34
|
+
contractKey: 'publicSurface',
|
|
35
|
+
templatePath: "templates/workspace-scripts/generate-public-surface-assets.mjs"
|
|
36
|
+
}),
|
|
37
|
+
defineToolingCommand({
|
|
38
|
+
id: 'backendFederationGenerate',
|
|
39
|
+
command: 'backend-federation-generate',
|
|
40
|
+
wrapperName: 'generate-node-backend-federation',
|
|
41
|
+
contractKey: 'backendFederationGenerate',
|
|
42
|
+
rootScript: 'node:backend-federation:generate',
|
|
43
|
+
templatePath: "templates/workspace-scripts/generate-node-backend-federation.mjs"
|
|
44
|
+
}),
|
|
45
|
+
defineToolingCommand({
|
|
46
|
+
id: 'backendFederationProof',
|
|
47
|
+
command: 'backend-federation-proof',
|
|
48
|
+
wrapperName: 'proof-node-backend-federation',
|
|
49
|
+
contractKey: 'backendFederationProof',
|
|
50
|
+
rootScript: 'node:proof',
|
|
51
|
+
templatePath: "templates/workspace-scripts/proof-node-backend-federation.mjs"
|
|
52
|
+
}),
|
|
53
|
+
defineToolingCommand({
|
|
54
|
+
id: 'cloudflareProof',
|
|
55
|
+
command: 'cloudflare-proof',
|
|
56
|
+
wrapperName: 'proof-cloudflare-version',
|
|
57
|
+
contractKey: 'cloudflareProof',
|
|
58
|
+
rootScript: 'cloudflare:proof',
|
|
59
|
+
templatePath: "templates/workspace-scripts/proof-cloudflare-version.mjs"
|
|
60
|
+
}),
|
|
61
|
+
defineToolingCommand({
|
|
62
|
+
id: 'cloudflareOutputVerify',
|
|
63
|
+
command: 'cloudflare-output-verify',
|
|
64
|
+
wrapperName: 'verify-cloudflare-output',
|
|
65
|
+
contractKey: 'cloudflareOutputVerify',
|
|
66
|
+
rootScript: 'cloudflare-output:verify'
|
|
67
|
+
}),
|
|
68
|
+
defineToolingCommand({
|
|
69
|
+
id: 'performanceReadiness',
|
|
70
|
+
command: 'performance-readiness',
|
|
71
|
+
wrapperName: 'ultramodern-performance-readiness',
|
|
72
|
+
contractKey: 'performanceReadiness',
|
|
73
|
+
rootScript: 'performance:readiness',
|
|
74
|
+
templatePath: "templates/workspace-scripts/ultramodern-performance-readiness.mjs"
|
|
75
|
+
}),
|
|
76
|
+
defineToolingCommand({
|
|
77
|
+
id: 'migrateStrictEffect',
|
|
78
|
+
command: 'migrate-strict-effect',
|
|
79
|
+
wrapperName: 'migrate-strict-effect',
|
|
80
|
+
contractKey: 'migrateStrictEffect',
|
|
81
|
+
rootScript: 'migrate:strict-effect'
|
|
82
|
+
}),
|
|
83
|
+
defineToolingCommand({
|
|
84
|
+
id: 'routesGenerate',
|
|
85
|
+
command: 'routes-generate',
|
|
86
|
+
wrapperName: 'generate-tanstack-routes',
|
|
87
|
+
contractKey: 'routesGenerate'
|
|
88
|
+
})
|
|
89
|
+
];
|
|
90
|
+
const toolingCommandById = Object.fromEntries(generatedToolingCommands.map((command)=>[
|
|
91
|
+
command.id,
|
|
92
|
+
command
|
|
93
|
+
]));
|
|
94
|
+
const GENERATED_TOOLING_COMMANDS = toolingCommandById;
|
|
95
|
+
const generatedToolingCommandList = ()=>generatedToolingCommands.map((command)=>command.command);
|
|
96
|
+
const createToolingWrapperContract = ()=>Object.fromEntries(generatedToolingCommands.map((command)=>[
|
|
97
|
+
command.contractKey,
|
|
98
|
+
command.wrapperPath
|
|
99
|
+
]));
|
|
100
|
+
const createGeneratedToolingWrapperMap = createToolingWrapperContract;
|
|
101
|
+
export { GENERATED_TOOLING_COMMANDS, createGeneratedToolingWrapperMap, createToolingWrapperContract, generatedToolingCommandList, generatedToolingCommands, toolingCommandById };
|
|
@@ -9,9 +9,10 @@ const CLOUDFLARE_COMPATIBILITY_DATE = '2026-06-02';
|
|
|
9
9
|
const TAILWIND_VERSION = '4.3.1';
|
|
10
10
|
const TAILWIND_POSTCSS_VERSION = '4.3.1';
|
|
11
11
|
const POSTCSS_VERSION = '8.5.15';
|
|
12
|
-
const EFFECT_VERSION = '4.0.0-beta.
|
|
13
|
-
const EFFECT_VITEST_VERSION = '4.0.0-beta.
|
|
12
|
+
const EFFECT_VERSION = '4.0.0-beta.92';
|
|
13
|
+
const EFFECT_VITEST_VERSION = '4.0.0-beta.92';
|
|
14
14
|
const EFFECT_TSGO_VERSION = '0.14.6';
|
|
15
|
+
const DRIZZLE_ORM_VERSION = '1.0.0-rc.4';
|
|
15
16
|
const TYPESCRIPT_STABLE_VERSION = '6.0.3';
|
|
16
17
|
const TYPESCRIPT_NATIVE_PREVIEW_VERSION = '7.0.0-dev.20260628.1';
|
|
17
18
|
const TYPESCRIPT_VERSION = TYPESCRIPT_STABLE_VERSION;
|
|
@@ -23,7 +24,7 @@ const I18NEXT_VERSION = '26.3.1';
|
|
|
23
24
|
const NODE_FETCH_VERSION = '^3.3.2';
|
|
24
25
|
const REACT_VERSION = '^19.2.7';
|
|
25
26
|
const REACT_DOM_VERSION = '^19.2.7';
|
|
26
|
-
const REACT_ROUTER_VERSION = '7.18.
|
|
27
|
+
const REACT_ROUTER_VERSION = '7.18.1';
|
|
27
28
|
const TYPES_REACT_VERSION = '^19.2.17';
|
|
28
29
|
const TYPES_REACT_DOM_VERSION = '^19.2.3';
|
|
29
30
|
const NODE_VERSION = '26.3.0';
|
|
@@ -36,7 +37,8 @@ const ultramodernWorkspaceVersions = {
|
|
|
36
37
|
moduleFederation: MODULE_FEDERATION_VERSION,
|
|
37
38
|
effect: EFFECT_VERSION,
|
|
38
39
|
effectVitest: EFFECT_VITEST_VERSION,
|
|
40
|
+
drizzleOrm: DRIZZLE_ORM_VERSION,
|
|
39
41
|
tailwind: TAILWIND_VERSION,
|
|
40
42
|
tailwindPostcss: TAILWIND_POSTCSS_VERSION
|
|
41
43
|
};
|
|
42
|
-
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 };
|
|
44
|
+
export { CLOUDFLARE_COMPATIBILITY_DATE, DRIZZLE_ORM_VERSION, 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 };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { appHasApi } from "./descriptors.js";
|
|
3
|
+
import { relativeRootFor } from "./naming.js";
|
|
4
|
+
import { createPublicSurfaceGenerationCommand } from "./public-surface.js";
|
|
5
|
+
import { GENERATED_TOOLING_COMMANDS } from "./tooling-command-catalog.js";
|
|
6
|
+
const toolingWrapperPath = (key)=>GENERATED_TOOLING_COMMANDS[key].wrapperPath;
|
|
7
|
+
const rootToolingScriptName = (key)=>{
|
|
8
|
+
const rootScript = GENERATED_TOOLING_COMMANDS[key].rootScript;
|
|
9
|
+
if (!rootScript) throw new Error(`Generated tooling command ${key} does not define a root package script.`);
|
|
10
|
+
return rootScript;
|
|
11
|
+
};
|
|
12
|
+
const rootToolingWrapperCommand = (key)=>`node ./${toolingWrapperPath(key)}`;
|
|
13
|
+
const relativeToolingWrapperPath = (packageDir, key)=>`${relativeRootFor(packageDir)}/${toolingWrapperPath(key)}`;
|
|
14
|
+
const packageToolingWrapperCommand = (packageDir, key)=>`node ${relativeToolingWrapperPath(packageDir, key)}`;
|
|
15
|
+
const workspaceRootPackageScriptNames = {
|
|
16
|
+
build: 'build',
|
|
17
|
+
cloudflareBuild: 'cloudflare:build',
|
|
18
|
+
cloudflareDeploy: 'cloudflare:deploy',
|
|
19
|
+
cloudflareProof: rootToolingScriptName('cloudflareProof'),
|
|
20
|
+
cloudflareOutputVerify: rootToolingScriptName('cloudflareOutputVerify'),
|
|
21
|
+
backendFederationGenerate: rootToolingScriptName('backendFederationGenerate'),
|
|
22
|
+
nodeProof: rootToolingScriptName('backendFederationProof'),
|
|
23
|
+
mfTypes: rootToolingScriptName('mfTypes'),
|
|
24
|
+
performanceReadiness: rootToolingScriptName('performanceReadiness'),
|
|
25
|
+
migrateStrictEffect: rootToolingScriptName('migrateStrictEffect'),
|
|
26
|
+
zeropsMaterialize: 'zerops:materialize',
|
|
27
|
+
contractCheck: rootToolingScriptName('validate'),
|
|
28
|
+
typecheck: 'typecheck',
|
|
29
|
+
check: 'check'
|
|
30
|
+
};
|
|
31
|
+
const workspaceAppPackageScriptNames = {
|
|
32
|
+
dev: 'dev',
|
|
33
|
+
build: 'build',
|
|
34
|
+
cloudflareBuild: 'cloudflare:build',
|
|
35
|
+
cloudflareDeploy: 'cloudflare:deploy',
|
|
36
|
+
cloudflarePreview: 'cloudflare:preview',
|
|
37
|
+
cloudflareProof: 'cloudflare:proof',
|
|
38
|
+
serve: 'serve',
|
|
39
|
+
typecheck: 'typecheck'
|
|
40
|
+
};
|
|
41
|
+
const createStrictTsgoTypecheckCommand = (packageDir)=>`${packageToolingWrapperCommand(packageDir, 'typecheck')} --project tsconfig.json`;
|
|
42
|
+
function createWorkspaceAppScriptPlan(app) {
|
|
43
|
+
const backendFederationBuildCommand = appHasApi(app) ? `${packageToolingWrapperCommand(app.directory, 'backendFederationGenerate')} --app ${app.id}` : void 0;
|
|
44
|
+
const backendFederationCloudflareBuildCommand = backendFederationBuildCommand ? `${backendFederationBuildCommand} --target dist-cloudflare` : void 0;
|
|
45
|
+
const buildSteps = [
|
|
46
|
+
'ULTRAMODERN_ZEPHYR=false modern build',
|
|
47
|
+
backendFederationBuildCommand,
|
|
48
|
+
createPublicSurfaceGenerationCommand(app, 'dist'),
|
|
49
|
+
app.exposes ? packageToolingWrapperCommand(app.directory, 'mfTypes') : void 0
|
|
50
|
+
].filter((step)=>Boolean(step));
|
|
51
|
+
const cloudflareBuildSteps = [
|
|
52
|
+
'ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern build',
|
|
53
|
+
backendFederationCloudflareBuildCommand,
|
|
54
|
+
'ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy --skip-build',
|
|
55
|
+
createPublicSurfaceGenerationCommand(app, 'cloudflare'),
|
|
56
|
+
`${packageToolingWrapperCommand(app.directory, 'cloudflareOutputVerify')} --app ${app.id}`
|
|
57
|
+
].filter((step)=>Boolean(step));
|
|
58
|
+
return {
|
|
59
|
+
dev: 'modern dev',
|
|
60
|
+
build: buildSteps.join(' && '),
|
|
61
|
+
cloudflareBuild: cloudflareBuildSteps.join(' && '),
|
|
62
|
+
cloudflareDeploy: 'ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json',
|
|
63
|
+
cloudflarePreview: 'pnpm run cloudflare:build && wrangler dev --config .output/wrangler.json',
|
|
64
|
+
cloudflareProof: `${packageToolingWrapperCommand(app.directory, 'cloudflareProof')} --app ${app.id}`,
|
|
65
|
+
serve: 'modern serve',
|
|
66
|
+
typecheck: createStrictTsgoTypecheckCommand(app.directory)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function createWorkspaceAppPackageScripts(app) {
|
|
70
|
+
const plan = createWorkspaceAppScriptPlan(app);
|
|
71
|
+
return Object.fromEntries(Object.entries(workspaceAppPackageScriptNames).map(([planKey, packageScriptName])=>[
|
|
72
|
+
packageScriptName,
|
|
73
|
+
plan[planKey]
|
|
74
|
+
]));
|
|
75
|
+
}
|
|
76
|
+
function createWorkspaceRootScriptPlan(remotes = [], options = {}) {
|
|
77
|
+
const hasRemotes = remotes.length > 0;
|
|
78
|
+
const mfTypesScript = rootToolingScriptName('mfTypes');
|
|
79
|
+
const performanceReadinessScript = rootToolingScriptName('performanceReadiness');
|
|
80
|
+
const cloudflareOutputVerifyScript = rootToolingScriptName('cloudflareOutputVerify');
|
|
81
|
+
const backendFederationGenerateScript = rootToolingScriptName('backendFederationGenerate');
|
|
82
|
+
const nodeProofScript = rootToolingScriptName('backendFederationProof');
|
|
83
|
+
const bridgeCheck = options.bridgeCheck ?? '';
|
|
84
|
+
const remoteBuildPrefix = hasRemotes ? 'ULTRAMODERN_ZEPHYR=false pnpm -r --filter "./verticals/*" run build && ' : '';
|
|
85
|
+
const remoteCloudflareBuildPrefix = hasRemotes ? 'pnpm -r --filter "./verticals/*" run cloudflare:build && ' : '';
|
|
86
|
+
const remoteCloudflareDeployPrefix = hasRemotes ? 'pnpm -r --filter "./verticals/*" run cloudflare:deploy && ' : '';
|
|
87
|
+
return {
|
|
88
|
+
build: `${remoteBuildPrefix}ULTRAMODERN_ZEPHYR=false pnpm --filter "./apps/shell-super-app" run build && pnpm ${mfTypesScript} && pnpm ${performanceReadinessScript}`,
|
|
89
|
+
cloudflareBuild: `${remoteCloudflareBuildPrefix}pnpm --filter "./apps/shell-super-app" run cloudflare:build && pnpm ${mfTypesScript} && pnpm ${cloudflareOutputVerifyScript}`,
|
|
90
|
+
cloudflareDeploy: `${remoteCloudflareDeployPrefix}pnpm --filter "./apps/shell-super-app" run cloudflare:deploy`,
|
|
91
|
+
cloudflareProof: `${rootToolingWrapperCommand('cloudflareProof')} --out .codex/reports/cloudflare-version-proof/public-url-proof.json`,
|
|
92
|
+
cloudflareOutputVerify: rootToolingWrapperCommand('cloudflareOutputVerify'),
|
|
93
|
+
backendFederationGenerate: rootToolingWrapperCommand('backendFederationGenerate'),
|
|
94
|
+
nodeProof: rootToolingWrapperCommand('backendFederationProof'),
|
|
95
|
+
mfTypes: rootToolingWrapperCommand('mfTypes'),
|
|
96
|
+
performanceReadiness: rootToolingWrapperCommand('performanceReadiness'),
|
|
97
|
+
migrateStrictEffect: rootToolingWrapperCommand('migrateStrictEffect'),
|
|
98
|
+
zeropsMaterialize: "node ./scripts/materialize-zerops-runtime.mjs",
|
|
99
|
+
contractCheck: rootToolingWrapperCommand('validate'),
|
|
100
|
+
typecheck: options.typecheck ?? `${rootToolingWrapperCommand('typecheck')} --project tsconfig.json`,
|
|
101
|
+
check: `pnpm format:check && pnpm lint && pnpm typecheck && pnpm skills:check && pnpm i18n:boundaries && pnpm api:check && pnpm contract:check${hasRemotes ? ` && pnpm ${backendFederationGenerateScript} && pnpm ${nodeProofScript}` : ''} && pnpm performance:readiness${bridgeCheck}`
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function createWorkspaceRootPackageScripts(remotes = [], options = {}) {
|
|
105
|
+
const plan = createWorkspaceRootScriptPlan(remotes, options);
|
|
106
|
+
return Object.fromEntries(Object.entries(workspaceRootPackageScriptNames).map(([planKey, packageScriptName])=>[
|
|
107
|
+
packageScriptName,
|
|
108
|
+
plan[planKey]
|
|
109
|
+
]));
|
|
110
|
+
}
|
|
111
|
+
export { createStrictTsgoTypecheckCommand, createWorkspaceAppPackageScripts, createWorkspaceAppScriptPlan, createWorkspaceRootPackageScripts, createWorkspaceRootScriptPlan, packageToolingWrapperCommand, rootToolingScriptName, rootToolingWrapperCommand, workspaceAppPackageScriptNames, workspaceRootPackageScriptNames };
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import node_fs from "node:fs";
|
|
3
3
|
import node_path from "node:path";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { packageName, tailwindPrefixForApp } from "./naming.js";
|
|
9
|
-
import { createCloudflareSecurityContract } from "./policy.js";
|
|
10
|
-
import { publicSurfaceManagedSourceAssetPaths } from "./public-surface.js";
|
|
11
|
-
import { createLocalisedUrlsMap, createRouteMetaFilePath, createRouteOwnedI18nPaths, createRoutePageFilePath } from "./routes.js";
|
|
12
|
-
import { CLOUDFLARE_COMPATIBILITY_DATE, NODE_VERSION, PNPM_VERSION } from "./versions.js";
|
|
4
|
+
import { readFileTemplate, renderFileTemplate, workspaceTemplateDir, writeFileReplacing } from "./fs-io.js";
|
|
5
|
+
import { GENERATED_TOOLING_COMMANDS, generatedToolingCommands } from "./tooling-command-catalog.js";
|
|
6
|
+
import { createWorkspaceValidationContract } from "./workspace-validation-contract.js";
|
|
7
|
+
const singleQuoted = (value)=>`'${value.replace(/'/gu, "\\'")}'`;
|
|
13
8
|
function createToolWrapperScript(command, extraArgs = []) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
9
|
+
const commandLiteral = singleQuoted(command);
|
|
10
|
+
const extraArgsLiteral = `[${extraArgs.map(singleQuoted).join(', ')}]`;
|
|
16
11
|
return `#!/usr/bin/env node
|
|
17
12
|
import { spawnSync } from 'node:child_process';
|
|
18
13
|
import path from 'node:path';
|
|
@@ -23,7 +18,7 @@ const forwardedArgs = process.argv.slice(2);
|
|
|
23
18
|
const workspaceRoot =
|
|
24
19
|
process.env.ULTRAMODERN_WORKSPACE_ROOT ??
|
|
25
20
|
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
26
|
-
const ultramodernArgs = ['ultramodern', ${
|
|
21
|
+
const ultramodernArgs = ['ultramodern', ${commandLiteral}, ...${extraArgsLiteral}, ...forwardedArgs];
|
|
27
22
|
const result = createBin
|
|
28
23
|
? spawnSync(process.execPath, [createBin, ...ultramodernArgs], {
|
|
29
24
|
env: { ...process.env, ULTRAMODERN_WORKSPACE_ROOT: workspaceRoot },
|
|
@@ -43,6 +38,13 @@ if (result.error) {
|
|
|
43
38
|
process.exit(result.status ?? 1);
|
|
44
39
|
`;
|
|
45
40
|
}
|
|
41
|
+
function writeGeneratedToolWrapperScript(targetDir, key) {
|
|
42
|
+
const command = GENERATED_TOOLING_COMMANDS[key];
|
|
43
|
+
writeWorkspaceOwnedMtsScript(targetDir, command.wrapperName, createToolWrapperScript(command.command));
|
|
44
|
+
}
|
|
45
|
+
function writeGeneratedToolWrapperScripts(targetDir) {
|
|
46
|
+
for (const command of generatedToolingCommands)writeGeneratedToolWrapperScript(targetDir, command.id);
|
|
47
|
+
}
|
|
46
48
|
function createSkillsToolWrapperScript() {
|
|
47
49
|
return `#!/usr/bin/env node
|
|
48
50
|
import { spawnSync } from 'node:child_process';
|
|
@@ -97,52 +99,24 @@ function migrateCopiedWorkspaceScriptToMts(targetDir, name) {
|
|
|
97
99
|
node_fs.renameSync(legacyPath, migratedPath);
|
|
98
100
|
}
|
|
99
101
|
function createWorkspaceValidationScript(scope, enableTailwind, remotes = []) {
|
|
100
|
-
const
|
|
101
|
-
id: remote.id,
|
|
102
|
-
domain: remote.domain,
|
|
103
|
-
stem: remote.api.stem,
|
|
104
|
-
group: verticalApiGroupName(remote),
|
|
105
|
-
path: remote.directory,
|
|
106
|
-
port: remote.port,
|
|
107
|
-
mfName: remote.mfName,
|
|
108
|
-
apiPrefix: remote.api.prefix,
|
|
109
|
-
tailwindPrefix: tailwindPrefixForApp(remote),
|
|
110
|
-
zephyrAlias: remoteDependencyAlias(remote),
|
|
111
|
-
packageName: packageName(scope, remote.packageSuffix),
|
|
112
|
-
exposes: Object.keys(remote.exposes ?? {}),
|
|
113
|
-
componentPaths: Object.keys(remote.exposes ?? {}).map((expose)=>remoteComponentOutputPath(remote, expose)).filter((componentPath)=>Boolean(componentPath)),
|
|
114
|
-
namespace: appI18nNamespace(remote),
|
|
115
|
-
routePagePaths: createRouteOwnedI18nPaths(remote).filter((route)=>'/' !== route.canonicalPath).map((route)=>createRoutePageFilePath(remote, route.canonicalPath)),
|
|
116
|
-
routeMetaPaths: createRouteOwnedI18nPaths(remote).map((route)=>createRouteMetaFilePath(remote, route.canonicalPath)),
|
|
117
|
-
localisedUrls: createLocalisedUrlsMap(remote),
|
|
118
|
-
verticalRefs: remote.verticalRefs ?? []
|
|
119
|
-
}));
|
|
120
|
-
const shellRouteMetaPaths = createRouteOwnedI18nPaths(shellApp).map((route)=>createRouteMetaFilePath(shellApp, route.canonicalPath));
|
|
121
|
-
const shellNamespace = appI18nNamespace(shellApp);
|
|
122
|
-
const oldRemotePaths = [
|
|
123
|
-
'apps/remotes'
|
|
124
|
-
];
|
|
125
|
-
const expectedBuildScript = remotes.length > 0 ? 'ULTRAMODERN_ZEPHYR=false pnpm -r --filter "./verticals/*" run build && ULTRAMODERN_ZEPHYR=false pnpm --filter "./apps/shell-super-app" run build && pnpm mf:types && pnpm performance:readiness' : 'ULTRAMODERN_ZEPHYR=false pnpm --filter "./apps/shell-super-app" run build && pnpm mf:types && pnpm performance:readiness';
|
|
126
|
-
const expectedCloudflareBuildScript = remotes.length > 0 ? 'pnpm -r --filter "./verticals/*" run cloudflare:build && pnpm --filter "./apps/shell-super-app" run cloudflare:build && pnpm mf:types' : 'pnpm --filter "./apps/shell-super-app" run cloudflare:build && pnpm mf:types';
|
|
127
|
-
const expectedCloudflareDeployScript = remotes.length > 0 ? 'pnpm -r --filter "./verticals/*" run cloudflare:deploy && pnpm --filter "./apps/shell-super-app" run cloudflare:deploy' : 'pnpm --filter "./apps/shell-super-app" run cloudflare:deploy';
|
|
128
|
-
const expectedCloudflareSecurity = createCloudflareSecurityContract();
|
|
102
|
+
const contract = createWorkspaceValidationContract(scope, enableTailwind, remotes);
|
|
129
103
|
return renderFileTemplate("workspace-scripts/validate-ultramodern-workspace.mjs", {
|
|
130
|
-
packageScope:
|
|
131
|
-
nodeVersion:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
publicSurfaceManagedSourceAssetPathsJson: JSON.stringify(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
cloudflareCompatibilityDate:
|
|
104
|
+
packageScope: contract.packageScope,
|
|
105
|
+
nodeVersion: contract.versions.node,
|
|
106
|
+
tailwindEnabledJson: JSON.stringify(contract.tailwindEnabled),
|
|
107
|
+
fullStackVerticalsJson: JSON.stringify(contract.fullStackVerticals, null, 2),
|
|
108
|
+
shellNamespaceJson: JSON.stringify(contract.shellNamespace),
|
|
109
|
+
oldRemotePathsJson: JSON.stringify(contract.oldRemotePaths),
|
|
110
|
+
expectedBuildScriptJson: JSON.stringify(contract.scripts.build),
|
|
111
|
+
expectedCloudflareBuildScriptJson: JSON.stringify(contract.scripts.cloudflareBuild),
|
|
112
|
+
expectedCloudflareDeployScriptJson: JSON.stringify(contract.scripts.cloudflareDeploy),
|
|
113
|
+
expectedCloudflareSecurityJson: JSON.stringify(contract.cloudflareSecurity, null, 2),
|
|
114
|
+
workspaceValidationContractJson: JSON.stringify(contract, null, 2),
|
|
115
|
+
publicSurfaceManagedSourceAssetPathsJson: JSON.stringify(contract.publicSurfaceManagedSourceAssetPaths, null, 2),
|
|
116
|
+
shellRouteMetaPathsJson: JSON.stringify(contract.shellRouteMetaPaths, null, 2),
|
|
117
|
+
effectVersion: contract.versions.effect,
|
|
118
|
+
moduleFederationVersion: contract.versions.moduleFederation,
|
|
119
|
+
cloudflareCompatibilityDate: contract.versions.cloudflareCompatibilityDate
|
|
146
120
|
});
|
|
147
121
|
}
|
|
148
122
|
function createWorkspaceI18nBoundaryValidationScript() {
|
|
@@ -154,18 +128,67 @@ function createWorkspaceApiBoundaryValidationScript() {
|
|
|
154
128
|
function createPerformanceReadinessConfigScript() {
|
|
155
129
|
return readFileTemplate("workspace-scripts/ultramodern-performance-readiness.config.mjs");
|
|
156
130
|
}
|
|
131
|
+
function createNodeBackendFederationProofScript() {
|
|
132
|
+
return readFileTemplate("workspace-scripts/proof-node-backend-federation.mjs");
|
|
133
|
+
}
|
|
134
|
+
function createZeropsRuntimeMaterializationScript() {
|
|
135
|
+
return readFileTemplate("workspace-scripts/materialize-zerops-runtime.mjs");
|
|
136
|
+
}
|
|
157
137
|
function writeGeneratedWorkspaceScripts(targetDir, _scope, _enableTailwind, _remotes = []) {
|
|
158
|
-
writeWorkspaceOwnedMtsScript(targetDir, 'assert-mf-types', createToolWrapperScript('mf-types'));
|
|
159
|
-
writeWorkspaceOwnedMtsScript(targetDir, 'validate-ultramodern-workspace', createToolWrapperScript('validate'));
|
|
160
138
|
writeWorkspaceOwnedMtsScript(targetDir, 'check-ultramodern-i18n-boundaries', createWorkspaceI18nBoundaryValidationScript());
|
|
161
139
|
writeWorkspaceOwnedMtsScript(targetDir, 'check-ultramodern-api-boundaries', createWorkspaceApiBoundaryValidationScript());
|
|
162
|
-
|
|
163
|
-
writeWorkspaceOwnedMtsScript(targetDir, 'proof-cloudflare-version', createToolWrapperScript('cloudflare-proof'));
|
|
140
|
+
writeFileReplacing(targetDir, "scripts/materialize-zerops-runtime.mjs", createZeropsRuntimeMaterializationScript());
|
|
164
141
|
writeFileReplacing(targetDir, "scripts/ultramodern-performance-readiness.config.mjs", createPerformanceReadinessConfigScript());
|
|
165
|
-
|
|
166
|
-
writeWorkspaceOwnedMtsScript(targetDir, 'migrate-strict-effect', createToolWrapperScript('migrate-strict-effect'));
|
|
167
|
-
writeWorkspaceOwnedMtsScript(targetDir, 'ultramodern-typecheck', createToolWrapperScript('typecheck'));
|
|
142
|
+
writeGeneratedToolWrapperScripts(targetDir);
|
|
168
143
|
writeWorkspaceOwnedMtsScript(targetDir, 'bootstrap-agent-skills', createSkillsToolWrapperScript());
|
|
169
144
|
migrateCopiedWorkspaceScriptToMts(targetDir, 'setup-agent-reference-repos');
|
|
170
145
|
}
|
|
171
|
-
|
|
146
|
+
function createAgentReferenceReposSetupScript() {
|
|
147
|
+
return node_fs.readFileSync(node_path.join(workspaceTemplateDir, "scripts/setup-agent-reference-repos.mjs"), 'utf-8');
|
|
148
|
+
}
|
|
149
|
+
const BACKEND_FEDERATION_WRAPPER_IDS = new Set([
|
|
150
|
+
'backendFederationGenerate',
|
|
151
|
+
'backendFederationProof'
|
|
152
|
+
]);
|
|
153
|
+
function migratedWorkspaceScriptArtifacts(options) {
|
|
154
|
+
const artifacts = [
|
|
155
|
+
{
|
|
156
|
+
relativePath: "scripts/check-ultramodern-i18n-boundaries.mts",
|
|
157
|
+
content: createWorkspaceI18nBoundaryValidationScript(),
|
|
158
|
+
legacyPath: "scripts/check-ultramodern-i18n-boundaries.mjs"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
relativePath: "scripts/check-ultramodern-api-boundaries.mts",
|
|
162
|
+
content: createWorkspaceApiBoundaryValidationScript(),
|
|
163
|
+
legacyPath: "scripts/check-ultramodern-api-boundaries.mjs"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
relativePath: "scripts/ultramodern-performance-readiness.config.mjs",
|
|
167
|
+
content: createPerformanceReadinessConfigScript()
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
relativePath: "scripts/bootstrap-agent-skills.mts",
|
|
171
|
+
content: createSkillsToolWrapperScript(),
|
|
172
|
+
legacyPath: "scripts/bootstrap-agent-skills.mjs"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
relativePath: "scripts/setup-agent-reference-repos.mts",
|
|
176
|
+
content: createAgentReferenceReposSetupScript(),
|
|
177
|
+
legacyPath: "scripts/setup-agent-reference-repos.mjs"
|
|
178
|
+
}
|
|
179
|
+
];
|
|
180
|
+
for (const command of generatedToolingCommands)if (!(options.shellOnly && BACKEND_FEDERATION_WRAPPER_IDS.has(command.id))) artifacts.push({
|
|
181
|
+
relativePath: command.wrapperPath,
|
|
182
|
+
content: createToolWrapperScript(command.command),
|
|
183
|
+
legacyPath: command.wrapperPath.replace(/\.mts$/u, '.mjs')
|
|
184
|
+
});
|
|
185
|
+
return artifacts;
|
|
186
|
+
}
|
|
187
|
+
const migratedWorkspaceScriptBasenames = [
|
|
188
|
+
'check-ultramodern-i18n-boundaries',
|
|
189
|
+
'check-ultramodern-api-boundaries',
|
|
190
|
+
'bootstrap-agent-skills',
|
|
191
|
+
'setup-agent-reference-repos',
|
|
192
|
+
...generatedToolingCommands.map((command)=>command.wrapperName)
|
|
193
|
+
];
|
|
194
|
+
export { createAgentReferenceReposSetupScript, createNodeBackendFederationProofScript, createPerformanceReadinessConfigScript, createWorkspaceApiBoundaryValidationScript, createWorkspaceI18nBoundaryValidationScript, createWorkspaceValidationScript, createZeropsRuntimeMaterializationScript, migratedWorkspaceScriptArtifacts, migratedWorkspaceScriptBasenames, writeGeneratedToolWrapperScripts, writeGeneratedWorkspaceScripts };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { verticalApiGroupName } from "./api.js";
|
|
3
|
+
import { createBackendFederationMetadata } from "./backend-federation.js";
|
|
4
|
+
import { createDeliveryUnitRecord } from "./delivery-unit.js";
|
|
5
|
+
import { remoteComponentOutputPath } from "./demo-components.js";
|
|
6
|
+
import { appHasApi, appI18nNamespace, remoteDependencyAlias, shellApp } from "./descriptors.js";
|
|
7
|
+
import { packageName, tailwindPrefixForApp } from "./naming.js";
|
|
8
|
+
import { createCloudflareSecurityContract } from "./policy.js";
|
|
9
|
+
import { publicSurfaceManagedSourceAssetPaths } from "./public-surface.js";
|
|
10
|
+
import { createLocalisedUrlsMap, createRouteMetaFilePath, createRouteOwnedI18nPaths, createRoutePageFilePath } from "./routes.js";
|
|
11
|
+
import { CLOUDFLARE_COMPATIBILITY_DATE, EFFECT_VERSION, MODULE_FEDERATION_VERSION, NODE_VERSION, PNPM_VERSION } from "./versions.js";
|
|
12
|
+
import { createWorkspaceRootPackageScripts, createWorkspaceRootScriptPlan } from "./workspace-script-plan.js";
|
|
13
|
+
function createWorkspaceValidationContract(scope, enableTailwind, remotes = []) {
|
|
14
|
+
const fullStackVerticals = remotes.filter(appHasApi).map((remote)=>({
|
|
15
|
+
id: remote.id,
|
|
16
|
+
domain: remote.domain,
|
|
17
|
+
stem: remote.api.stem,
|
|
18
|
+
group: verticalApiGroupName(remote),
|
|
19
|
+
path: remote.directory,
|
|
20
|
+
port: remote.port,
|
|
21
|
+
mfName: remote.mfName,
|
|
22
|
+
apiPrefix: remote.api.prefix,
|
|
23
|
+
tailwindPrefix: tailwindPrefixForApp(remote),
|
|
24
|
+
zephyrAlias: remoteDependencyAlias(remote),
|
|
25
|
+
packageName: packageName(scope, remote.packageSuffix),
|
|
26
|
+
backendFederation: createBackendFederationMetadata(scope, remote),
|
|
27
|
+
deliveryUnit: createDeliveryUnitRecord(scope, remote),
|
|
28
|
+
exposes: Object.keys(remote.exposes ?? {}),
|
|
29
|
+
componentPaths: Object.keys(remote.exposes ?? {}).map((expose)=>remoteComponentOutputPath(remote, expose)).filter((componentPath)=>Boolean(componentPath)),
|
|
30
|
+
namespace: appI18nNamespace(remote),
|
|
31
|
+
routePagePaths: createRouteOwnedI18nPaths(remote).filter((route)=>'/' !== route.canonicalPath).map((route)=>createRoutePageFilePath(remote, route.canonicalPath)),
|
|
32
|
+
routeMetaPaths: createRouteOwnedI18nPaths(remote).map((route)=>createRouteMetaFilePath(remote, route.canonicalPath)),
|
|
33
|
+
localisedUrls: createLocalisedUrlsMap(remote),
|
|
34
|
+
verticalRefs: remote.verticalRefs ?? []
|
|
35
|
+
}));
|
|
36
|
+
return {
|
|
37
|
+
packageScope: scope,
|
|
38
|
+
versions: {
|
|
39
|
+
cloudflareCompatibilityDate: CLOUDFLARE_COMPATIBILITY_DATE,
|
|
40
|
+
effect: EFFECT_VERSION,
|
|
41
|
+
moduleFederation: MODULE_FEDERATION_VERSION,
|
|
42
|
+
node: NODE_VERSION,
|
|
43
|
+
pnpm: PNPM_VERSION
|
|
44
|
+
},
|
|
45
|
+
tailwindEnabled: enableTailwind,
|
|
46
|
+
fullStackVerticals,
|
|
47
|
+
shellNamespace: appI18nNamespace(shellApp),
|
|
48
|
+
oldRemotePaths: [
|
|
49
|
+
'apps/remotes'
|
|
50
|
+
],
|
|
51
|
+
scripts: createWorkspaceRootScriptPlan(remotes),
|
|
52
|
+
packageScripts: createWorkspaceRootPackageScripts(remotes),
|
|
53
|
+
cloudflareSecurity: createCloudflareSecurityContract(),
|
|
54
|
+
publicSurfaceManagedSourceAssetPaths: [
|
|
55
|
+
...publicSurfaceManagedSourceAssetPaths
|
|
56
|
+
],
|
|
57
|
+
shellRouteMetaPaths: createRouteOwnedI18nPaths(shellApp).map((route)=>createRouteMetaFilePath(shellApp, route.canonicalPath))
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export { createWorkspaceValidationContract };
|