@bleedingdev/modern-js-create 3.5.0-ultramodern.10 → 3.5.0-ultramodern.12
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 +176 -2
- package/dist/cjs/ultramodern-workspace/app-files.cjs +8 -11
- package/dist/cjs/ultramodern-workspace/package-json.cjs +14 -6
- package/dist/cjs/ultramodern-workspace/versions.cjs +5 -0
- package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +1 -0
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +1 -0
- package/dist/esm/ultramodern-tooling/commands.js +177 -3
- package/dist/esm/ultramodern-workspace/app-files.js +8 -11
- package/dist/esm/ultramodern-workspace/package-json.js +4 -6
- package/dist/esm/ultramodern-workspace/versions.js +3 -1
- package/dist/esm/ultramodern-workspace/workspace-scripts.js +2 -1
- package/dist/esm/ultramodern-workspace/write-workspace.js +2 -1
- package/dist/esm-node/ultramodern-tooling/commands.js +177 -3
- package/dist/esm-node/ultramodern-workspace/app-files.js +8 -11
- package/dist/esm-node/ultramodern-workspace/package-json.js +4 -6
- package/dist/esm-node/ultramodern-workspace/versions.js +3 -1
- package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +2 -1
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +2 -1
- package/dist/types/ultramodern-workspace/versions.d.ts +2 -0
- package/package.json +3 -3
- package/template-workspace/.gitignore.handlebars +2 -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 +1 -0
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +37 -2
|
@@ -52,7 +52,9 @@ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_no
|
|
|
52
52
|
const external_node_url_namespaceObject = require("node:url");
|
|
53
53
|
const external_create_package_root_cjs_namespaceObject = require("../create-package-root.cjs");
|
|
54
54
|
const external_ultramodern_package_source_cjs_namespaceObject = require("../ultramodern-package-source.cjs");
|
|
55
|
+
const app_files_cjs_namespaceObject = require("../ultramodern-workspace/app-files.cjs");
|
|
55
56
|
const mf_validation_cjs_namespaceObject = require("../ultramodern-workspace/mf-validation.cjs");
|
|
57
|
+
const package_json_cjs_namespaceObject = require("../ultramodern-workspace/package-json.cjs");
|
|
56
58
|
const versions_cjs_namespaceObject = require("../ultramodern-workspace/versions.cjs");
|
|
57
59
|
const workspace_scripts_cjs_namespaceObject = require("../ultramodern-workspace/workspace-scripts.cjs");
|
|
58
60
|
const external_config_cjs_namespaceObject = require("./config.cjs");
|
|
@@ -233,6 +235,10 @@ const strictEffectPackageVersionPolicyExclusions = [
|
|
|
233
235
|
`effect@${versions_cjs_namespaceObject.EFFECT_VERSION}`,
|
|
234
236
|
`@effect/opentelemetry@${versions_cjs_namespaceObject.EFFECT_VERSION}`
|
|
235
237
|
];
|
|
238
|
+
const effectDeclarationPatchPath = 'patches/effect-schema-error-type-id.patch';
|
|
239
|
+
const effectDeclarationPatchSourcePath = external_node_path_default().join(createPackageRoot, 'template-workspace', effectDeclarationPatchPath);
|
|
240
|
+
const drizzleOrmDeclarationPatchPath = 'patches/drizzle-orm-ts7-strict-declarations.patch';
|
|
241
|
+
const drizzleOrmDeclarationPatchSourcePath = external_node_path_default().join(createPackageRoot, 'template-workspace', drizzleOrmDeclarationPatchPath);
|
|
236
242
|
function updateGeneratedToolingDependencies(packageJson) {
|
|
237
243
|
let changed = false;
|
|
238
244
|
for (const section of [
|
|
@@ -368,11 +374,117 @@ function ensureYamlListItem(source, key, item) {
|
|
|
368
374
|
changed: true
|
|
369
375
|
};
|
|
370
376
|
}
|
|
377
|
+
function ensureYamlMapEntry(source, key, entryKey, value) {
|
|
378
|
+
const entryLine = ` '${entryKey}': ${value}`;
|
|
379
|
+
const packageName = entryKey.includes('@') ? entryKey.slice(0, entryKey.lastIndexOf('@')) : entryKey;
|
|
380
|
+
const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
381
|
+
const currentEntryPattern = new RegExp(`^ {2}'${escapedPackageName}@[^']+': .+$`, 'mu');
|
|
382
|
+
const currentEntry = source.match(currentEntryPattern);
|
|
383
|
+
if (currentEntry) {
|
|
384
|
+
if (currentEntry[0] === entryLine) return {
|
|
385
|
+
source,
|
|
386
|
+
changed: false
|
|
387
|
+
};
|
|
388
|
+
return {
|
|
389
|
+
source: source.replace(currentEntryPattern, entryLine),
|
|
390
|
+
changed: true
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
const headerPattern = new RegExp(`^${key}:\\n(?:(?: .+\\n)*)`, 'mu');
|
|
394
|
+
const header = source.match(headerPattern);
|
|
395
|
+
if (header) {
|
|
396
|
+
if (header[0].split('\n').includes(entryLine)) return {
|
|
397
|
+
source,
|
|
398
|
+
changed: false
|
|
399
|
+
};
|
|
400
|
+
return {
|
|
401
|
+
source: source.replace(headerPattern, `${header[0]}${entryLine}\n`),
|
|
402
|
+
changed: true
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
return {
|
|
406
|
+
source: `${source.trimEnd()}\n${key}:\n${entryLine}\n`,
|
|
407
|
+
changed: true
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function removeYamlMapEntry(source, entryKey) {
|
|
411
|
+
const packageName = entryKey.includes('@') ? entryKey.slice(0, entryKey.lastIndexOf('@')) : entryKey;
|
|
412
|
+
const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
413
|
+
const currentEntryPattern = new RegExp(`^ {2}'${escapedPackageName}@[^']+': .+\\n?`, 'mu');
|
|
414
|
+
if (!currentEntryPattern.test(source)) return {
|
|
415
|
+
source,
|
|
416
|
+
changed: false
|
|
417
|
+
};
|
|
418
|
+
return {
|
|
419
|
+
source: source.replace(currentEntryPattern, ''),
|
|
420
|
+
changed: true
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
function ensureGeneratedPatchFile(workspaceRoot, relativePatchPath, sourcePatchPath) {
|
|
424
|
+
const targetPath = external_node_path_default().join(workspaceRoot, relativePatchPath);
|
|
425
|
+
const patch = external_node_fs_default().readFileSync(sourcePatchPath, 'utf-8');
|
|
426
|
+
if (external_node_fs_default().existsSync(targetPath) && external_node_fs_default().readFileSync(targetPath, 'utf-8') === patch) return false;
|
|
427
|
+
external_node_fs_default().mkdirSync(external_node_path_default().dirname(targetPath), {
|
|
428
|
+
recursive: true
|
|
429
|
+
});
|
|
430
|
+
external_node_fs_default().writeFileSync(targetPath, patch, 'utf-8');
|
|
431
|
+
return true;
|
|
432
|
+
}
|
|
433
|
+
function removeGeneratedPatchFileIfUnchanged(workspaceRoot, relativePatchPath, sourcePatchPath) {
|
|
434
|
+
const targetPath = external_node_path_default().join(workspaceRoot, relativePatchPath);
|
|
435
|
+
if (!external_node_fs_default().existsSync(targetPath)) return false;
|
|
436
|
+
const patch = external_node_fs_default().readFileSync(sourcePatchPath, 'utf-8');
|
|
437
|
+
if (external_node_fs_default().readFileSync(targetPath, 'utf-8') !== patch) return false;
|
|
438
|
+
external_node_fs_default().rmSync(targetPath);
|
|
439
|
+
return true;
|
|
440
|
+
}
|
|
441
|
+
function workspaceUsesDependency(workspaceRoot, packageName) {
|
|
442
|
+
const packageJsonPaths = [
|
|
443
|
+
external_node_path_default().join(workspaceRoot, 'package.json')
|
|
444
|
+
];
|
|
445
|
+
for (const workspaceDir of [
|
|
446
|
+
'apps',
|
|
447
|
+
'verticals',
|
|
448
|
+
'packages'
|
|
449
|
+
]){
|
|
450
|
+
const absoluteWorkspaceDir = external_node_path_default().join(workspaceRoot, workspaceDir);
|
|
451
|
+
if (external_node_fs_default().existsSync(absoluteWorkspaceDir)) for (const entry of external_node_fs_default().readdirSync(absoluteWorkspaceDir, {
|
|
452
|
+
withFileTypes: true
|
|
453
|
+
})){
|
|
454
|
+
if (!entry.isDirectory()) continue;
|
|
455
|
+
const packageJsonPath = external_node_path_default().join(absoluteWorkspaceDir, entry.name, 'package.json');
|
|
456
|
+
if (external_node_fs_default().existsSync(packageJsonPath)) packageJsonPaths.push(packageJsonPath);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
for (const packageJsonPath of packageJsonPaths){
|
|
460
|
+
const packageJson = JSON.parse(external_node_fs_default().readFileSync(packageJsonPath, 'utf-8'));
|
|
461
|
+
for (const field of [
|
|
462
|
+
'dependencies',
|
|
463
|
+
'devDependencies',
|
|
464
|
+
'peerDependencies',
|
|
465
|
+
'optionalDependencies'
|
|
466
|
+
]){
|
|
467
|
+
const dependencies = packageJson[field];
|
|
468
|
+
if (dependencies && 'object' == typeof dependencies) {
|
|
469
|
+
if (Object.prototype.hasOwnProperty.call(dependencies, packageName)) return true;
|
|
470
|
+
for (const specifier of Object.values(dependencies))if ('string' == typeof specifier && specifier.startsWith(`npm:${packageName}@`)) return true;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return false;
|
|
475
|
+
}
|
|
476
|
+
function ensureGeneratedDeclarationPatches(workspaceRoot, options) {
|
|
477
|
+
let changed = false;
|
|
478
|
+
changed = ensureGeneratedPatchFile(workspaceRoot, effectDeclarationPatchPath, effectDeclarationPatchSourcePath) || changed;
|
|
479
|
+
changed = options.includeDrizzleOrmPatch ? ensureGeneratedPatchFile(workspaceRoot, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed : removeGeneratedPatchFileIfUnchanged(workspaceRoot, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed;
|
|
480
|
+
return changed;
|
|
481
|
+
}
|
|
371
482
|
function updateGeneratedPnpmWorkspacePolicy(workspaceRoot) {
|
|
372
483
|
const workspaceFile = external_node_path_default().join(workspaceRoot, 'pnpm-workspace.yaml');
|
|
373
484
|
if (!external_node_fs_default().existsSync(workspaceFile)) return false;
|
|
374
485
|
let source = external_node_fs_default().readFileSync(workspaceFile, 'utf-8');
|
|
375
486
|
let changed = false;
|
|
487
|
+
const usesDrizzleOrm = workspaceUsesDependency(workspaceRoot, 'drizzle-orm');
|
|
376
488
|
const replacements = [
|
|
377
489
|
[
|
|
378
490
|
/^ {4}'@effect\/vitest>effect': .+$/mu,
|
|
@@ -407,6 +519,12 @@ function updateGeneratedPnpmWorkspacePolicy(workspaceRoot) {
|
|
|
407
519
|
changed = policyExclude.changed || changed;
|
|
408
520
|
}
|
|
409
521
|
}
|
|
522
|
+
const effectPatch = ensureYamlMapEntry(source, 'patchedDependencies', `effect@${versions_cjs_namespaceObject.EFFECT_VERSION}`, effectDeclarationPatchPath);
|
|
523
|
+
source = effectPatch.source;
|
|
524
|
+
changed = effectPatch.changed || changed;
|
|
525
|
+
const drizzleOrmPatch = usesDrizzleOrm ? ensureYamlMapEntry(source, 'patchedDependencies', `drizzle-orm@${versions_cjs_namespaceObject.DRIZZLE_ORM_VERSION}`, drizzleOrmDeclarationPatchPath) : removeYamlMapEntry(source, `drizzle-orm@${versions_cjs_namespaceObject.DRIZZLE_ORM_VERSION}`);
|
|
526
|
+
source = drizzleOrmPatch.source;
|
|
527
|
+
changed = drizzleOrmPatch.changed || changed;
|
|
410
528
|
if (changed) external_node_fs_default().writeFileSync(workspaceFile, source, 'utf-8');
|
|
411
529
|
return changed;
|
|
412
530
|
}
|
|
@@ -429,6 +547,57 @@ function updateUltramodernConfig(workspaceRoot, packageSource) {
|
|
|
429
547
|
for (const app of config.topology?.apps ?? [])if (app && 'object' == typeof app && !Array.isArray(app)) normalizeStrictEffectApiMetadata(app);
|
|
430
548
|
writeJsonFile(configPath, config);
|
|
431
549
|
}
|
|
550
|
+
function writeJsonIfChanged(filePath, value) {
|
|
551
|
+
const next = `${JSON.stringify(value, null, 2)}\n`;
|
|
552
|
+
if (external_node_fs_default().existsSync(filePath) && external_node_fs_default().readFileSync(filePath, 'utf-8') === next) return false;
|
|
553
|
+
external_node_fs_default().mkdirSync(external_node_path_default().dirname(filePath), {
|
|
554
|
+
recursive: true
|
|
555
|
+
});
|
|
556
|
+
external_node_fs_default().writeFileSync(filePath, next, 'utf-8');
|
|
557
|
+
return true;
|
|
558
|
+
}
|
|
559
|
+
function writeTextIfChanged(filePath, value) {
|
|
560
|
+
if (external_node_fs_default().existsSync(filePath) && external_node_fs_default().readFileSync(filePath, 'utf-8') === value) return false;
|
|
561
|
+
external_node_fs_default().mkdirSync(external_node_path_default().dirname(filePath), {
|
|
562
|
+
recursive: true
|
|
563
|
+
});
|
|
564
|
+
external_node_fs_default().writeFileSync(filePath, value, 'utf-8');
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
function ensureGeneratedIgnoreRules(workspaceRoot) {
|
|
568
|
+
const gitignorePath = external_node_path_default().join(workspaceRoot, '.gitignore');
|
|
569
|
+
const existing = external_node_fs_default().existsSync(gitignorePath) ? external_node_fs_default().readFileSync(gitignorePath, 'utf-8') : '';
|
|
570
|
+
const lines = 0 === existing.trimEnd().length ? [] : existing.trimEnd().split(/\r?\n/u);
|
|
571
|
+
let changed = false;
|
|
572
|
+
for (const rule of [
|
|
573
|
+
'.mf/',
|
|
574
|
+
'**/.mf/'
|
|
575
|
+
])if (!lines.includes(rule)) {
|
|
576
|
+
lines.push(rule);
|
|
577
|
+
changed = true;
|
|
578
|
+
}
|
|
579
|
+
if (!changed) return false;
|
|
580
|
+
const next = `${lines.join('\n')}\n`;
|
|
581
|
+
external_node_fs_default().writeFileSync(gitignorePath, next, 'utf-8');
|
|
582
|
+
return true;
|
|
583
|
+
}
|
|
584
|
+
function updateGeneratedTypeScriptSurfaces(workspaceRoot, config) {
|
|
585
|
+
let changed = false;
|
|
586
|
+
const apps = (0, external_config_cjs_namespaceObject.workspaceAppsFromToolingConfig)(config);
|
|
587
|
+
const remotes = apps.filter((app)=>'shell' !== app.kind);
|
|
588
|
+
changed = writeJsonIfChanged(external_node_path_default().join(workspaceRoot, 'tsconfig.base.json'), (0, package_json_cjs_namespaceObject.createTsConfigBase)()) || changed;
|
|
589
|
+
changed = ensureGeneratedIgnoreRules(workspaceRoot) || changed;
|
|
590
|
+
for (const sharedPackage of [
|
|
591
|
+
'packages/shared-contracts',
|
|
592
|
+
'packages/shared-design-tokens'
|
|
593
|
+
])changed = writeJsonIfChanged(external_node_path_default().join(workspaceRoot, sharedPackage, 'tsconfig.json'), (0, package_json_cjs_namespaceObject.createSharedPackageTsConfig)(sharedPackage)) || changed;
|
|
594
|
+
for (const app of apps){
|
|
595
|
+
changed = writeJsonIfChanged(external_node_path_default().join(workspaceRoot, app.directory, 'tsconfig.json'), (0, package_json_cjs_namespaceObject.createAppTsConfig)(app, remotes)) || changed;
|
|
596
|
+
changed = writeJsonIfChanged(external_node_path_default().join(workspaceRoot, app.directory, 'tsconfig.mf-types.json'), (0, package_json_cjs_namespaceObject.createAppMfTypesTsConfig)(app)) || changed;
|
|
597
|
+
changed = writeTextIfChanged(external_node_path_default().join(workspaceRoot, app.directory, 'src/modern-app-env.d.ts'), (0, app_files_cjs_namespaceObject.createAppEnvDts)(app, remotes)) || changed;
|
|
598
|
+
}
|
|
599
|
+
return changed;
|
|
600
|
+
}
|
|
432
601
|
function updateReferenceTopology(workspaceRoot) {
|
|
433
602
|
const topologyPath = external_node_path_default().join(workspaceRoot, 'topology/reference-topology.json');
|
|
434
603
|
if (!external_node_fs_default().existsSync(topologyPath)) return false;
|
|
@@ -492,8 +661,9 @@ function runMigrateStrictEffect(args, context) {
|
|
|
492
661
|
|
|
493
662
|
Updates generated UltraModern package-source metadata, Modern package aliases,
|
|
494
663
|
framework-owned toolchain pins, direct Effect API topology metadata, strict
|
|
495
|
-
Effect pnpm overrides/trust policy,
|
|
496
|
-
has to pass pnpm api:check
|
|
664
|
+
Effect pnpm overrides/trust policy, framework-owned TypeScript config
|
|
665
|
+
surfaces, and the pnpm lockfile. Source code still has to pass pnpm api:check
|
|
666
|
+
and pnpm contract:check.
|
|
497
667
|
`);
|
|
498
668
|
return 0;
|
|
499
669
|
}
|
|
@@ -501,6 +671,7 @@ has to pass pnpm api:check and pnpm contract:check.
|
|
|
501
671
|
const packageSource = createMigrationPackageSource(args, current);
|
|
502
672
|
updateUltramodernConfig(context.workspaceRoot, packageSource);
|
|
503
673
|
updateReferenceTopology(context.workspaceRoot);
|
|
674
|
+
updateGeneratedTypeScriptSurfaces(context.workspaceRoot, current);
|
|
504
675
|
for (const relativePackageFile of listWorkspacePackageFiles(context.workspaceRoot)){
|
|
505
676
|
const packageFile = external_node_path_default().join(context.workspaceRoot, relativePackageFile);
|
|
506
677
|
const packageJson = readJsonFile(packageFile);
|
|
@@ -519,6 +690,9 @@ has to pass pnpm api:check and pnpm contract:check.
|
|
|
519
690
|
else if ('package.json' === relativePackageFile) writeJsonFile(packageFile, packageJson);
|
|
520
691
|
}
|
|
521
692
|
updateGeneratedPnpmWorkspacePolicy(context.workspaceRoot);
|
|
693
|
+
ensureGeneratedDeclarationPatches(context.workspaceRoot, {
|
|
694
|
+
includeDrizzleOrmPatch: workspaceUsesDependency(context.workspaceRoot, 'drizzle-orm')
|
|
695
|
+
});
|
|
522
696
|
if (!hasFlag(args, '--skip-install')) {
|
|
523
697
|
const status = runPnpmLockfileRefresh(context);
|
|
524
698
|
if (0 !== status) return status;
|
|
@@ -71,17 +71,14 @@ function createAppEnvDts(app, remotes = []) {
|
|
|
71
71
|
}
|
|
72
72
|
`;
|
|
73
73
|
})).join('\n');
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
declare module '*.css';
|
|
84
|
-
${remoteModuleDeclarations ? `\n${remoteModuleDeclarations}` : ''}`;
|
|
74
|
+
const reactTypeImport = remoteModuleDeclarations ? "import type React from 'react';\n" : '';
|
|
75
|
+
return [
|
|
76
|
+
`import '@modern-js/app-tools/types';\n${reactTypeImport}`.trimEnd(),
|
|
77
|
+
`declare global {
|
|
78
|
+
const ULTRAMODERN_SITE_URL: string;
|
|
79
|
+
}`,
|
|
80
|
+
remoteModuleDeclarations.trimEnd()
|
|
81
|
+
].filter((section)=>section.length > 0).join('\n\n').concat('\n');
|
|
85
82
|
}
|
|
86
83
|
function createAppRuntimeConfig(app, scope, remotes = []) {
|
|
87
84
|
const pluginsConfig = 'shell' === app.kind ? ` plugins: [
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
3
12
|
(()=>{
|
|
4
13
|
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
14
|
var define = (defs, kind)=>{
|
|
@@ -44,6 +53,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
44
53
|
createZephyrDependencies: ()=>createZephyrDependencies,
|
|
45
54
|
effectDiagnostics: ()=>effectDiagnostics
|
|
46
55
|
});
|
|
56
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
57
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
47
58
|
const external_ultramodern_package_source_cjs_namespaceObject = require("../ultramodern-package-source.cjs");
|
|
48
59
|
const external_descriptors_cjs_namespaceObject = require("./descriptors.cjs");
|
|
49
60
|
const external_fs_io_cjs_namespaceObject = require("./fs-io.cjs");
|
|
@@ -294,7 +305,6 @@ function createTsConfigBase() {
|
|
|
294
305
|
noFallthroughCasesInSwitch: true,
|
|
295
306
|
noPropertyAccessFromIndexSignature: true,
|
|
296
307
|
noImplicitReturns: true,
|
|
297
|
-
skipLibCheck: true,
|
|
298
308
|
resolveJsonModule: true,
|
|
299
309
|
plugins: [
|
|
300
310
|
{
|
|
@@ -326,7 +336,7 @@ function createReferences(packageDir, references) {
|
|
|
326
336
|
return [
|
|
327
337
|
...new Set(references)
|
|
328
338
|
].filter((reference)=>reference !== packageDir).map((reference)=>({
|
|
329
|
-
path:
|
|
339
|
+
path: external_node_path_default().relative(packageDir, reference).split(external_node_path_default().sep).join('/')
|
|
330
340
|
}));
|
|
331
341
|
}
|
|
332
342
|
function createPackageTsConfig(packageDir, options = {}) {
|
|
@@ -336,8 +346,6 @@ function createPackageTsConfig(packageDir, options = {}) {
|
|
|
336
346
|
const include = resolvedOptions.include ?? [
|
|
337
347
|
'src',
|
|
338
348
|
'locales/**/*.json',
|
|
339
|
-
'modern.config.ts',
|
|
340
|
-
'module-federation.config.ts',
|
|
341
349
|
'package.json',
|
|
342
350
|
'shared'
|
|
343
351
|
];
|
|
@@ -371,9 +379,9 @@ function createAppTsConfig(app, remotes = []) {
|
|
|
371
379
|
});
|
|
372
380
|
}
|
|
373
381
|
function createAppMfTypesTsConfig(app) {
|
|
374
|
-
const exposedFiles = Object.
|
|
382
|
+
const exposedFiles = Object.entries(app.exposes ?? {}).sort(([left], [right])=>'./Route' === left ? -1 : './Route' === right ? 1 : 0).map(([, exposePath])=>exposePath.replace(/^\.\//u, ''));
|
|
375
383
|
return {
|
|
376
|
-
extends:
|
|
384
|
+
extends: `${(0, external_naming_cjs_namespaceObject.relativeRootFor)(app.directory)}/tsconfig.base.json`,
|
|
377
385
|
include: [
|
|
378
386
|
...new Set([
|
|
379
387
|
...exposedFiles,
|
|
@@ -40,6 +40,7 @@ const POSTCSS_VERSION = '8.5.15';
|
|
|
40
40
|
const EFFECT_VERSION = '4.0.0-beta.91';
|
|
41
41
|
const EFFECT_VITEST_VERSION = '4.0.0-beta.91';
|
|
42
42
|
const EFFECT_TSGO_VERSION = '0.14.6';
|
|
43
|
+
const DRIZZLE_ORM_VERSION = '1.0.0-rc.4';
|
|
43
44
|
const TYPESCRIPT_STABLE_VERSION = '6.0.3';
|
|
44
45
|
const TYPESCRIPT_NATIVE_PREVIEW_VERSION = '7.0.0-dev.20260628.1';
|
|
45
46
|
const TYPESCRIPT_VERSION = TYPESCRIPT_STABLE_VERSION;
|
|
@@ -64,11 +65,13 @@ const ultramodernWorkspaceVersions = {
|
|
|
64
65
|
moduleFederation: MODULE_FEDERATION_VERSION,
|
|
65
66
|
effect: EFFECT_VERSION,
|
|
66
67
|
effectVitest: EFFECT_VITEST_VERSION,
|
|
68
|
+
drizzleOrm: DRIZZLE_ORM_VERSION,
|
|
67
69
|
tailwind: TAILWIND_VERSION,
|
|
68
70
|
tailwindPostcss: TAILWIND_POSTCSS_VERSION
|
|
69
71
|
};
|
|
70
72
|
__webpack_require__.d(__webpack_exports__, {}, {
|
|
71
73
|
CLOUDFLARE_COMPATIBILITY_DATE: CLOUDFLARE_COMPATIBILITY_DATE,
|
|
74
|
+
DRIZZLE_ORM_VERSION: DRIZZLE_ORM_VERSION,
|
|
72
75
|
EFFECT_TSGO_VERSION: EFFECT_TSGO_VERSION,
|
|
73
76
|
EFFECT_VERSION: EFFECT_VERSION,
|
|
74
77
|
EFFECT_VITEST_VERSION: EFFECT_VITEST_VERSION,
|
|
@@ -102,6 +105,7 @@ __webpack_require__.d(__webpack_exports__, {}, {
|
|
|
102
105
|
ultramodernWorkspaceVersions: ultramodernWorkspaceVersions
|
|
103
106
|
});
|
|
104
107
|
exports.CLOUDFLARE_COMPATIBILITY_DATE = __webpack_exports__.CLOUDFLARE_COMPATIBILITY_DATE;
|
|
108
|
+
exports.DRIZZLE_ORM_VERSION = __webpack_exports__.DRIZZLE_ORM_VERSION;
|
|
105
109
|
exports.EFFECT_TSGO_VERSION = __webpack_exports__.EFFECT_TSGO_VERSION;
|
|
106
110
|
exports.EFFECT_VERSION = __webpack_exports__.EFFECT_VERSION;
|
|
107
111
|
exports.EFFECT_VITEST_VERSION = __webpack_exports__.EFFECT_VITEST_VERSION;
|
|
@@ -135,6 +139,7 @@ exports.ZEPHYR_RSPACK_PLUGIN_VERSION = __webpack_exports__.ZEPHYR_RSPACK_PLUGIN_
|
|
|
135
139
|
exports.ultramodernWorkspaceVersions = __webpack_exports__.ultramodernWorkspaceVersions;
|
|
136
140
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
137
141
|
"CLOUDFLARE_COMPATIBILITY_DATE",
|
|
142
|
+
"DRIZZLE_ORM_VERSION",
|
|
138
143
|
"EFFECT_TSGO_VERSION",
|
|
139
144
|
"EFFECT_VERSION",
|
|
140
145
|
"EFFECT_VITEST_VERSION",
|
|
@@ -174,6 +174,7 @@ function createWorkspaceValidationScript(scope, enableTailwind, remotes = []) {
|
|
|
174
174
|
const expectedCloudflareSecurity = (0, external_policy_cjs_namespaceObject.createCloudflareSecurityContract)();
|
|
175
175
|
return (0, external_fs_io_cjs_namespaceObject.renderFileTemplate)("workspace-scripts/validate-ultramodern-workspace.mjs", {
|
|
176
176
|
packageScope: scope,
|
|
177
|
+
effectVersion: external_versions_cjs_namespaceObject.EFFECT_VERSION,
|
|
177
178
|
nodeVersion: external_versions_cjs_namespaceObject.NODE_VERSION,
|
|
178
179
|
pnpmVersion: external_versions_cjs_namespaceObject.PNPM_VERSION,
|
|
179
180
|
tailwindEnabledJson: JSON.stringify(enableTailwind),
|
|
@@ -175,6 +175,7 @@ function generateUltramodernWorkspace(options) {
|
|
|
175
175
|
nodeVersion: external_versions_cjs_namespaceObject.NODE_VERSION,
|
|
176
176
|
pnpmVersion: external_versions_cjs_namespaceObject.PNPM_VERSION,
|
|
177
177
|
nodeFetchVersion: external_versions_cjs_namespaceObject.NODE_FETCH_VERSION,
|
|
178
|
+
drizzleOrmVersion: external_versions_cjs_namespaceObject.DRIZZLE_ORM_VERSION,
|
|
178
179
|
effectVersion: external_versions_cjs_namespaceObject.EFFECT_VERSION,
|
|
179
180
|
effectVitestVersion: external_versions_cjs_namespaceObject.EFFECT_VITEST_VERSION,
|
|
180
181
|
tanstackRouterCoreVersion: external_versions_cjs_namespaceObject.TANSTACK_ROUTER_CORE_VERSION,
|
|
@@ -5,8 +5,10 @@ import node_path from "node:path";
|
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
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
|
+
import { createAppEnvDts } from "../ultramodern-workspace/app-files.js";
|
|
8
9
|
import { validateModuleFederationTypes } from "../ultramodern-workspace/mf-validation.js";
|
|
9
|
-
import {
|
|
10
|
+
import { createAppMfTypesTsConfig, createAppTsConfig, createSharedPackageTsConfig, createTsConfigBase } from "../ultramodern-workspace/package-json.js";
|
|
11
|
+
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";
|
|
10
12
|
import { createWorkspaceValidationScript } from "../ultramodern-workspace/workspace-scripts.js";
|
|
11
13
|
import { readUltramodernConfig, workspaceAppsFromToolingConfig } from "./config.js";
|
|
12
14
|
const commands_dirname = node_path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -186,6 +188,10 @@ const strictEffectPackageVersionPolicyExclusions = [
|
|
|
186
188
|
`effect@${EFFECT_VERSION}`,
|
|
187
189
|
`@effect/opentelemetry@${EFFECT_VERSION}`
|
|
188
190
|
];
|
|
191
|
+
const effectDeclarationPatchPath = 'patches/effect-schema-error-type-id.patch';
|
|
192
|
+
const effectDeclarationPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', effectDeclarationPatchPath);
|
|
193
|
+
const drizzleOrmDeclarationPatchPath = 'patches/drizzle-orm-ts7-strict-declarations.patch';
|
|
194
|
+
const drizzleOrmDeclarationPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', drizzleOrmDeclarationPatchPath);
|
|
189
195
|
function updateGeneratedToolingDependencies(packageJson) {
|
|
190
196
|
let changed = false;
|
|
191
197
|
for (const section of [
|
|
@@ -321,11 +327,117 @@ function ensureYamlListItem(source, key, item) {
|
|
|
321
327
|
changed: true
|
|
322
328
|
};
|
|
323
329
|
}
|
|
330
|
+
function ensureYamlMapEntry(source, key, entryKey, value) {
|
|
331
|
+
const entryLine = ` '${entryKey}': ${value}`;
|
|
332
|
+
const packageName = entryKey.includes('@') ? entryKey.slice(0, entryKey.lastIndexOf('@')) : entryKey;
|
|
333
|
+
const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
334
|
+
const currentEntryPattern = new RegExp(`^ {2}'${escapedPackageName}@[^']+': .+$`, 'mu');
|
|
335
|
+
const currentEntry = source.match(currentEntryPattern);
|
|
336
|
+
if (currentEntry) {
|
|
337
|
+
if (currentEntry[0] === entryLine) return {
|
|
338
|
+
source,
|
|
339
|
+
changed: false
|
|
340
|
+
};
|
|
341
|
+
return {
|
|
342
|
+
source: source.replace(currentEntryPattern, entryLine),
|
|
343
|
+
changed: true
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
const headerPattern = new RegExp(`^${key}:\\n(?:(?: .+\\n)*)`, 'mu');
|
|
347
|
+
const header = source.match(headerPattern);
|
|
348
|
+
if (header) {
|
|
349
|
+
if (header[0].split('\n').includes(entryLine)) return {
|
|
350
|
+
source,
|
|
351
|
+
changed: false
|
|
352
|
+
};
|
|
353
|
+
return {
|
|
354
|
+
source: source.replace(headerPattern, `${header[0]}${entryLine}\n`),
|
|
355
|
+
changed: true
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
source: `${source.trimEnd()}\n${key}:\n${entryLine}\n`,
|
|
360
|
+
changed: true
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function removeYamlMapEntry(source, entryKey) {
|
|
364
|
+
const packageName = entryKey.includes('@') ? entryKey.slice(0, entryKey.lastIndexOf('@')) : entryKey;
|
|
365
|
+
const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
366
|
+
const currentEntryPattern = new RegExp(`^ {2}'${escapedPackageName}@[^']+': .+\\n?`, 'mu');
|
|
367
|
+
if (!currentEntryPattern.test(source)) return {
|
|
368
|
+
source,
|
|
369
|
+
changed: false
|
|
370
|
+
};
|
|
371
|
+
return {
|
|
372
|
+
source: source.replace(currentEntryPattern, ''),
|
|
373
|
+
changed: true
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
function ensureGeneratedPatchFile(workspaceRoot, relativePatchPath, sourcePatchPath) {
|
|
377
|
+
const targetPath = node_path.join(workspaceRoot, relativePatchPath);
|
|
378
|
+
const patch = node_fs.readFileSync(sourcePatchPath, 'utf-8');
|
|
379
|
+
if (node_fs.existsSync(targetPath) && node_fs.readFileSync(targetPath, 'utf-8') === patch) return false;
|
|
380
|
+
node_fs.mkdirSync(node_path.dirname(targetPath), {
|
|
381
|
+
recursive: true
|
|
382
|
+
});
|
|
383
|
+
node_fs.writeFileSync(targetPath, patch, 'utf-8');
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
function removeGeneratedPatchFileIfUnchanged(workspaceRoot, relativePatchPath, sourcePatchPath) {
|
|
387
|
+
const targetPath = node_path.join(workspaceRoot, relativePatchPath);
|
|
388
|
+
if (!node_fs.existsSync(targetPath)) return false;
|
|
389
|
+
const patch = node_fs.readFileSync(sourcePatchPath, 'utf-8');
|
|
390
|
+
if (node_fs.readFileSync(targetPath, 'utf-8') !== patch) return false;
|
|
391
|
+
node_fs.rmSync(targetPath);
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
function workspaceUsesDependency(workspaceRoot, packageName) {
|
|
395
|
+
const packageJsonPaths = [
|
|
396
|
+
node_path.join(workspaceRoot, 'package.json')
|
|
397
|
+
];
|
|
398
|
+
for (const workspaceDir of [
|
|
399
|
+
'apps',
|
|
400
|
+
'verticals',
|
|
401
|
+
'packages'
|
|
402
|
+
]){
|
|
403
|
+
const absoluteWorkspaceDir = node_path.join(workspaceRoot, workspaceDir);
|
|
404
|
+
if (node_fs.existsSync(absoluteWorkspaceDir)) for (const entry of node_fs.readdirSync(absoluteWorkspaceDir, {
|
|
405
|
+
withFileTypes: true
|
|
406
|
+
})){
|
|
407
|
+
if (!entry.isDirectory()) continue;
|
|
408
|
+
const packageJsonPath = node_path.join(absoluteWorkspaceDir, entry.name, 'package.json');
|
|
409
|
+
if (node_fs.existsSync(packageJsonPath)) packageJsonPaths.push(packageJsonPath);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
for (const packageJsonPath of packageJsonPaths){
|
|
413
|
+
const packageJson = JSON.parse(node_fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
414
|
+
for (const field of [
|
|
415
|
+
'dependencies',
|
|
416
|
+
'devDependencies',
|
|
417
|
+
'peerDependencies',
|
|
418
|
+
'optionalDependencies'
|
|
419
|
+
]){
|
|
420
|
+
const dependencies = packageJson[field];
|
|
421
|
+
if (dependencies && 'object' == typeof dependencies) {
|
|
422
|
+
if (Object.prototype.hasOwnProperty.call(dependencies, packageName)) return true;
|
|
423
|
+
for (const specifier of Object.values(dependencies))if ('string' == typeof specifier && specifier.startsWith(`npm:${packageName}@`)) return true;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
function ensureGeneratedDeclarationPatches(workspaceRoot, options) {
|
|
430
|
+
let changed = false;
|
|
431
|
+
changed = ensureGeneratedPatchFile(workspaceRoot, effectDeclarationPatchPath, effectDeclarationPatchSourcePath) || changed;
|
|
432
|
+
changed = options.includeDrizzleOrmPatch ? ensureGeneratedPatchFile(workspaceRoot, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed : removeGeneratedPatchFileIfUnchanged(workspaceRoot, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed;
|
|
433
|
+
return changed;
|
|
434
|
+
}
|
|
324
435
|
function updateGeneratedPnpmWorkspacePolicy(workspaceRoot) {
|
|
325
436
|
const workspaceFile = node_path.join(workspaceRoot, 'pnpm-workspace.yaml');
|
|
326
437
|
if (!node_fs.existsSync(workspaceFile)) return false;
|
|
327
438
|
let source = node_fs.readFileSync(workspaceFile, 'utf-8');
|
|
328
439
|
let changed = false;
|
|
440
|
+
const usesDrizzleOrm = workspaceUsesDependency(workspaceRoot, 'drizzle-orm');
|
|
329
441
|
const replacements = [
|
|
330
442
|
[
|
|
331
443
|
/^ {4}'@effect\/vitest>effect': .+$/mu,
|
|
@@ -360,6 +472,12 @@ function updateGeneratedPnpmWorkspacePolicy(workspaceRoot) {
|
|
|
360
472
|
changed = policyExclude.changed || changed;
|
|
361
473
|
}
|
|
362
474
|
}
|
|
475
|
+
const effectPatch = ensureYamlMapEntry(source, 'patchedDependencies', `effect@${EFFECT_VERSION}`, effectDeclarationPatchPath);
|
|
476
|
+
source = effectPatch.source;
|
|
477
|
+
changed = effectPatch.changed || changed;
|
|
478
|
+
const drizzleOrmPatch = usesDrizzleOrm ? ensureYamlMapEntry(source, 'patchedDependencies', `drizzle-orm@${DRIZZLE_ORM_VERSION}`, drizzleOrmDeclarationPatchPath) : removeYamlMapEntry(source, `drizzle-orm@${DRIZZLE_ORM_VERSION}`);
|
|
479
|
+
source = drizzleOrmPatch.source;
|
|
480
|
+
changed = drizzleOrmPatch.changed || changed;
|
|
363
481
|
if (changed) node_fs.writeFileSync(workspaceFile, source, 'utf-8');
|
|
364
482
|
return changed;
|
|
365
483
|
}
|
|
@@ -382,6 +500,57 @@ function updateUltramodernConfig(workspaceRoot, packageSource) {
|
|
|
382
500
|
for (const app of config.topology?.apps ?? [])if (app && 'object' == typeof app && !Array.isArray(app)) normalizeStrictEffectApiMetadata(app);
|
|
383
501
|
writeJsonFile(configPath, config);
|
|
384
502
|
}
|
|
503
|
+
function writeJsonIfChanged(filePath, value) {
|
|
504
|
+
const next = `${JSON.stringify(value, null, 2)}\n`;
|
|
505
|
+
if (node_fs.existsSync(filePath) && node_fs.readFileSync(filePath, 'utf-8') === next) return false;
|
|
506
|
+
node_fs.mkdirSync(node_path.dirname(filePath), {
|
|
507
|
+
recursive: true
|
|
508
|
+
});
|
|
509
|
+
node_fs.writeFileSync(filePath, next, 'utf-8');
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
512
|
+
function writeTextIfChanged(filePath, value) {
|
|
513
|
+
if (node_fs.existsSync(filePath) && node_fs.readFileSync(filePath, 'utf-8') === value) return false;
|
|
514
|
+
node_fs.mkdirSync(node_path.dirname(filePath), {
|
|
515
|
+
recursive: true
|
|
516
|
+
});
|
|
517
|
+
node_fs.writeFileSync(filePath, value, 'utf-8');
|
|
518
|
+
return true;
|
|
519
|
+
}
|
|
520
|
+
function ensureGeneratedIgnoreRules(workspaceRoot) {
|
|
521
|
+
const gitignorePath = node_path.join(workspaceRoot, '.gitignore');
|
|
522
|
+
const existing = node_fs.existsSync(gitignorePath) ? node_fs.readFileSync(gitignorePath, 'utf-8') : '';
|
|
523
|
+
const lines = 0 === existing.trimEnd().length ? [] : existing.trimEnd().split(/\r?\n/u);
|
|
524
|
+
let changed = false;
|
|
525
|
+
for (const rule of [
|
|
526
|
+
'.mf/',
|
|
527
|
+
'**/.mf/'
|
|
528
|
+
])if (!lines.includes(rule)) {
|
|
529
|
+
lines.push(rule);
|
|
530
|
+
changed = true;
|
|
531
|
+
}
|
|
532
|
+
if (!changed) return false;
|
|
533
|
+
const next = `${lines.join('\n')}\n`;
|
|
534
|
+
node_fs.writeFileSync(gitignorePath, next, 'utf-8');
|
|
535
|
+
return true;
|
|
536
|
+
}
|
|
537
|
+
function updateGeneratedTypeScriptSurfaces(workspaceRoot, config) {
|
|
538
|
+
let changed = false;
|
|
539
|
+
const apps = workspaceAppsFromToolingConfig(config);
|
|
540
|
+
const remotes = apps.filter((app)=>'shell' !== app.kind);
|
|
541
|
+
changed = writeJsonIfChanged(node_path.join(workspaceRoot, 'tsconfig.base.json'), createTsConfigBase()) || changed;
|
|
542
|
+
changed = ensureGeneratedIgnoreRules(workspaceRoot) || changed;
|
|
543
|
+
for (const sharedPackage of [
|
|
544
|
+
'packages/shared-contracts',
|
|
545
|
+
'packages/shared-design-tokens'
|
|
546
|
+
])changed = writeJsonIfChanged(node_path.join(workspaceRoot, sharedPackage, 'tsconfig.json'), createSharedPackageTsConfig(sharedPackage)) || changed;
|
|
547
|
+
for (const app of apps){
|
|
548
|
+
changed = writeJsonIfChanged(node_path.join(workspaceRoot, app.directory, 'tsconfig.json'), createAppTsConfig(app, remotes)) || changed;
|
|
549
|
+
changed = writeJsonIfChanged(node_path.join(workspaceRoot, app.directory, 'tsconfig.mf-types.json'), createAppMfTypesTsConfig(app)) || changed;
|
|
550
|
+
changed = writeTextIfChanged(node_path.join(workspaceRoot, app.directory, 'src/modern-app-env.d.ts'), createAppEnvDts(app, remotes)) || changed;
|
|
551
|
+
}
|
|
552
|
+
return changed;
|
|
553
|
+
}
|
|
385
554
|
function updateReferenceTopology(workspaceRoot) {
|
|
386
555
|
const topologyPath = node_path.join(workspaceRoot, 'topology/reference-topology.json');
|
|
387
556
|
if (!node_fs.existsSync(topologyPath)) return false;
|
|
@@ -445,8 +614,9 @@ function runMigrateStrictEffect(args, context) {
|
|
|
445
614
|
|
|
446
615
|
Updates generated UltraModern package-source metadata, Modern package aliases,
|
|
447
616
|
framework-owned toolchain pins, direct Effect API topology metadata, strict
|
|
448
|
-
Effect pnpm overrides/trust policy,
|
|
449
|
-
has to pass pnpm api:check
|
|
617
|
+
Effect pnpm overrides/trust policy, framework-owned TypeScript config
|
|
618
|
+
surfaces, and the pnpm lockfile. Source code still has to pass pnpm api:check
|
|
619
|
+
and pnpm contract:check.
|
|
450
620
|
`);
|
|
451
621
|
return 0;
|
|
452
622
|
}
|
|
@@ -454,6 +624,7 @@ has to pass pnpm api:check and pnpm contract:check.
|
|
|
454
624
|
const packageSource = createMigrationPackageSource(args, current);
|
|
455
625
|
updateUltramodernConfig(context.workspaceRoot, packageSource);
|
|
456
626
|
updateReferenceTopology(context.workspaceRoot);
|
|
627
|
+
updateGeneratedTypeScriptSurfaces(context.workspaceRoot, current);
|
|
457
628
|
for (const relativePackageFile of listWorkspacePackageFiles(context.workspaceRoot)){
|
|
458
629
|
const packageFile = node_path.join(context.workspaceRoot, relativePackageFile);
|
|
459
630
|
const packageJson = readJsonFile(packageFile);
|
|
@@ -472,6 +643,9 @@ has to pass pnpm api:check and pnpm contract:check.
|
|
|
472
643
|
else if ('package.json' === relativePackageFile) writeJsonFile(packageFile, packageJson);
|
|
473
644
|
}
|
|
474
645
|
updateGeneratedPnpmWorkspacePolicy(context.workspaceRoot);
|
|
646
|
+
ensureGeneratedDeclarationPatches(context.workspaceRoot, {
|
|
647
|
+
includeDrizzleOrmPatch: workspaceUsesDependency(context.workspaceRoot, 'drizzle-orm')
|
|
648
|
+
});
|
|
475
649
|
if (!hasFlag(args, '--skip-install')) {
|
|
476
650
|
const status = runPnpmLockfileRefresh(context);
|
|
477
651
|
if (0 !== status) return status;
|
|
@@ -27,17 +27,14 @@ function createAppEnvDts(app, remotes = []) {
|
|
|
27
27
|
}
|
|
28
28
|
`;
|
|
29
29
|
})).join('\n');
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
declare module '*.css';
|
|
40
|
-
${remoteModuleDeclarations ? `\n${remoteModuleDeclarations}` : ''}`;
|
|
30
|
+
const reactTypeImport = remoteModuleDeclarations ? "import type React from 'react';\n" : '';
|
|
31
|
+
return [
|
|
32
|
+
`import '@modern-js/app-tools/types';\n${reactTypeImport}`.trimEnd(),
|
|
33
|
+
`declare global {
|
|
34
|
+
const ULTRAMODERN_SITE_URL: string;
|
|
35
|
+
}`,
|
|
36
|
+
remoteModuleDeclarations.trimEnd()
|
|
37
|
+
].filter((section)=>section.length > 0).join('\n\n').concat('\n');
|
|
41
38
|
}
|
|
42
39
|
function createAppRuntimeConfig(app, scope, remotes = []) {
|
|
43
40
|
const pluginsConfig = 'shell' === app.kind ? ` plugins: [
|