@bleedingdev/modern-js-create 3.5.0-ultramodern.12 → 3.5.0-ultramodern.13
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/dist/cjs/ultramodern-tooling/commands.cjs +20 -5
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +7 -3
- package/dist/cjs/ultramodern-workspace/package-json.cjs +1 -2
- package/dist/esm/ultramodern-tooling/commands.js +20 -5
- package/dist/esm/ultramodern-workspace/module-federation.js +7 -3
- package/dist/esm/ultramodern-workspace/package-json.js +1 -2
- package/dist/esm-node/ultramodern-tooling/commands.js +20 -5
- package/dist/esm-node/ultramodern-workspace/module-federation.js +7 -3
- package/dist/esm-node/ultramodern-workspace/package-json.js +1 -2
- package/package.json +3 -3
- package/template-workspace/.gitignore.handlebars +1 -0
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +18 -6
|
@@ -54,6 +54,7 @@ const external_create_package_root_cjs_namespaceObject = require("../create-pack
|
|
|
54
54
|
const external_ultramodern_package_source_cjs_namespaceObject = require("../ultramodern-package-source.cjs");
|
|
55
55
|
const app_files_cjs_namespaceObject = require("../ultramodern-workspace/app-files.cjs");
|
|
56
56
|
const mf_validation_cjs_namespaceObject = require("../ultramodern-workspace/mf-validation.cjs");
|
|
57
|
+
const module_federation_cjs_namespaceObject = require("../ultramodern-workspace/module-federation.cjs");
|
|
57
58
|
const package_json_cjs_namespaceObject = require("../ultramodern-workspace/package-json.cjs");
|
|
58
59
|
const versions_cjs_namespaceObject = require("../ultramodern-workspace/versions.cjs");
|
|
59
60
|
const workspace_scripts_cjs_namespaceObject = require("../ultramodern-workspace/workspace-scripts.cjs");
|
|
@@ -266,9 +267,14 @@ function updateGeneratedPackageScripts(packageJson) {
|
|
|
266
267
|
if (!scripts || 'object' != typeof scripts || Array.isArray(scripts)) return false;
|
|
267
268
|
let changed = false;
|
|
268
269
|
const cloudflareBuild = scripts['cloudflare:build'];
|
|
269
|
-
if ('string' == typeof cloudflareBuild
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
if ('string' == typeof cloudflareBuild) {
|
|
271
|
+
let nextCloudflareBuild = cloudflareBuild;
|
|
272
|
+
if (nextCloudflareBuild.includes(cloudflareModernDeployCommand) && !nextCloudflareBuild.includes(cloudflareModernDeploySkipBuildCommand)) nextCloudflareBuild = nextCloudflareBuild.replace(cloudflareModernDeployCommand, cloudflareModernDeploySkipBuildCommand);
|
|
273
|
+
nextCloudflareBuild = nextCloudflareBuild.replace(/ && node \S*scripts\/generate-public-surface-assets\.m[ct]s --app [^&]+ --target dist(?= && ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy --skip-build)/u, '');
|
|
274
|
+
if (nextCloudflareBuild !== cloudflareBuild) {
|
|
275
|
+
scripts['cloudflare:build'] = nextCloudflareBuild;
|
|
276
|
+
changed = true;
|
|
277
|
+
}
|
|
272
278
|
}
|
|
273
279
|
const cloudflareDeploy = scripts['cloudflare:deploy'];
|
|
274
280
|
if ('string' == typeof cloudflareDeploy && cloudflareDeploy.includes(cloudflareWranglerDeployInvalidSkipBuildCommand)) {
|
|
@@ -571,7 +577,8 @@ function ensureGeneratedIgnoreRules(workspaceRoot) {
|
|
|
571
577
|
let changed = false;
|
|
572
578
|
for (const rule of [
|
|
573
579
|
'.mf/',
|
|
574
|
-
'**/.mf/'
|
|
580
|
+
'**/.mf/',
|
|
581
|
+
'dist-cloudflare/'
|
|
575
582
|
])if (!lines.includes(rule)) {
|
|
576
583
|
lines.push(rule);
|
|
577
584
|
changed = true;
|
|
@@ -598,6 +605,12 @@ function updateGeneratedTypeScriptSurfaces(workspaceRoot, config) {
|
|
|
598
605
|
}
|
|
599
606
|
return changed;
|
|
600
607
|
}
|
|
608
|
+
function updateGeneratedModernConfigs(workspaceRoot, config) {
|
|
609
|
+
let changed = false;
|
|
610
|
+
const apps = (0, external_config_cjs_namespaceObject.workspaceAppsFromToolingConfig)(config);
|
|
611
|
+
for (const app of apps)changed = writeTextIfChanged(external_node_path_default().join(workspaceRoot, app.directory, 'modern.config.ts'), (0, module_federation_cjs_namespaceObject.createAppModernConfig)(config.workspace.packageScope, app)) || changed;
|
|
612
|
+
return changed;
|
|
613
|
+
}
|
|
601
614
|
function updateReferenceTopology(workspaceRoot) {
|
|
602
615
|
const topologyPath = external_node_path_default().join(workspaceRoot, 'topology/reference-topology.json');
|
|
603
616
|
if (!external_node_fs_default().existsSync(topologyPath)) return false;
|
|
@@ -671,7 +684,9 @@ and pnpm contract:check.
|
|
|
671
684
|
const packageSource = createMigrationPackageSource(args, current);
|
|
672
685
|
updateUltramodernConfig(context.workspaceRoot, packageSource);
|
|
673
686
|
updateReferenceTopology(context.workspaceRoot);
|
|
674
|
-
|
|
687
|
+
const migrated = (0, external_config_cjs_namespaceObject.readUltramodernConfig)(context.workspaceRoot);
|
|
688
|
+
updateGeneratedTypeScriptSurfaces(context.workspaceRoot, migrated);
|
|
689
|
+
updateGeneratedModernConfigs(context.workspaceRoot, migrated);
|
|
675
690
|
for (const relativePackageFile of listWorkspacePackageFiles(context.workspaceRoot)){
|
|
676
691
|
const packageFile = external_node_path_default().join(context.workspaceRoot, relativePackageFile);
|
|
677
692
|
const packageJson = readJsonFile(packageFile);
|
|
@@ -144,8 +144,10 @@ ${defaultAssetPrefixSource}
|
|
|
144
144
|
// load remoteEntry.js and exposed chunks from the remote origin, not the host.
|
|
145
145
|
const assetPrefix =
|
|
146
146
|
configuredModernAssetPrefix || configuredUltramodernAssetPrefix || defaultAssetPrefix;
|
|
147
|
-
const
|
|
148
|
-
const
|
|
147
|
+
const buildTarget = cloudflareDeployEnabled ? 'cloudflare' : 'web';
|
|
148
|
+
const buildOutputRoot = cloudflareDeployEnabled ? 'dist-cloudflare' : 'dist';
|
|
149
|
+
const buildTempDirectory = \`node_modules/.modern-js-\${appId}-\${buildTarget}\`;
|
|
150
|
+
const buildCacheDirectory = \`node_modules/.cache/rspack-\${appId}-\${buildTarget}\`;
|
|
149
151
|
|
|
150
152
|
if (
|
|
151
153
|
cloudflareDeployEnabled &&
|
|
@@ -187,13 +189,15 @@ ${bffConfig} ...(cloudflareDeployEnabled
|
|
|
187
189
|
disableTsChecker: false,
|
|
188
190
|
distPath: {
|
|
189
191
|
html: './',
|
|
192
|
+
root: buildOutputRoot,
|
|
190
193
|
},
|
|
191
194
|
polyfill: 'off',
|
|
192
195
|
splitRouteChunks: true,
|
|
196
|
+
tempDir: buildTempDirectory,
|
|
193
197
|
},
|
|
194
198
|
performance: {
|
|
195
199
|
buildCache: {
|
|
196
|
-
cacheDigest: [appId,
|
|
200
|
+
cacheDigest: [appId, buildTarget],
|
|
197
201
|
cacheDirectory: buildCacheDirectory,
|
|
198
202
|
},
|
|
199
203
|
rsdoctor: {
|
|
@@ -412,7 +412,6 @@ function createRootTsConfig(apps = []) {
|
|
|
412
412
|
}
|
|
413
413
|
function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [], bridge) {
|
|
414
414
|
const publicSurfaceBuildCommand = (0, external_public_surface_cjs_namespaceObject.createPublicSurfaceGenerationCommand)(app, 'dist');
|
|
415
|
-
const publicSurfaceCloudflareBuildCommand = (0, external_public_surface_cjs_namespaceObject.createPublicSurfaceGenerationCommand)(app, 'dist');
|
|
416
415
|
const publicSurfaceCloudflareOutputCommand = (0, external_public_surface_cjs_namespaceObject.createPublicSurfaceGenerationCommand)(app, 'cloudflare');
|
|
417
416
|
const packageExports = Object.fromEntries(Object.entries(app.exposes ?? {}).map(([expose, source])=>[
|
|
418
417
|
expose,
|
|
@@ -425,7 +424,7 @@ function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [
|
|
|
425
424
|
scripts: {
|
|
426
425
|
dev: 'modern dev',
|
|
427
426
|
build: app.exposes ? `ULTRAMODERN_ZEPHYR=false modern build && ${publicSurfaceBuildCommand} && node ${(0, external_naming_cjs_namespaceObject.relativeRootFor)(app.directory)}/scripts/assert-mf-types.mts` : `ULTRAMODERN_ZEPHYR=false modern build && ${publicSurfaceBuildCommand}`,
|
|
428
|
-
'cloudflare:build': `ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern build &&
|
|
427
|
+
'cloudflare:build': `ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern build && ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy --skip-build && ${publicSurfaceCloudflareOutputCommand}`,
|
|
429
428
|
'cloudflare:deploy': 'ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json',
|
|
430
429
|
'cloudflare:preview': 'pnpm run cloudflare:build && wrangler dev --config .output/wrangler.json',
|
|
431
430
|
'cloudflare:proof': `node ${(0, external_naming_cjs_namespaceObject.relativeRootFor)(app.directory)}/scripts/proof-cloudflare-version.mts --app ${app.id}`,
|
|
@@ -7,6 +7,7 @@ import { resolveCreatePackageRoot } from "../create-package-root.js";
|
|
|
7
7
|
import { BLEEDINGDEV_PACKAGE_NAME_PREFIX, BLEEDINGDEV_PACKAGE_SCOPE, ULTRAMODERN_SINGLE_APP_MODERN_PACKAGES, ULTRAMODERN_WORKSPACE_MODERN_PACKAGES, WORKSPACE_PACKAGE_VERSION, modernPackageSpecifier } from "../ultramodern-package-source.js";
|
|
8
8
|
import { createAppEnvDts } from "../ultramodern-workspace/app-files.js";
|
|
9
9
|
import { validateModuleFederationTypes } from "../ultramodern-workspace/mf-validation.js";
|
|
10
|
+
import { createAppModernConfig } from "../ultramodern-workspace/module-federation.js";
|
|
10
11
|
import { createAppMfTypesTsConfig, createAppTsConfig, createSharedPackageTsConfig, createTsConfigBase } from "../ultramodern-workspace/package-json.js";
|
|
11
12
|
import { DRIZZLE_ORM_VERSION, EFFECT_TSGO_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, OXFMT_VERSION, OXLINT_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "../ultramodern-workspace/versions.js";
|
|
12
13
|
import { createWorkspaceValidationScript } from "../ultramodern-workspace/workspace-scripts.js";
|
|
@@ -219,9 +220,14 @@ function updateGeneratedPackageScripts(packageJson) {
|
|
|
219
220
|
if (!scripts || 'object' != typeof scripts || Array.isArray(scripts)) return false;
|
|
220
221
|
let changed = false;
|
|
221
222
|
const cloudflareBuild = scripts['cloudflare:build'];
|
|
222
|
-
if ('string' == typeof cloudflareBuild
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
if ('string' == typeof cloudflareBuild) {
|
|
224
|
+
let nextCloudflareBuild = cloudflareBuild;
|
|
225
|
+
if (nextCloudflareBuild.includes(cloudflareModernDeployCommand) && !nextCloudflareBuild.includes(cloudflareModernDeploySkipBuildCommand)) nextCloudflareBuild = nextCloudflareBuild.replace(cloudflareModernDeployCommand, cloudflareModernDeploySkipBuildCommand);
|
|
226
|
+
nextCloudflareBuild = nextCloudflareBuild.replace(/ && node \S*scripts\/generate-public-surface-assets\.m[ct]s --app [^&]+ --target dist(?= && ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy --skip-build)/u, '');
|
|
227
|
+
if (nextCloudflareBuild !== cloudflareBuild) {
|
|
228
|
+
scripts['cloudflare:build'] = nextCloudflareBuild;
|
|
229
|
+
changed = true;
|
|
230
|
+
}
|
|
225
231
|
}
|
|
226
232
|
const cloudflareDeploy = scripts['cloudflare:deploy'];
|
|
227
233
|
if ('string' == typeof cloudflareDeploy && cloudflareDeploy.includes(cloudflareWranglerDeployInvalidSkipBuildCommand)) {
|
|
@@ -524,7 +530,8 @@ function ensureGeneratedIgnoreRules(workspaceRoot) {
|
|
|
524
530
|
let changed = false;
|
|
525
531
|
for (const rule of [
|
|
526
532
|
'.mf/',
|
|
527
|
-
'**/.mf/'
|
|
533
|
+
'**/.mf/',
|
|
534
|
+
'dist-cloudflare/'
|
|
528
535
|
])if (!lines.includes(rule)) {
|
|
529
536
|
lines.push(rule);
|
|
530
537
|
changed = true;
|
|
@@ -551,6 +558,12 @@ function updateGeneratedTypeScriptSurfaces(workspaceRoot, config) {
|
|
|
551
558
|
}
|
|
552
559
|
return changed;
|
|
553
560
|
}
|
|
561
|
+
function updateGeneratedModernConfigs(workspaceRoot, config) {
|
|
562
|
+
let changed = false;
|
|
563
|
+
const apps = workspaceAppsFromToolingConfig(config);
|
|
564
|
+
for (const app of apps)changed = writeTextIfChanged(node_path.join(workspaceRoot, app.directory, 'modern.config.ts'), createAppModernConfig(config.workspace.packageScope, app)) || changed;
|
|
565
|
+
return changed;
|
|
566
|
+
}
|
|
554
567
|
function updateReferenceTopology(workspaceRoot) {
|
|
555
568
|
const topologyPath = node_path.join(workspaceRoot, 'topology/reference-topology.json');
|
|
556
569
|
if (!node_fs.existsSync(topologyPath)) return false;
|
|
@@ -624,7 +637,9 @@ and pnpm contract:check.
|
|
|
624
637
|
const packageSource = createMigrationPackageSource(args, current);
|
|
625
638
|
updateUltramodernConfig(context.workspaceRoot, packageSource);
|
|
626
639
|
updateReferenceTopology(context.workspaceRoot);
|
|
627
|
-
|
|
640
|
+
const migrated = readUltramodernConfig(context.workspaceRoot);
|
|
641
|
+
updateGeneratedTypeScriptSurfaces(context.workspaceRoot, migrated);
|
|
642
|
+
updateGeneratedModernConfigs(context.workspaceRoot, migrated);
|
|
628
643
|
for (const relativePackageFile of listWorkspacePackageFiles(context.workspaceRoot)){
|
|
629
644
|
const packageFile = node_path.join(context.workspaceRoot, relativePackageFile);
|
|
630
645
|
const packageJson = readJsonFile(packageFile);
|
|
@@ -93,8 +93,10 @@ ${defaultAssetPrefixSource}
|
|
|
93
93
|
// load remoteEntry.js and exposed chunks from the remote origin, not the host.
|
|
94
94
|
const assetPrefix =
|
|
95
95
|
configuredModernAssetPrefix || configuredUltramodernAssetPrefix || defaultAssetPrefix;
|
|
96
|
-
const
|
|
97
|
-
const
|
|
96
|
+
const buildTarget = cloudflareDeployEnabled ? 'cloudflare' : 'web';
|
|
97
|
+
const buildOutputRoot = cloudflareDeployEnabled ? 'dist-cloudflare' : 'dist';
|
|
98
|
+
const buildTempDirectory = \`node_modules/.modern-js-\${appId}-\${buildTarget}\`;
|
|
99
|
+
const buildCacheDirectory = \`node_modules/.cache/rspack-\${appId}-\${buildTarget}\`;
|
|
98
100
|
|
|
99
101
|
if (
|
|
100
102
|
cloudflareDeployEnabled &&
|
|
@@ -136,13 +138,15 @@ ${bffConfig} ...(cloudflareDeployEnabled
|
|
|
136
138
|
disableTsChecker: false,
|
|
137
139
|
distPath: {
|
|
138
140
|
html: './',
|
|
141
|
+
root: buildOutputRoot,
|
|
139
142
|
},
|
|
140
143
|
polyfill: 'off',
|
|
141
144
|
splitRouteChunks: true,
|
|
145
|
+
tempDir: buildTempDirectory,
|
|
142
146
|
},
|
|
143
147
|
performance: {
|
|
144
148
|
buildCache: {
|
|
145
|
-
cacheDigest: [appId,
|
|
149
|
+
cacheDigest: [appId, buildTarget],
|
|
146
150
|
cacheDirectory: buildCacheDirectory,
|
|
147
151
|
},
|
|
148
152
|
rsdoctor: {
|
|
@@ -356,7 +356,6 @@ function createRootTsConfig(apps = []) {
|
|
|
356
356
|
}
|
|
357
357
|
function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [], bridge) {
|
|
358
358
|
const publicSurfaceBuildCommand = createPublicSurfaceGenerationCommand(app, 'dist');
|
|
359
|
-
const publicSurfaceCloudflareBuildCommand = createPublicSurfaceGenerationCommand(app, 'dist');
|
|
360
359
|
const publicSurfaceCloudflareOutputCommand = createPublicSurfaceGenerationCommand(app, 'cloudflare');
|
|
361
360
|
const packageExports = Object.fromEntries(Object.entries(app.exposes ?? {}).map(([expose, source])=>[
|
|
362
361
|
expose,
|
|
@@ -369,7 +368,7 @@ function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [
|
|
|
369
368
|
scripts: {
|
|
370
369
|
dev: 'modern dev',
|
|
371
370
|
build: app.exposes ? `ULTRAMODERN_ZEPHYR=false modern build && ${publicSurfaceBuildCommand} && node ${relativeRootFor(app.directory)}/scripts/assert-mf-types.mts` : `ULTRAMODERN_ZEPHYR=false modern build && ${publicSurfaceBuildCommand}`,
|
|
372
|
-
'cloudflare:build': `ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern build &&
|
|
371
|
+
'cloudflare:build': `ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern build && ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy --skip-build && ${publicSurfaceCloudflareOutputCommand}`,
|
|
373
372
|
'cloudflare:deploy': 'ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json',
|
|
374
373
|
'cloudflare:preview': 'pnpm run cloudflare:build && wrangler dev --config .output/wrangler.json',
|
|
375
374
|
'cloudflare:proof': `node ${relativeRootFor(app.directory)}/scripts/proof-cloudflare-version.mts --app ${app.id}`,
|
|
@@ -8,6 +8,7 @@ import { resolveCreatePackageRoot } from "../create-package-root.js";
|
|
|
8
8
|
import { BLEEDINGDEV_PACKAGE_NAME_PREFIX, BLEEDINGDEV_PACKAGE_SCOPE, ULTRAMODERN_SINGLE_APP_MODERN_PACKAGES, ULTRAMODERN_WORKSPACE_MODERN_PACKAGES, WORKSPACE_PACKAGE_VERSION, modernPackageSpecifier } from "../ultramodern-package-source.js";
|
|
9
9
|
import { createAppEnvDts } from "../ultramodern-workspace/app-files.js";
|
|
10
10
|
import { validateModuleFederationTypes } from "../ultramodern-workspace/mf-validation.js";
|
|
11
|
+
import { createAppModernConfig } from "../ultramodern-workspace/module-federation.js";
|
|
11
12
|
import { createAppMfTypesTsConfig, createAppTsConfig, createSharedPackageTsConfig, createTsConfigBase } from "../ultramodern-workspace/package-json.js";
|
|
12
13
|
import { DRIZZLE_ORM_VERSION, EFFECT_TSGO_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, OXFMT_VERSION, OXLINT_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "../ultramodern-workspace/versions.js";
|
|
13
14
|
import { createWorkspaceValidationScript } from "../ultramodern-workspace/workspace-scripts.js";
|
|
@@ -220,9 +221,14 @@ function updateGeneratedPackageScripts(packageJson) {
|
|
|
220
221
|
if (!scripts || 'object' != typeof scripts || Array.isArray(scripts)) return false;
|
|
221
222
|
let changed = false;
|
|
222
223
|
const cloudflareBuild = scripts['cloudflare:build'];
|
|
223
|
-
if ('string' == typeof cloudflareBuild
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
if ('string' == typeof cloudflareBuild) {
|
|
225
|
+
let nextCloudflareBuild = cloudflareBuild;
|
|
226
|
+
if (nextCloudflareBuild.includes(cloudflareModernDeployCommand) && !nextCloudflareBuild.includes(cloudflareModernDeploySkipBuildCommand)) nextCloudflareBuild = nextCloudflareBuild.replace(cloudflareModernDeployCommand, cloudflareModernDeploySkipBuildCommand);
|
|
227
|
+
nextCloudflareBuild = nextCloudflareBuild.replace(/ && node \S*scripts\/generate-public-surface-assets\.m[ct]s --app [^&]+ --target dist(?= && ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy --skip-build)/u, '');
|
|
228
|
+
if (nextCloudflareBuild !== cloudflareBuild) {
|
|
229
|
+
scripts['cloudflare:build'] = nextCloudflareBuild;
|
|
230
|
+
changed = true;
|
|
231
|
+
}
|
|
226
232
|
}
|
|
227
233
|
const cloudflareDeploy = scripts['cloudflare:deploy'];
|
|
228
234
|
if ('string' == typeof cloudflareDeploy && cloudflareDeploy.includes(cloudflareWranglerDeployInvalidSkipBuildCommand)) {
|
|
@@ -525,7 +531,8 @@ function ensureGeneratedIgnoreRules(workspaceRoot) {
|
|
|
525
531
|
let changed = false;
|
|
526
532
|
for (const rule of [
|
|
527
533
|
'.mf/',
|
|
528
|
-
'**/.mf/'
|
|
534
|
+
'**/.mf/',
|
|
535
|
+
'dist-cloudflare/'
|
|
529
536
|
])if (!lines.includes(rule)) {
|
|
530
537
|
lines.push(rule);
|
|
531
538
|
changed = true;
|
|
@@ -552,6 +559,12 @@ function updateGeneratedTypeScriptSurfaces(workspaceRoot, config) {
|
|
|
552
559
|
}
|
|
553
560
|
return changed;
|
|
554
561
|
}
|
|
562
|
+
function updateGeneratedModernConfigs(workspaceRoot, config) {
|
|
563
|
+
let changed = false;
|
|
564
|
+
const apps = workspaceAppsFromToolingConfig(config);
|
|
565
|
+
for (const app of apps)changed = writeTextIfChanged(node_path.join(workspaceRoot, app.directory, 'modern.config.ts'), createAppModernConfig(config.workspace.packageScope, app)) || changed;
|
|
566
|
+
return changed;
|
|
567
|
+
}
|
|
555
568
|
function updateReferenceTopology(workspaceRoot) {
|
|
556
569
|
const topologyPath = node_path.join(workspaceRoot, 'topology/reference-topology.json');
|
|
557
570
|
if (!node_fs.existsSync(topologyPath)) return false;
|
|
@@ -625,7 +638,9 @@ and pnpm contract:check.
|
|
|
625
638
|
const packageSource = createMigrationPackageSource(args, current);
|
|
626
639
|
updateUltramodernConfig(context.workspaceRoot, packageSource);
|
|
627
640
|
updateReferenceTopology(context.workspaceRoot);
|
|
628
|
-
|
|
641
|
+
const migrated = readUltramodernConfig(context.workspaceRoot);
|
|
642
|
+
updateGeneratedTypeScriptSurfaces(context.workspaceRoot, migrated);
|
|
643
|
+
updateGeneratedModernConfigs(context.workspaceRoot, migrated);
|
|
629
644
|
for (const relativePackageFile of listWorkspacePackageFiles(context.workspaceRoot)){
|
|
630
645
|
const packageFile = node_path.join(context.workspaceRoot, relativePackageFile);
|
|
631
646
|
const packageJson = readJsonFile(packageFile);
|
|
@@ -94,8 +94,10 @@ ${defaultAssetPrefixSource}
|
|
|
94
94
|
// load remoteEntry.js and exposed chunks from the remote origin, not the host.
|
|
95
95
|
const assetPrefix =
|
|
96
96
|
configuredModernAssetPrefix || configuredUltramodernAssetPrefix || defaultAssetPrefix;
|
|
97
|
-
const
|
|
98
|
-
const
|
|
97
|
+
const buildTarget = cloudflareDeployEnabled ? 'cloudflare' : 'web';
|
|
98
|
+
const buildOutputRoot = cloudflareDeployEnabled ? 'dist-cloudflare' : 'dist';
|
|
99
|
+
const buildTempDirectory = \`node_modules/.modern-js-\${appId}-\${buildTarget}\`;
|
|
100
|
+
const buildCacheDirectory = \`node_modules/.cache/rspack-\${appId}-\${buildTarget}\`;
|
|
99
101
|
|
|
100
102
|
if (
|
|
101
103
|
cloudflareDeployEnabled &&
|
|
@@ -137,13 +139,15 @@ ${bffConfig} ...(cloudflareDeployEnabled
|
|
|
137
139
|
disableTsChecker: false,
|
|
138
140
|
distPath: {
|
|
139
141
|
html: './',
|
|
142
|
+
root: buildOutputRoot,
|
|
140
143
|
},
|
|
141
144
|
polyfill: 'off',
|
|
142
145
|
splitRouteChunks: true,
|
|
146
|
+
tempDir: buildTempDirectory,
|
|
143
147
|
},
|
|
144
148
|
performance: {
|
|
145
149
|
buildCache: {
|
|
146
|
-
cacheDigest: [appId,
|
|
150
|
+
cacheDigest: [appId, buildTarget],
|
|
147
151
|
cacheDirectory: buildCacheDirectory,
|
|
148
152
|
},
|
|
149
153
|
rsdoctor: {
|
|
@@ -357,7 +357,6 @@ function createRootTsConfig(apps = []) {
|
|
|
357
357
|
}
|
|
358
358
|
function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [], bridge) {
|
|
359
359
|
const publicSurfaceBuildCommand = createPublicSurfaceGenerationCommand(app, 'dist');
|
|
360
|
-
const publicSurfaceCloudflareBuildCommand = createPublicSurfaceGenerationCommand(app, 'dist');
|
|
361
360
|
const publicSurfaceCloudflareOutputCommand = createPublicSurfaceGenerationCommand(app, 'cloudflare');
|
|
362
361
|
const packageExports = Object.fromEntries(Object.entries(app.exposes ?? {}).map(([expose, source])=>[
|
|
363
362
|
expose,
|
|
@@ -370,7 +369,7 @@ function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [
|
|
|
370
369
|
scripts: {
|
|
371
370
|
dev: 'modern dev',
|
|
372
371
|
build: app.exposes ? `ULTRAMODERN_ZEPHYR=false modern build && ${publicSurfaceBuildCommand} && node ${relativeRootFor(app.directory)}/scripts/assert-mf-types.mts` : `ULTRAMODERN_ZEPHYR=false modern build && ${publicSurfaceBuildCommand}`,
|
|
373
|
-
'cloudflare:build': `ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern build &&
|
|
372
|
+
'cloudflare:build': `ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern build && ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy --skip-build && ${publicSurfaceCloudflareOutputCommand}`,
|
|
374
373
|
'cloudflare:deploy': 'ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json',
|
|
375
374
|
'cloudflare:preview': 'pnpm run cloudflare:build && wrangler dev --config .output/wrangler.json',
|
|
376
375
|
'cloudflare:proof': `node ${relativeRootFor(app.directory)}/scripts/proof-cloudflare-version.mts --app ${app.id}`,
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
24
|
-
"version": "3.5.0-ultramodern.
|
|
24
|
+
"version": "3.5.0-ultramodern.13",
|
|
25
25
|
"types": "./dist/types/index.d.ts",
|
|
26
26
|
"main": "./dist/esm-node/index.js",
|
|
27
27
|
"bin": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@modern-js/codesmith": "2.6.9",
|
|
78
78
|
"oxfmt": "0.56.0",
|
|
79
79
|
"ultracite": "7.8.3",
|
|
80
|
-
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.5.0-ultramodern.
|
|
80
|
+
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.5.0-ultramodern.13"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@rslib/core": "0.23.1",
|
|
@@ -99,6 +99,6 @@
|
|
|
99
99
|
"test": "rm -rf dist && rslib build -c rslibconfig.mts && rstest --passWithNoTests"
|
|
100
100
|
},
|
|
101
101
|
"ultramodern": {
|
|
102
|
-
"frameworkVersion": "3.5.0-ultramodern.
|
|
102
|
+
"frameworkVersion": "3.5.0-ultramodern.13"
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -1363,12 +1363,17 @@ const extractAssetPrefixExpression = modernConfig => {
|
|
|
1363
1363
|
assert(match?.groups?.expression, 'modern.config.ts must assign assetPrefix');
|
|
1364
1364
|
return match.groups.expression;
|
|
1365
1365
|
};
|
|
1366
|
-
const
|
|
1366
|
+
const assertTargetIsolatedBuildArtifacts = (appId, modernConfig) => {
|
|
1367
1367
|
assert(
|
|
1368
|
-
modernConfig.includes("const
|
|
1369
|
-
modernConfig.includes(
|
|
1368
|
+
modernConfig.includes("const buildTarget = cloudflareDeployEnabled ? 'cloudflare' : 'web';") &&
|
|
1369
|
+
modernConfig.includes("const buildOutputRoot = cloudflareDeployEnabled ? 'dist-cloudflare' : 'dist';") &&
|
|
1370
|
+
modernConfig.includes('const buildTempDirectory = `node_modules/.modern-js-${appId}-${buildTarget}`;') &&
|
|
1371
|
+
modernConfig.includes('const buildCacheDirectory = `node_modules/.cache/rspack-${appId}-${buildTarget}`;') &&
|
|
1372
|
+
modernConfig.includes('root: buildOutputRoot,') &&
|
|
1373
|
+
modernConfig.includes('tempDir: buildTempDirectory,') &&
|
|
1374
|
+
modernConfig.includes('cacheDigest: [appId, buildTarget],') &&
|
|
1370
1375
|
modernConfig.includes('cacheDirectory: buildCacheDirectory,'),
|
|
1371
|
-
`${appId} must
|
|
1376
|
+
`${appId} must isolate build output, Modern temp files, and Rspack cache by app and build target`,
|
|
1372
1377
|
);
|
|
1373
1378
|
};
|
|
1374
1379
|
const assertCloudflareBuildSkipsDeployRebuild = (appId, packageJson) => {
|
|
@@ -1378,6 +1383,12 @@ const assertCloudflareBuildSkipsDeployRebuild = (appId, packageJson) => {
|
|
|
1378
1383
|
),
|
|
1379
1384
|
`${appId} cloudflare:build must deploy with --skip-build after the explicit Cloudflare build`,
|
|
1380
1385
|
);
|
|
1386
|
+
assert(
|
|
1387
|
+
!packageJson.scripts?.['cloudflare:build']?.includes(
|
|
1388
|
+
'--target dist && ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy',
|
|
1389
|
+
),
|
|
1390
|
+
`${appId} cloudflare:build must not write public-surface assets into the normal web dist before deploy`,
|
|
1391
|
+
);
|
|
1381
1392
|
};
|
|
1382
1393
|
const stripYamlInlineComment = value => {
|
|
1383
1394
|
let quote = undefined;
|
|
@@ -1795,6 +1806,7 @@ const shellRouteHead = readText('apps/shell-super-app/src/routes/ultramodern-rou
|
|
|
1795
1806
|
const shellRouteMetadata = readText('apps/shell-super-app/src/routes/ultramodern-route-metadata.ts');
|
|
1796
1807
|
assert(/^\.mf\/$/mu.test(gitignore), 'Generated .gitignore must ignore root Module Federation diagnostics');
|
|
1797
1808
|
assert(/^\*\*\/\.mf\/$/mu.test(gitignore), 'Generated .gitignore must ignore per-app Module Federation diagnostics');
|
|
1809
|
+
assert(/^dist-cloudflare\/$/mu.test(gitignore), 'Generated .gitignore must ignore Cloudflare build output');
|
|
1798
1810
|
assert(shellModernAppEnv.includes("import '@modern-js/app-tools/types';"), 'Shell app env must import the framework-owned app ambient type bundle through module resolution');
|
|
1799
1811
|
assert(/declare global \{\s*const ULTRAMODERN_SITE_URL: string;\s*\}/u.test(shellModernAppEnv), 'Shell app env must keep generated globals explicit after importing app ambient types');
|
|
1800
1812
|
assert(!shellModernAppEnv.includes("declare module '*.svg'"), 'Shell app env must not redeclare framework-owned svg asset modules');
|
|
@@ -1818,7 +1830,7 @@ assert(shellPackage.dependencies?.['@modern-js/plugin-i18n'] === expectedModernP
|
|
|
1818
1830
|
assert(shellPackage.dependencies?.['@modern-js/plugin-tanstack'] === expectedModernPackageSpecifier('@modern-js/plugin-tanstack'), 'Shell plugin-tanstack dependency must match package source metadata');
|
|
1819
1831
|
assert(shellPackage.dependencies?.['@modern-js/runtime'] === expectedModernPackageSpecifier('@modern-js/runtime'), 'Shell runtime dependency must match package source metadata');
|
|
1820
1832
|
assert(shellPackage.scripts?.['cloudflare:deploy'] === 'ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json', 'Shell must expose cloudflare:deploy');
|
|
1821
|
-
|
|
1833
|
+
assertTargetIsolatedBuildArtifacts('shell-super-app', shellModernConfig);
|
|
1822
1834
|
assertCloudflareBuildSkipsDeployRebuild('shell-super-app', shellPackage);
|
|
1823
1835
|
const shellContract = generatedContract.apps?.find(app => app.id === 'shell-super-app');
|
|
1824
1836
|
assert(shellContract?.deploy?.cloudflare?.workerName === expectedWorkerName('shell-super-app'), 'Shell Cloudflare workerName is incorrect');
|
|
@@ -1901,7 +1913,7 @@ for (const vertical of fullStackVerticals) {
|
|
|
1901
1913
|
assert(routeMetadata.includes("authoring: 'colocated-route-meta'"), `${vertical.id} route metadata manifest must advertise colocated authoring`);
|
|
1902
1914
|
assert(packageJson.name === vertical.packageName, `${vertical.id} package name is incorrect`);
|
|
1903
1915
|
assert(packageJson.scripts?.['cloudflare:deploy'] === 'ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json', `${vertical.id} must expose cloudflare:deploy`);
|
|
1904
|
-
|
|
1916
|
+
assertTargetIsolatedBuildArtifacts(vertical.id, modernConfig);
|
|
1905
1917
|
assertCloudflareBuildSkipsDeployRebuild(vertical.id, packageJson);
|
|
1906
1918
|
assert(packageJson.scripts?.['cloudflare:proof']?.includes(`--app ${vertical.id}`), `${vertical.id} must expose cloudflare:proof`);
|
|
1907
1919
|
assert(packageJson.devDependencies?.['@modern-js/app-tools'] === expectedModernPackageSpecifier('@modern-js/app-tools'), `${vertical.id} app-tools dependency must match package source metadata`);
|