@bleedingdev/modern-js-create 3.5.0-ultramodern.2 → 3.5.0-ultramodern.21
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 +22 -15
- package/dist/cjs/ultramodern-tooling/commands.cjs +393 -3
- package/dist/cjs/ultramodern-workspace/app-files.cjs +8 -11
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +13 -6
- package/dist/cjs/ultramodern-workspace/package-json.cjs +15 -8
- package/dist/cjs/ultramodern-workspace/versions.cjs +7 -2
- package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +2 -0
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +2 -0
- package/dist/esm/ultramodern-tooling/commands.js +393 -3
- package/dist/esm/ultramodern-workspace/app-files.js +8 -11
- package/dist/esm/ultramodern-workspace/module-federation.js +13 -6
- package/dist/esm/ultramodern-workspace/package-json.js +5 -8
- package/dist/esm/ultramodern-workspace/versions.js +5 -3
- package/dist/esm/ultramodern-workspace/workspace-scripts.js +3 -1
- package/dist/esm/ultramodern-workspace/write-workspace.js +3 -1
- package/dist/esm-node/ultramodern-tooling/commands.js +393 -3
- package/dist/esm-node/ultramodern-workspace/app-files.js +8 -11
- package/dist/esm-node/ultramodern-workspace/module-federation.js +13 -6
- package/dist/esm-node/ultramodern-workspace/package-json.js +5 -8
- package/dist/esm-node/ultramodern-workspace/versions.js +5 -3
- package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +3 -1
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +3 -1
- package/dist/types/ultramodern-workspace/versions.d.ts +4 -2
- package/package.json +3 -3
- package/template-workspace/.gitignore.handlebars +3 -0
- package/template-workspace/README.md.handlebars +19 -13
- 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 +9 -0
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +95 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import node_path from "node:path";
|
|
1
2
|
import { WORKSPACE_PACKAGE_VERSION, modernPackageSpecifier } from "../ultramodern-package-source.js";
|
|
2
3
|
import { appHasApi, remoteDependencyAlias, resolveRemoteRefs, sharedPackages, shellApp, verticalApiApps, zephyrRemoteDependency } from "./descriptors.js";
|
|
3
4
|
import { readFileTemplate } from "./fs-io.js";
|
|
@@ -248,7 +249,6 @@ function createTsConfigBase() {
|
|
|
248
249
|
noFallthroughCasesInSwitch: true,
|
|
249
250
|
noPropertyAccessFromIndexSignature: true,
|
|
250
251
|
noImplicitReturns: true,
|
|
251
|
-
skipLibCheck: true,
|
|
252
252
|
resolveJsonModule: true,
|
|
253
253
|
plugins: [
|
|
254
254
|
{
|
|
@@ -280,7 +280,7 @@ function createReferences(packageDir, references) {
|
|
|
280
280
|
return [
|
|
281
281
|
...new Set(references)
|
|
282
282
|
].filter((reference)=>reference !== packageDir).map((reference)=>({
|
|
283
|
-
path:
|
|
283
|
+
path: node_path.relative(packageDir, reference).split(node_path.sep).join('/')
|
|
284
284
|
}));
|
|
285
285
|
}
|
|
286
286
|
function createPackageTsConfig(packageDir, options = {}) {
|
|
@@ -290,8 +290,6 @@ function createPackageTsConfig(packageDir, options = {}) {
|
|
|
290
290
|
const include = resolvedOptions.include ?? [
|
|
291
291
|
'src',
|
|
292
292
|
'locales/**/*.json',
|
|
293
|
-
'modern.config.ts',
|
|
294
|
-
'module-federation.config.ts',
|
|
295
293
|
'package.json',
|
|
296
294
|
'shared'
|
|
297
295
|
];
|
|
@@ -325,9 +323,9 @@ function createAppTsConfig(app, remotes = []) {
|
|
|
325
323
|
});
|
|
326
324
|
}
|
|
327
325
|
function createAppMfTypesTsConfig(app) {
|
|
328
|
-
const exposedFiles = Object.
|
|
326
|
+
const exposedFiles = Object.entries(app.exposes ?? {}).sort(([left], [right])=>'./Route' === left ? -1 : './Route' === right ? 1 : 0).map(([, exposePath])=>exposePath.replace(/^\.\//u, ''));
|
|
329
327
|
return {
|
|
330
|
-
extends:
|
|
328
|
+
extends: `${relativeRootFor(app.directory)}/tsconfig.base.json`,
|
|
331
329
|
include: [
|
|
332
330
|
...new Set([
|
|
333
331
|
...exposedFiles,
|
|
@@ -358,7 +356,6 @@ function createRootTsConfig(apps = []) {
|
|
|
358
356
|
}
|
|
359
357
|
function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [], bridge) {
|
|
360
358
|
const publicSurfaceBuildCommand = createPublicSurfaceGenerationCommand(app, 'dist');
|
|
361
|
-
const publicSurfaceCloudflareBuildCommand = createPublicSurfaceGenerationCommand(app, 'dist');
|
|
362
359
|
const publicSurfaceCloudflareOutputCommand = createPublicSurfaceGenerationCommand(app, 'cloudflare');
|
|
363
360
|
const packageExports = Object.fromEntries(Object.entries(app.exposes ?? {}).map(([expose, source])=>[
|
|
364
361
|
expose,
|
|
@@ -371,7 +368,7 @@ function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [
|
|
|
371
368
|
scripts: {
|
|
372
369
|
dev: 'modern dev',
|
|
373
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}`,
|
|
374
|
-
'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}`,
|
|
375
372
|
'cloudflare:deploy': 'ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json',
|
|
376
373
|
'cloudflare:preview': 'pnpm run cloudflare:build && wrangler dev --config .output/wrangler.json',
|
|
377
374
|
'cloudflare:proof': `node ${relativeRootFor(app.directory)}/scripts/proof-cloudflare-version.mts --app ${app.id}`,
|
|
@@ -8,9 +8,10 @@ const CLOUDFLARE_COMPATIBILITY_DATE = '2026-06-02';
|
|
|
8
8
|
const TAILWIND_VERSION = '4.3.1';
|
|
9
9
|
const TAILWIND_POSTCSS_VERSION = '4.3.1';
|
|
10
10
|
const POSTCSS_VERSION = '8.5.15';
|
|
11
|
-
const EFFECT_VERSION = '4.0.0-beta.
|
|
12
|
-
const EFFECT_VITEST_VERSION = '4.0.0-beta.
|
|
11
|
+
const EFFECT_VERSION = '4.0.0-beta.92';
|
|
12
|
+
const EFFECT_VITEST_VERSION = '4.0.0-beta.92';
|
|
13
13
|
const EFFECT_TSGO_VERSION = '0.14.6';
|
|
14
|
+
const DRIZZLE_ORM_VERSION = '1.0.0-rc.4';
|
|
14
15
|
const TYPESCRIPT_STABLE_VERSION = '6.0.3';
|
|
15
16
|
const TYPESCRIPT_NATIVE_PREVIEW_VERSION = '7.0.0-dev.20260628.1';
|
|
16
17
|
const TYPESCRIPT_VERSION = TYPESCRIPT_STABLE_VERSION;
|
|
@@ -35,7 +36,8 @@ const ultramodernWorkspaceVersions = {
|
|
|
35
36
|
moduleFederation: MODULE_FEDERATION_VERSION,
|
|
36
37
|
effect: EFFECT_VERSION,
|
|
37
38
|
effectVitest: EFFECT_VITEST_VERSION,
|
|
39
|
+
drizzleOrm: DRIZZLE_ORM_VERSION,
|
|
38
40
|
tailwind: TAILWIND_VERSION,
|
|
39
41
|
tailwindPostcss: TAILWIND_POSTCSS_VERSION
|
|
40
42
|
};
|
|
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 };
|
|
43
|
+
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 };
|
|
@@ -8,7 +8,7 @@ import { packageName, tailwindPrefixForApp } from "./naming.js";
|
|
|
8
8
|
import { createCloudflareSecurityContract } from "./policy.js";
|
|
9
9
|
import { publicSurfaceManagedSourceAssetPaths } from "./public-surface.js";
|
|
10
10
|
import { createLocalisedUrlsMap, createRouteMetaFilePath, createRouteOwnedI18nPaths, createRoutePageFilePath } from "./routes.js";
|
|
11
|
-
import { CLOUDFLARE_COMPATIBILITY_DATE, NODE_VERSION, PNPM_VERSION } from "./versions.js";
|
|
11
|
+
import { CLOUDFLARE_COMPATIBILITY_DATE, EFFECT_VERSION, MODULE_FEDERATION_VERSION, NODE_VERSION, PNPM_VERSION } from "./versions.js";
|
|
12
12
|
function createToolWrapperScript(command, extraArgs = []) {
|
|
13
13
|
const commandJson = JSON.stringify(command);
|
|
14
14
|
const extraArgsJson = JSON.stringify(extraArgs);
|
|
@@ -127,6 +127,8 @@ function createWorkspaceValidationScript(scope, enableTailwind, remotes = []) {
|
|
|
127
127
|
const expectedCloudflareSecurity = createCloudflareSecurityContract();
|
|
128
128
|
return renderFileTemplate("workspace-scripts/validate-ultramodern-workspace.mjs", {
|
|
129
129
|
packageScope: scope,
|
|
130
|
+
effectVersion: EFFECT_VERSION,
|
|
131
|
+
moduleFederationVersion: MODULE_FEDERATION_VERSION,
|
|
130
132
|
nodeVersion: NODE_VERSION,
|
|
131
133
|
pnpmVersion: PNPM_VERSION,
|
|
132
134
|
tailwindEnabledJson: JSON.stringify(enableTailwind),
|
|
@@ -14,7 +14,7 @@ import { runCodeSmithOverlays } from "./overlays.js";
|
|
|
14
14
|
import { createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase } from "./package-json.js";
|
|
15
15
|
import { resolvePackageSource } from "./package-source.js";
|
|
16
16
|
import { createPublicWebAppArtifacts } from "./public-surface.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
|
+
import { DRIZZLE_ORM_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, MODULE_FEDERATION_VERSION, NODE_FETCH_VERSION, NODE_VERSION, PNPM_VERSION, TANSTACK_ROUTER_CORE_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_VERSION } from "./versions.js";
|
|
18
18
|
import { writeGeneratedWorkspaceScripts } from "./workspace-scripts.js";
|
|
19
19
|
function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes = [], bridge) {
|
|
20
20
|
const resolvedApp = 'shell' === app.kind ? createShellHost(remotes) : app;
|
|
@@ -130,8 +130,10 @@ function generateUltramodernWorkspace(options) {
|
|
|
130
130
|
nodeVersion: NODE_VERSION,
|
|
131
131
|
pnpmVersion: PNPM_VERSION,
|
|
132
132
|
nodeFetchVersion: NODE_FETCH_VERSION,
|
|
133
|
+
drizzleOrmVersion: DRIZZLE_ORM_VERSION,
|
|
133
134
|
effectVersion: EFFECT_VERSION,
|
|
134
135
|
effectVitestVersion: EFFECT_VITEST_VERSION,
|
|
136
|
+
moduleFederationVersion: MODULE_FEDERATION_VERSION,
|
|
135
137
|
tanstackRouterCoreVersion: TANSTACK_ROUTER_CORE_VERSION,
|
|
136
138
|
tanstackRouterVersion: TANSTACK_ROUTER_VERSION,
|
|
137
139
|
typescriptVersion: TYPESCRIPT_VERSION,
|
|
@@ -6,7 +6,11 @@ import node_path from "node:path";
|
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
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
|
+
import { createAppEnvDts } from "../ultramodern-workspace/app-files.js";
|
|
9
10
|
import { validateModuleFederationTypes } from "../ultramodern-workspace/mf-validation.js";
|
|
11
|
+
import { createAppModernConfig } from "../ultramodern-workspace/module-federation.js";
|
|
12
|
+
import { createAppMfTypesTsConfig, createAppTsConfig, createSharedPackageTsConfig, createTsConfigBase } from "../ultramodern-workspace/package-json.js";
|
|
13
|
+
import { DRIZZLE_ORM_VERSION, EFFECT_TSGO_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, MODULE_FEDERATION_VERSION, OXFMT_VERSION, OXLINT_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "../ultramodern-workspace/versions.js";
|
|
10
14
|
import { createWorkspaceValidationScript } from "../ultramodern-workspace/workspace-scripts.js";
|
|
11
15
|
import { readUltramodernConfig, workspaceAppsFromToolingConfig } from "./config.js";
|
|
12
16
|
const commands_dirname = node_path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -152,6 +156,91 @@ function updateModernDependencies(packageJson, packageSource) {
|
|
|
152
156
|
}
|
|
153
157
|
return changed;
|
|
154
158
|
}
|
|
159
|
+
const generatedToolingDependencyPins = new Map([
|
|
160
|
+
[
|
|
161
|
+
'@effect/tsgo',
|
|
162
|
+
EFFECT_TSGO_VERSION
|
|
163
|
+
],
|
|
164
|
+
[
|
|
165
|
+
"@typescript/native-preview",
|
|
166
|
+
TYPESCRIPT_NATIVE_PREVIEW_VERSION
|
|
167
|
+
],
|
|
168
|
+
[
|
|
169
|
+
'oxfmt',
|
|
170
|
+
OXFMT_VERSION
|
|
171
|
+
],
|
|
172
|
+
[
|
|
173
|
+
'oxlint',
|
|
174
|
+
OXLINT_VERSION
|
|
175
|
+
],
|
|
176
|
+
[
|
|
177
|
+
'wrangler',
|
|
178
|
+
WRANGLER_VERSION
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
'zephyr-agent',
|
|
182
|
+
ZEPHYR_AGENT_VERSION
|
|
183
|
+
],
|
|
184
|
+
[
|
|
185
|
+
'zephyr-rspack-plugin',
|
|
186
|
+
ZEPHYR_RSPACK_PLUGIN_VERSION
|
|
187
|
+
]
|
|
188
|
+
]);
|
|
189
|
+
const strictEffectPackageVersionPolicyExclusions = [
|
|
190
|
+
`effect@${EFFECT_VERSION}`,
|
|
191
|
+
`@effect/opentelemetry@${EFFECT_VERSION}`
|
|
192
|
+
];
|
|
193
|
+
const moduleFederationModernJsPatchPath = `patches/@module-federation__modern-js-v3@${MODULE_FEDERATION_VERSION}.patch`;
|
|
194
|
+
const moduleFederationModernJsPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', moduleFederationModernJsPatchPath);
|
|
195
|
+
const moduleFederationBridgeReactPatchPath = `patches/@module-federation__bridge-react@${MODULE_FEDERATION_VERSION}.patch`;
|
|
196
|
+
const moduleFederationBridgeReactPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', moduleFederationBridgeReactPatchPath);
|
|
197
|
+
const effectDeclarationPatchPath = 'patches/effect-schema-error-type-id.patch';
|
|
198
|
+
const effectDeclarationPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', effectDeclarationPatchPath);
|
|
199
|
+
const drizzleOrmDeclarationPatchPath = 'patches/drizzle-orm-ts7-strict-declarations.patch';
|
|
200
|
+
const drizzleOrmDeclarationPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', drizzleOrmDeclarationPatchPath);
|
|
201
|
+
function updateGeneratedToolingDependencies(packageJson) {
|
|
202
|
+
let changed = false;
|
|
203
|
+
for (const section of [
|
|
204
|
+
'dependencies',
|
|
205
|
+
'devDependencies',
|
|
206
|
+
'peerDependencies',
|
|
207
|
+
'optionalDependencies'
|
|
208
|
+
]){
|
|
209
|
+
const dependencies = packageJson[section];
|
|
210
|
+
if (!(!dependencies || 'object' != typeof dependencies || Array.isArray(dependencies))) {
|
|
211
|
+
for (const [packageName, version] of generatedToolingDependencyPins)if (Object.prototype.hasOwnProperty.call(dependencies, packageName) && dependencies[packageName] !== version) {
|
|
212
|
+
dependencies[packageName] = version;
|
|
213
|
+
changed = true;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return changed;
|
|
218
|
+
}
|
|
219
|
+
const cloudflareModernDeployCommand = 'ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy';
|
|
220
|
+
const cloudflareModernDeploySkipBuildCommand = `${cloudflareModernDeployCommand} --skip-build`;
|
|
221
|
+
const cloudflareWranglerDeployCommand = 'wrangler deploy --config .output/wrangler.json';
|
|
222
|
+
const cloudflareWranglerDeployInvalidSkipBuildCommand = `${cloudflareWranglerDeployCommand} --skip-build`;
|
|
223
|
+
function updateGeneratedPackageScripts(packageJson) {
|
|
224
|
+
const scripts = packageJson.scripts;
|
|
225
|
+
if (!scripts || 'object' != typeof scripts || Array.isArray(scripts)) return false;
|
|
226
|
+
let changed = false;
|
|
227
|
+
const cloudflareBuild = scripts['cloudflare:build'];
|
|
228
|
+
if ('string' == typeof cloudflareBuild) {
|
|
229
|
+
let nextCloudflareBuild = cloudflareBuild;
|
|
230
|
+
if (nextCloudflareBuild.includes(cloudflareModernDeployCommand) && !nextCloudflareBuild.includes(cloudflareModernDeploySkipBuildCommand)) nextCloudflareBuild = nextCloudflareBuild.replace(cloudflareModernDeployCommand, cloudflareModernDeploySkipBuildCommand);
|
|
231
|
+
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, '');
|
|
232
|
+
if (nextCloudflareBuild !== cloudflareBuild) {
|
|
233
|
+
scripts['cloudflare:build'] = nextCloudflareBuild;
|
|
234
|
+
changed = true;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const cloudflareDeploy = scripts['cloudflare:deploy'];
|
|
238
|
+
if ('string' == typeof cloudflareDeploy && cloudflareDeploy.includes(cloudflareWranglerDeployInvalidSkipBuildCommand)) {
|
|
239
|
+
scripts['cloudflare:deploy'] = cloudflareDeploy.replace(cloudflareWranglerDeployInvalidSkipBuildCommand, cloudflareWranglerDeployCommand);
|
|
240
|
+
changed = true;
|
|
241
|
+
}
|
|
242
|
+
return changed;
|
|
243
|
+
}
|
|
155
244
|
function normalizeStrictEffectApiMetadata(value) {
|
|
156
245
|
const api = value.api;
|
|
157
246
|
if (!api || 'object' != typeof api || Array.isArray(api)) return false;
|
|
@@ -217,6 +306,236 @@ function normalizeStrictEffectApiMetadata(value) {
|
|
|
217
306
|
}
|
|
218
307
|
return changed;
|
|
219
308
|
}
|
|
309
|
+
function replaceYamlLine(source, pattern, replacement) {
|
|
310
|
+
const updated = source.replace(pattern, replacement);
|
|
311
|
+
return {
|
|
312
|
+
source: updated,
|
|
313
|
+
changed: updated !== source
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function ensureYamlListItem(source, key, item) {
|
|
317
|
+
const itemLine = ` - '${item}'`;
|
|
318
|
+
const headerPattern = new RegExp(`^${key}:\\n(?:(?: - .+\\n)*)`, 'mu');
|
|
319
|
+
const header = source.match(headerPattern);
|
|
320
|
+
if (header) {
|
|
321
|
+
if (header[0].split('\n').includes(itemLine)) return {
|
|
322
|
+
source,
|
|
323
|
+
changed: false
|
|
324
|
+
};
|
|
325
|
+
return {
|
|
326
|
+
source: source.replace(headerPattern, `${header[0]}${itemLine}\n`),
|
|
327
|
+
changed: true
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
const block = `${key}:\n${itemLine}\n`;
|
|
331
|
+
const afterTrustPolicyIgnore = source.replace(/^(trustPolicyIgnoreAfter: .+\n)/mu, `$1${block}`);
|
|
332
|
+
if (afterTrustPolicyIgnore !== source) return {
|
|
333
|
+
source: afterTrustPolicyIgnore,
|
|
334
|
+
changed: true
|
|
335
|
+
};
|
|
336
|
+
return {
|
|
337
|
+
source: `${source.trimEnd()}\n${block}`,
|
|
338
|
+
changed: true
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function ensureYamlMapEntry(source, key, entryKey, value) {
|
|
342
|
+
const entryLine = ` '${entryKey}': ${value}`;
|
|
343
|
+
const packageName = entryKey.includes('@') ? entryKey.slice(0, entryKey.lastIndexOf('@')) : entryKey;
|
|
344
|
+
const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
345
|
+
const currentEntryPattern = new RegExp(`^ {2}'${escapedPackageName}@[^']+': .+$`, 'mu');
|
|
346
|
+
const currentEntry = source.match(currentEntryPattern);
|
|
347
|
+
if (currentEntry) {
|
|
348
|
+
if (currentEntry[0] === entryLine) return {
|
|
349
|
+
source,
|
|
350
|
+
changed: false
|
|
351
|
+
};
|
|
352
|
+
return {
|
|
353
|
+
source: source.replace(currentEntryPattern, entryLine),
|
|
354
|
+
changed: true
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
const headerPattern = new RegExp(`^${key}:\\n(?:(?: .+\\n)*)`, 'mu');
|
|
358
|
+
const header = source.match(headerPattern);
|
|
359
|
+
if (header) {
|
|
360
|
+
if (header[0].split('\n').includes(entryLine)) return {
|
|
361
|
+
source,
|
|
362
|
+
changed: false
|
|
363
|
+
};
|
|
364
|
+
return {
|
|
365
|
+
source: source.replace(headerPattern, `${header[0]}${entryLine}\n`),
|
|
366
|
+
changed: true
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
return {
|
|
370
|
+
source: `${source.trimEnd()}\n${key}:\n${entryLine}\n`,
|
|
371
|
+
changed: true
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function ensureYamlScalarMapEntry(source, key, entryKey, value) {
|
|
375
|
+
const entryLine = ` ${entryKey}: ${value}`;
|
|
376
|
+
const escapedEntryKey = entryKey.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
377
|
+
const currentEntryPattern = new RegExp(`^ {2}${escapedEntryKey}: .+$`, 'mu');
|
|
378
|
+
const currentEntry = source.match(currentEntryPattern);
|
|
379
|
+
if (currentEntry) {
|
|
380
|
+
if (currentEntry[0] === entryLine) return {
|
|
381
|
+
source,
|
|
382
|
+
changed: false
|
|
383
|
+
};
|
|
384
|
+
return {
|
|
385
|
+
source: source.replace(currentEntryPattern, entryLine),
|
|
386
|
+
changed: true
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
const headerPattern = new RegExp(`^${key}:\\n(?:(?: .+\\n)*)`, 'mu');
|
|
390
|
+
const header = source.match(headerPattern);
|
|
391
|
+
if (header) return {
|
|
392
|
+
source: source.replace(headerPattern, `${header[0]}${entryLine}\n`),
|
|
393
|
+
changed: true
|
|
394
|
+
};
|
|
395
|
+
return {
|
|
396
|
+
source: `${source.trimEnd()}\n${key}:\n${entryLine}\n`,
|
|
397
|
+
changed: true
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function removeYamlMapEntry(source, entryKey) {
|
|
401
|
+
const packageName = entryKey.includes('@') ? entryKey.slice(0, entryKey.lastIndexOf('@')) : entryKey;
|
|
402
|
+
const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
403
|
+
const currentEntryPattern = new RegExp(`^ {2}'${escapedPackageName}@[^']+': .+\\n?`, 'mu');
|
|
404
|
+
if (!currentEntryPattern.test(source)) return {
|
|
405
|
+
source,
|
|
406
|
+
changed: false
|
|
407
|
+
};
|
|
408
|
+
return {
|
|
409
|
+
source: source.replace(currentEntryPattern, ''),
|
|
410
|
+
changed: true
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
function ensureGeneratedPatchFile(workspaceRoot, relativePatchPath, sourcePatchPath) {
|
|
414
|
+
const targetPath = node_path.join(workspaceRoot, relativePatchPath);
|
|
415
|
+
const patch = node_fs.readFileSync(sourcePatchPath, 'utf-8');
|
|
416
|
+
if (node_fs.existsSync(targetPath) && node_fs.readFileSync(targetPath, 'utf-8') === patch) return false;
|
|
417
|
+
node_fs.mkdirSync(node_path.dirname(targetPath), {
|
|
418
|
+
recursive: true
|
|
419
|
+
});
|
|
420
|
+
node_fs.writeFileSync(targetPath, patch, 'utf-8');
|
|
421
|
+
return true;
|
|
422
|
+
}
|
|
423
|
+
function removeGeneratedPatchFileIfUnchanged(workspaceRoot, relativePatchPath, sourcePatchPath) {
|
|
424
|
+
const targetPath = node_path.join(workspaceRoot, relativePatchPath);
|
|
425
|
+
if (!node_fs.existsSync(targetPath)) return false;
|
|
426
|
+
const patch = node_fs.readFileSync(sourcePatchPath, 'utf-8');
|
|
427
|
+
if (node_fs.readFileSync(targetPath, 'utf-8') !== patch) return false;
|
|
428
|
+
node_fs.rmSync(targetPath);
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
function workspaceUsesDependency(workspaceRoot, packageName) {
|
|
432
|
+
const packageJsonPaths = [
|
|
433
|
+
node_path.join(workspaceRoot, 'package.json')
|
|
434
|
+
];
|
|
435
|
+
for (const workspaceDir of [
|
|
436
|
+
'apps',
|
|
437
|
+
'verticals',
|
|
438
|
+
'packages'
|
|
439
|
+
]){
|
|
440
|
+
const absoluteWorkspaceDir = node_path.join(workspaceRoot, workspaceDir);
|
|
441
|
+
if (node_fs.existsSync(absoluteWorkspaceDir)) for (const entry of node_fs.readdirSync(absoluteWorkspaceDir, {
|
|
442
|
+
withFileTypes: true
|
|
443
|
+
})){
|
|
444
|
+
if (!entry.isDirectory()) continue;
|
|
445
|
+
const packageJsonPath = node_path.join(absoluteWorkspaceDir, entry.name, 'package.json');
|
|
446
|
+
if (node_fs.existsSync(packageJsonPath)) packageJsonPaths.push(packageJsonPath);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
for (const packageJsonPath of packageJsonPaths){
|
|
450
|
+
const packageJson = JSON.parse(node_fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
451
|
+
for (const field of [
|
|
452
|
+
'dependencies',
|
|
453
|
+
'devDependencies',
|
|
454
|
+
'peerDependencies',
|
|
455
|
+
'optionalDependencies'
|
|
456
|
+
]){
|
|
457
|
+
const dependencies = packageJson[field];
|
|
458
|
+
if (dependencies && 'object' == typeof dependencies) {
|
|
459
|
+
if (Object.prototype.hasOwnProperty.call(dependencies, packageName)) return true;
|
|
460
|
+
for (const specifier of Object.values(dependencies))if ('string' == typeof specifier && specifier.startsWith(`npm:${packageName}@`)) return true;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return false;
|
|
465
|
+
}
|
|
466
|
+
function ensureGeneratedDeclarationPatches(workspaceRoot, options) {
|
|
467
|
+
let changed = false;
|
|
468
|
+
changed = ensureGeneratedPatchFile(workspaceRoot, moduleFederationModernJsPatchPath, moduleFederationModernJsPatchSourcePath) || changed;
|
|
469
|
+
changed = ensureGeneratedPatchFile(workspaceRoot, moduleFederationBridgeReactPatchPath, moduleFederationBridgeReactPatchSourcePath) || changed;
|
|
470
|
+
changed = ensureGeneratedPatchFile(workspaceRoot, effectDeclarationPatchPath, effectDeclarationPatchSourcePath) || changed;
|
|
471
|
+
changed = options.includeDrizzleOrmPatch ? ensureGeneratedPatchFile(workspaceRoot, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed : removeGeneratedPatchFileIfUnchanged(workspaceRoot, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed;
|
|
472
|
+
return changed;
|
|
473
|
+
}
|
|
474
|
+
function updateGeneratedPnpmWorkspacePolicy(workspaceRoot) {
|
|
475
|
+
const workspaceFile = node_path.join(workspaceRoot, 'pnpm-workspace.yaml');
|
|
476
|
+
if (!node_fs.existsSync(workspaceFile)) return false;
|
|
477
|
+
let source = node_fs.readFileSync(workspaceFile, 'utf-8');
|
|
478
|
+
let changed = false;
|
|
479
|
+
const usesDrizzleOrm = workspaceUsesDependency(workspaceRoot, 'drizzle-orm');
|
|
480
|
+
const replacements = [
|
|
481
|
+
[
|
|
482
|
+
/^ {4}'@effect\/vitest>effect': .+$/mu,
|
|
483
|
+
` '@effect/vitest>effect': '${EFFECT_VERSION}'`
|
|
484
|
+
]
|
|
485
|
+
];
|
|
486
|
+
for (const [pattern, replacement] of replacements){
|
|
487
|
+
const result = replaceYamlLine(source, pattern, replacement);
|
|
488
|
+
source = result.source;
|
|
489
|
+
changed = result.changed || changed;
|
|
490
|
+
}
|
|
491
|
+
for (const [entryKey, version] of [
|
|
492
|
+
[
|
|
493
|
+
"'@effect/opentelemetry'",
|
|
494
|
+
EFFECT_VERSION
|
|
495
|
+
],
|
|
496
|
+
[
|
|
497
|
+
"'@effect/vitest'",
|
|
498
|
+
EFFECT_VITEST_VERSION
|
|
499
|
+
],
|
|
500
|
+
[
|
|
501
|
+
'effect',
|
|
502
|
+
EFFECT_VERSION
|
|
503
|
+
]
|
|
504
|
+
]){
|
|
505
|
+
const result = ensureYamlScalarMapEntry(source, 'overrides', entryKey, version);
|
|
506
|
+
source = result.source;
|
|
507
|
+
changed = result.changed || changed;
|
|
508
|
+
}
|
|
509
|
+
for (const item of strictEffectPackageVersionPolicyExclusions){
|
|
510
|
+
const packageName = item.slice(0, item.lastIndexOf('@'));
|
|
511
|
+
const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
512
|
+
const currentVersion = replaceYamlLine(source, new RegExp(`^ {2}- '${escapedPackageName}@[^']+'$`, 'gmu'), ` - '${item}'`);
|
|
513
|
+
source = currentVersion.source;
|
|
514
|
+
changed = currentVersion.changed || changed;
|
|
515
|
+
for (const policyKey of [
|
|
516
|
+
'minimumReleaseAgeExclude',
|
|
517
|
+
'trustPolicyExclude'
|
|
518
|
+
]){
|
|
519
|
+
const policyExclude = ensureYamlListItem(source, policyKey, item);
|
|
520
|
+
source = policyExclude.source;
|
|
521
|
+
changed = policyExclude.changed || changed;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
const effectPatch = ensureYamlMapEntry(source, 'patchedDependencies', `effect@${EFFECT_VERSION}`, effectDeclarationPatchPath);
|
|
525
|
+
source = effectPatch.source;
|
|
526
|
+
changed = effectPatch.changed || changed;
|
|
527
|
+
const moduleFederationModernJsPatch = ensureYamlMapEntry(source, 'patchedDependencies', `@module-federation/modern-js-v3@${MODULE_FEDERATION_VERSION}`, moduleFederationModernJsPatchPath);
|
|
528
|
+
source = moduleFederationModernJsPatch.source;
|
|
529
|
+
changed = moduleFederationModernJsPatch.changed || changed;
|
|
530
|
+
const moduleFederationBridgeReactPatch = ensureYamlMapEntry(source, 'patchedDependencies', `@module-federation/bridge-react@${MODULE_FEDERATION_VERSION}`, moduleFederationBridgeReactPatchPath);
|
|
531
|
+
source = moduleFederationBridgeReactPatch.source;
|
|
532
|
+
changed = moduleFederationBridgeReactPatch.changed || changed;
|
|
533
|
+
const drizzleOrmPatch = usesDrizzleOrm ? ensureYamlMapEntry(source, 'patchedDependencies', `drizzle-orm@${DRIZZLE_ORM_VERSION}`, drizzleOrmDeclarationPatchPath) : removeYamlMapEntry(source, `drizzle-orm@${DRIZZLE_ORM_VERSION}`);
|
|
534
|
+
source = drizzleOrmPatch.source;
|
|
535
|
+
changed = drizzleOrmPatch.changed || changed;
|
|
536
|
+
if (changed) node_fs.writeFileSync(workspaceFile, source, 'utf-8');
|
|
537
|
+
return changed;
|
|
538
|
+
}
|
|
220
539
|
function updateUltramodernConfig(workspaceRoot, packageSource) {
|
|
221
540
|
const configPath = node_path.join(workspaceRoot, '.modernjs/ultramodern.json');
|
|
222
541
|
const config = readJsonFile(configPath);
|
|
@@ -236,6 +555,64 @@ function updateUltramodernConfig(workspaceRoot, packageSource) {
|
|
|
236
555
|
for (const app of config.topology?.apps ?? [])if (app && 'object' == typeof app && !Array.isArray(app)) normalizeStrictEffectApiMetadata(app);
|
|
237
556
|
writeJsonFile(configPath, config);
|
|
238
557
|
}
|
|
558
|
+
function writeJsonIfChanged(filePath, value) {
|
|
559
|
+
const next = `${JSON.stringify(value, null, 2)}\n`;
|
|
560
|
+
if (node_fs.existsSync(filePath) && node_fs.readFileSync(filePath, 'utf-8') === next) return false;
|
|
561
|
+
node_fs.mkdirSync(node_path.dirname(filePath), {
|
|
562
|
+
recursive: true
|
|
563
|
+
});
|
|
564
|
+
node_fs.writeFileSync(filePath, next, 'utf-8');
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
function writeTextIfChanged(filePath, value) {
|
|
568
|
+
if (node_fs.existsSync(filePath) && node_fs.readFileSync(filePath, 'utf-8') === value) return false;
|
|
569
|
+
node_fs.mkdirSync(node_path.dirname(filePath), {
|
|
570
|
+
recursive: true
|
|
571
|
+
});
|
|
572
|
+
node_fs.writeFileSync(filePath, value, 'utf-8');
|
|
573
|
+
return true;
|
|
574
|
+
}
|
|
575
|
+
function ensureGeneratedIgnoreRules(workspaceRoot) {
|
|
576
|
+
const gitignorePath = node_path.join(workspaceRoot, '.gitignore');
|
|
577
|
+
const existing = node_fs.existsSync(gitignorePath) ? node_fs.readFileSync(gitignorePath, 'utf-8') : '';
|
|
578
|
+
const lines = 0 === existing.trimEnd().length ? [] : existing.trimEnd().split(/\r?\n/u);
|
|
579
|
+
let changed = false;
|
|
580
|
+
for (const rule of [
|
|
581
|
+
'.mf/',
|
|
582
|
+
'**/.mf/',
|
|
583
|
+
'dist-cloudflare/'
|
|
584
|
+
])if (!lines.includes(rule)) {
|
|
585
|
+
lines.push(rule);
|
|
586
|
+
changed = true;
|
|
587
|
+
}
|
|
588
|
+
if (!changed) return false;
|
|
589
|
+
const next = `${lines.join('\n')}\n`;
|
|
590
|
+
node_fs.writeFileSync(gitignorePath, next, 'utf-8');
|
|
591
|
+
return true;
|
|
592
|
+
}
|
|
593
|
+
function updateGeneratedTypeScriptSurfaces(workspaceRoot, config) {
|
|
594
|
+
let changed = false;
|
|
595
|
+
const apps = workspaceAppsFromToolingConfig(config);
|
|
596
|
+
const remotes = apps.filter((app)=>'shell' !== app.kind);
|
|
597
|
+
changed = writeJsonIfChanged(node_path.join(workspaceRoot, 'tsconfig.base.json'), createTsConfigBase()) || changed;
|
|
598
|
+
changed = ensureGeneratedIgnoreRules(workspaceRoot) || changed;
|
|
599
|
+
for (const sharedPackage of [
|
|
600
|
+
'packages/shared-contracts',
|
|
601
|
+
'packages/shared-design-tokens'
|
|
602
|
+
])changed = writeJsonIfChanged(node_path.join(workspaceRoot, sharedPackage, 'tsconfig.json'), createSharedPackageTsConfig(sharedPackage)) || changed;
|
|
603
|
+
for (const app of apps){
|
|
604
|
+
changed = writeJsonIfChanged(node_path.join(workspaceRoot, app.directory, 'tsconfig.json'), createAppTsConfig(app, remotes)) || changed;
|
|
605
|
+
changed = writeJsonIfChanged(node_path.join(workspaceRoot, app.directory, 'tsconfig.mf-types.json'), createAppMfTypesTsConfig(app)) || changed;
|
|
606
|
+
changed = writeTextIfChanged(node_path.join(workspaceRoot, app.directory, 'src/modern-app-env.d.ts'), createAppEnvDts(app, remotes)) || changed;
|
|
607
|
+
}
|
|
608
|
+
return changed;
|
|
609
|
+
}
|
|
610
|
+
function updateGeneratedModernConfigs(workspaceRoot, config) {
|
|
611
|
+
let changed = false;
|
|
612
|
+
const apps = workspaceAppsFromToolingConfig(config);
|
|
613
|
+
for (const app of apps)changed = writeTextIfChanged(node_path.join(workspaceRoot, app.directory, 'modern.config.ts'), createAppModernConfig(config.workspace.packageScope, app)) || changed;
|
|
614
|
+
return changed;
|
|
615
|
+
}
|
|
239
616
|
function updateReferenceTopology(workspaceRoot) {
|
|
240
617
|
const topologyPath = node_path.join(workspaceRoot, 'topology/reference-topology.json');
|
|
241
618
|
if (!node_fs.existsSync(topologyPath)) return false;
|
|
@@ -298,8 +675,10 @@ function runMigrateStrictEffect(args, context) {
|
|
|
298
675
|
modern-js-create ultramodern migrate-strict-effect --version <version> [--skip-install]
|
|
299
676
|
|
|
300
677
|
Updates generated UltraModern package-source metadata, Modern package aliases,
|
|
301
|
-
direct Effect API topology metadata,
|
|
302
|
-
|
|
678
|
+
framework-owned toolchain pins, direct Effect API topology metadata, strict
|
|
679
|
+
Effect pnpm overrides/trust policy, framework-owned TypeScript config
|
|
680
|
+
surfaces, and the pnpm lockfile. Source code still has to pass pnpm api:check
|
|
681
|
+
and pnpm contract:check.
|
|
303
682
|
`);
|
|
304
683
|
return 0;
|
|
305
684
|
}
|
|
@@ -307,6 +686,9 @@ workspaces. Source code still has to pass pnpm api:check and pnpm contract:check
|
|
|
307
686
|
const packageSource = createMigrationPackageSource(args, current);
|
|
308
687
|
updateUltramodernConfig(context.workspaceRoot, packageSource);
|
|
309
688
|
updateReferenceTopology(context.workspaceRoot);
|
|
689
|
+
const migrated = readUltramodernConfig(context.workspaceRoot);
|
|
690
|
+
updateGeneratedTypeScriptSurfaces(context.workspaceRoot, migrated);
|
|
691
|
+
updateGeneratedModernConfigs(context.workspaceRoot, migrated);
|
|
310
692
|
for (const relativePackageFile of listWorkspacePackageFiles(context.workspaceRoot)){
|
|
311
693
|
const packageFile = node_path.join(context.workspaceRoot, relativePackageFile);
|
|
312
694
|
const packageJson = readJsonFile(packageFile);
|
|
@@ -317,9 +699,17 @@ workspaces. Source code still has to pass pnpm api:check and pnpm contract:check
|
|
|
317
699
|
config: './.modernjs/ultramodern.json'
|
|
318
700
|
};
|
|
319
701
|
}
|
|
320
|
-
|
|
702
|
+
const modernDependenciesChanged = updateModernDependencies(packageJson, packageSource);
|
|
703
|
+
const toolingDependenciesChanged = updateGeneratedToolingDependencies(packageJson);
|
|
704
|
+
const generatedScriptsChanged = updateGeneratedPackageScripts(packageJson);
|
|
705
|
+
const changed = modernDependenciesChanged || toolingDependenciesChanged || generatedScriptsChanged;
|
|
706
|
+
if (changed) writeJsonFile(packageFile, packageJson);
|
|
321
707
|
else if ('package.json' === relativePackageFile) writeJsonFile(packageFile, packageJson);
|
|
322
708
|
}
|
|
709
|
+
updateGeneratedPnpmWorkspacePolicy(context.workspaceRoot);
|
|
710
|
+
ensureGeneratedDeclarationPatches(context.workspaceRoot, {
|
|
711
|
+
includeDrizzleOrmPatch: workspaceUsesDependency(context.workspaceRoot, 'drizzle-orm')
|
|
712
|
+
});
|
|
323
713
|
if (!hasFlag(args, '--skip-install')) {
|
|
324
714
|
const status = runPnpmLockfileRefresh(context);
|
|
325
715
|
if (0 !== status) return status;
|
|
@@ -28,17 +28,14 @@ function createAppEnvDts(app, remotes = []) {
|
|
|
28
28
|
}
|
|
29
29
|
`;
|
|
30
30
|
})).join('\n');
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
declare module '*.css';
|
|
41
|
-
${remoteModuleDeclarations ? `\n${remoteModuleDeclarations}` : ''}`;
|
|
31
|
+
const reactTypeImport = remoteModuleDeclarations ? "import type React from 'react';\n" : '';
|
|
32
|
+
return [
|
|
33
|
+
`import '@modern-js/app-tools/types';\n${reactTypeImport}`.trimEnd(),
|
|
34
|
+
`declare global {
|
|
35
|
+
const ULTRAMODERN_SITE_URL: string;
|
|
36
|
+
}`,
|
|
37
|
+
remoteModuleDeclarations.trimEnd()
|
|
38
|
+
].filter((section)=>section.length > 0).join('\n\n').concat('\n');
|
|
42
39
|
}
|
|
43
40
|
function createAppRuntimeConfig(app, scope, remotes = []) {
|
|
44
41
|
const pluginsConfig = 'shell' === app.kind ? ` plugins: [
|
|
@@ -26,6 +26,11 @@ function createAppModernConfig(scope, app) {
|
|
|
26
26
|
(cloudflareDeployEnabled ? '/' : \`http://localhost:\${port}\`);
|
|
27
27
|
const defaultRemoteAssetPrefix = \`\${remoteAssetOrigin.replace(/\\/+$/u, '')}/\`;
|
|
28
28
|
const defaultAssetPrefix = defaultRemoteAssetPrefix;`;
|
|
29
|
+
const devAssetPrefixSource = 'shell' === app.kind ? ` // Keep shell dev assets origin-relative so the shell works through
|
|
30
|
+
// tunnels and local previews without rewriting its own chunks.
|
|
31
|
+
assetPrefix: '/',` : ` // Remote dev manifests must publish an absolute publicPath so host
|
|
32
|
+
// shells load remoteEntry.js and exposed chunks from this dev server.
|
|
33
|
+
assetPrefix,`;
|
|
29
34
|
return `// @effect-diagnostics processEnv:off
|
|
30
35
|
import {
|
|
31
36
|
appTools,
|
|
@@ -94,8 +99,10 @@ ${defaultAssetPrefixSource}
|
|
|
94
99
|
// load remoteEntry.js and exposed chunks from the remote origin, not the host.
|
|
95
100
|
const assetPrefix =
|
|
96
101
|
configuredModernAssetPrefix || configuredUltramodernAssetPrefix || defaultAssetPrefix;
|
|
97
|
-
const
|
|
98
|
-
const
|
|
102
|
+
const buildTarget = cloudflareDeployEnabled ? 'cloudflare' : 'web';
|
|
103
|
+
const buildOutputRoot = cloudflareDeployEnabled ? 'dist-cloudflare' : 'dist';
|
|
104
|
+
const buildTempDirectory = \`node_modules/.modern-js-\${appId}-\${buildTarget}\`;
|
|
105
|
+
const buildCacheDirectory = \`node_modules/.cache/rspack-\${appId}-\${buildTarget}\`;
|
|
99
106
|
|
|
100
107
|
if (
|
|
101
108
|
cloudflareDeployEnabled &&
|
|
@@ -125,9 +132,7 @@ ${bffConfig} ...(cloudflareDeployEnabled
|
|
|
125
132
|
}
|
|
126
133
|
: {}),
|
|
127
134
|
dev: {
|
|
128
|
-
|
|
129
|
-
// http://localhost:<port> prefix breaks pages served through tunnels.
|
|
130
|
-
assetPrefix: '/',
|
|
135
|
+
${devAssetPrefixSource}
|
|
131
136
|
},
|
|
132
137
|
html: {
|
|
133
138
|
outputStructure: 'flat',
|
|
@@ -137,13 +142,15 @@ ${bffConfig} ...(cloudflareDeployEnabled
|
|
|
137
142
|
disableTsChecker: false,
|
|
138
143
|
distPath: {
|
|
139
144
|
html: './',
|
|
145
|
+
root: buildOutputRoot,
|
|
140
146
|
},
|
|
141
147
|
polyfill: 'off',
|
|
142
148
|
splitRouteChunks: true,
|
|
149
|
+
tempDir: buildTempDirectory,
|
|
143
150
|
},
|
|
144
151
|
performance: {
|
|
145
152
|
buildCache: {
|
|
146
|
-
cacheDigest: [appId,
|
|
153
|
+
cacheDigest: [appId, buildTarget],
|
|
147
154
|
cacheDirectory: buildCacheDirectory,
|
|
148
155
|
},
|
|
149
156
|
rsdoctor: {
|