everything-dev 1.51.7 → 1.52.0
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/api-contract.cjs +61 -16
- package/dist/api-contract.cjs.map +1 -1
- package/dist/api-contract.mjs +60 -17
- package/dist/api-contract.mjs.map +1 -1
- package/dist/app.cjs +1 -1
- package/dist/app.cjs.map +1 -1
- package/dist/app.mjs +1 -1
- package/dist/app.mjs.map +1 -1
- package/dist/cli/init.cjs +76 -52
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +15 -7
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts +15 -7
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +70 -47
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/sync.cjs +34 -5
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +35 -6
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/upgrade.cjs +151 -93
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +138 -80
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/cli/utils/helpers.cjs +25 -0
- package/dist/cli/utils/helpers.cjs.map +1 -0
- package/dist/cli/utils/helpers.mjs +23 -0
- package/dist/cli/utils/helpers.mjs.map +1 -0
- package/dist/cli.cjs +84 -72
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +84 -72
- package/dist/cli.mjs.map +1 -1
- package/dist/code-artifacts.cjs +1 -1
- package/dist/code-artifacts.mjs +1 -1
- package/dist/config.cjs +44 -4
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +44 -4
- package/dist/config.mjs.map +1 -1
- package/dist/contract.cjs +9 -4
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +34 -24
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +34 -24
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.meta.cjs +2 -1
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +3 -0
- package/dist/contract.meta.d.mts +3 -0
- package/dist/contract.meta.mjs +2 -1
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +9 -4
- package/dist/contract.mjs.map +1 -1
- package/dist/dag.cjs +176 -0
- package/dist/dag.cjs.map +1 -0
- package/dist/dag.d.cts +24 -0
- package/dist/dag.d.cts.map +1 -0
- package/dist/dag.d.mts +24 -0
- package/dist/dag.d.mts.map +1 -0
- package/dist/dag.mjs +167 -0
- package/dist/dag.mjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/infra/planner.cjs +1 -1
- package/dist/infra/planner.mjs +1 -1
- package/dist/near-cli.cjs +1 -1
- package/dist/near-cli.mjs +1 -1
- package/dist/plugin.cjs +27 -18
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +57 -11
- package/dist/plugin.d.mts +57 -11
- package/dist/plugin.mjs +28 -19
- package/dist/plugin.mjs.map +1 -1
- package/dist/types.cjs +41 -6
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +118 -3
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +118 -3
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +40 -7
- package/dist/types.mjs.map +1 -1
- package/package.json +6 -1
package/dist/cli/upgrade.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_merge = require('../merge.cjs');
|
|
3
2
|
const require_config = require('../config.cjs');
|
|
4
3
|
const require_timing = require('./timing.cjs');
|
|
5
4
|
const require_shared_deps = require('../shared-deps.cjs');
|
|
6
5
|
const require_save_config = require('../utils/save-config.cjs');
|
|
6
|
+
const require_helpers = require('./utils/helpers.cjs');
|
|
7
7
|
const require_cli_init = require('./init.cjs');
|
|
8
8
|
const require_framework_version = require('./framework-version.cjs');
|
|
9
9
|
const require_sync = require('./sync.cjs');
|
|
@@ -14,6 +14,7 @@ node_process = require_runtime.__toESM(node_process, 1);
|
|
|
14
14
|
let _clack_prompts = require("@clack/prompts");
|
|
15
15
|
_clack_prompts = require_runtime.__toESM(_clack_prompts, 1);
|
|
16
16
|
let glob = require("glob");
|
|
17
|
+
let node_child_process = require("node:child_process");
|
|
17
18
|
|
|
18
19
|
//#region src/cli/upgrade.ts
|
|
19
20
|
const FRAMEWORK_PACKAGES = ["everything-dev", "every-plugin"];
|
|
@@ -48,7 +49,6 @@ const OBSOLETE_FILES = [
|
|
|
48
49
|
"ui/scripts/generate-metadata.ts",
|
|
49
50
|
".github/dependabot.yml",
|
|
50
51
|
".github/templates/dependabot.yml",
|
|
51
|
-
".github/renovate.json",
|
|
52
52
|
".github/workflows/packages-release.yml",
|
|
53
53
|
".github/workflows/publish.yml",
|
|
54
54
|
".github/workflows/release-sync.yml",
|
|
@@ -62,11 +62,8 @@ function extractSemver(value) {
|
|
|
62
62
|
if (!value) return null;
|
|
63
63
|
return value.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/)?.[0] ?? null;
|
|
64
64
|
}
|
|
65
|
-
function readJsonFile(filePath) {
|
|
66
|
-
return JSON.parse((0, node_fs.readFileSync)(filePath, "utf-8"));
|
|
67
|
-
}
|
|
68
65
|
function readRootPackageJson(projectDir) {
|
|
69
|
-
return readJsonFile((0, node_path.join)(projectDir, "package.json"));
|
|
66
|
+
return require_helpers.readJsonFile((0, node_path.join)(projectDir, "package.json"));
|
|
70
67
|
}
|
|
71
68
|
function readRootCatalogEntry(projectDir, packageName) {
|
|
72
69
|
return readRootPackageJson(projectDir).workspaces?.catalog?.[packageName];
|
|
@@ -148,23 +145,23 @@ function packageObjectNeedsCatalogRefs(pkg, packageNames) {
|
|
|
148
145
|
return false;
|
|
149
146
|
}
|
|
150
147
|
function packageFileNeedsCatalogRefs(filePath, packageNames) {
|
|
151
|
-
return packageObjectNeedsCatalogRefs(readJsonFile(filePath), packageNames);
|
|
148
|
+
return packageObjectNeedsCatalogRefs(require_helpers.readJsonFile(filePath), packageNames);
|
|
152
149
|
}
|
|
153
150
|
function updatePackageFileCatalogRefs(filePath, packageNames) {
|
|
154
|
-
const pkg = readJsonFile(filePath);
|
|
151
|
+
const pkg = require_helpers.readJsonFile(filePath);
|
|
155
152
|
const modified = syncPackageObjectCatalogRefs(pkg, packageNames);
|
|
156
153
|
if (modified) (0, node_fs.writeFileSync)(filePath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
157
154
|
return modified;
|
|
158
155
|
}
|
|
159
156
|
function updatePackageFileAuthCoreRef(filePath) {
|
|
160
|
-
const pkg = readJsonFile(filePath);
|
|
157
|
+
const pkg = require_helpers.readJsonFile(filePath);
|
|
161
158
|
const modified = ensureAuthCoreCatalogRef(pkg);
|
|
162
159
|
if (modified) (0, node_fs.writeFileSync)(filePath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
163
160
|
return modified;
|
|
164
161
|
}
|
|
165
162
|
function syncRootCatalogWithParent(projectDir, parentCatalog) {
|
|
166
163
|
const pkgPath = (0, node_path.join)(projectDir, "package.json");
|
|
167
|
-
const pkg = readJsonFile(pkgPath);
|
|
164
|
+
const pkg = require_helpers.readJsonFile(pkgPath);
|
|
168
165
|
let modified = syncPackageObjectCatalogRefs(pkg, Object.keys(parentCatalog));
|
|
169
166
|
if (!pkg.workspaces || typeof pkg.workspaces !== "object") {
|
|
170
167
|
pkg.workspaces = {
|
|
@@ -192,7 +189,7 @@ async function readExtendedRootSource(projectDir) {
|
|
|
192
189
|
extendsChain: []
|
|
193
190
|
};
|
|
194
191
|
const localConfig = JSON.parse((0, node_fs.readFileSync)(configPath, "utf-8"));
|
|
195
|
-
let extendsRef = getExtendsRef(localConfig);
|
|
192
|
+
let extendsRef = require_helpers.getExtendsRef(localConfig);
|
|
196
193
|
if (!extendsRef?.startsWith("bos://")) return {
|
|
197
194
|
catalog: {},
|
|
198
195
|
repository: typeof localConfig.repository === "string" ? localConfig.repository : void 0,
|
|
@@ -206,7 +203,7 @@ async function readExtendedRootSource(projectDir) {
|
|
|
206
203
|
if (visited.has(extendsRef)) throw new Error(`Circular extends detected while resolving upgrade source: ${extendsRef}`);
|
|
207
204
|
visited.add(extendsRef);
|
|
208
205
|
extendsChain.push(extendsRef);
|
|
209
|
-
const parsed = parseBosRef(extendsRef);
|
|
206
|
+
const parsed = require_helpers.parseBosRef(extendsRef);
|
|
210
207
|
if (!parsed) break;
|
|
211
208
|
rootRef = extendsRef;
|
|
212
209
|
let parentConfig;
|
|
@@ -216,11 +213,11 @@ async function readExtendedRootSource(projectDir) {
|
|
|
216
213
|
break;
|
|
217
214
|
}
|
|
218
215
|
if (typeof parentConfig.repository === "string") repository = parentConfig.repository;
|
|
219
|
-
const nextExtendsRef = getExtendsRef(parentConfig);
|
|
216
|
+
const nextExtendsRef = require_helpers.getExtendsRef(parentConfig);
|
|
220
217
|
if (!nextExtendsRef?.startsWith("bos://")) break;
|
|
221
218
|
extendsRef = nextExtendsRef;
|
|
222
219
|
}
|
|
223
|
-
const parsed = parseBosRef(rootRef);
|
|
220
|
+
const parsed = require_helpers.parseBosRef(rootRef);
|
|
224
221
|
if (!parsed) return {
|
|
225
222
|
catalog: {},
|
|
226
223
|
repository,
|
|
@@ -236,18 +233,6 @@ async function readExtendedRootSource(projectDir) {
|
|
|
236
233
|
extendsChain: source.extendsChain.length > 0 ? source.extendsChain : extendsChain
|
|
237
234
|
};
|
|
238
235
|
}
|
|
239
|
-
function getExtendsRef(config) {
|
|
240
|
-
if (typeof config.extends === "string") return config.extends;
|
|
241
|
-
if (config.extends && typeof config.extends === "object") return require_merge.resolveExtendsRef(config.extends, "production");
|
|
242
|
-
}
|
|
243
|
-
function parseBosRef(ref) {
|
|
244
|
-
const match = ref.match(/^bos:\/\/([^/]+)\/(.+)$/);
|
|
245
|
-
if (!match?.[1] || !match[2]) return null;
|
|
246
|
-
return {
|
|
247
|
-
account: match[1],
|
|
248
|
-
gateway: match[2]
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
236
|
function parseTargetedRef(ref) {
|
|
252
237
|
const hashIndex = ref.indexOf("#");
|
|
253
238
|
if (hashIndex === -1) return { configRef: ref };
|
|
@@ -446,9 +431,9 @@ async function loadParentPluginOptions(projectDir) {
|
|
|
446
431
|
const configPath = (0, node_path.join)(projectDir, "bos.config.json");
|
|
447
432
|
if (!(0, node_fs.existsSync)(configPath)) return null;
|
|
448
433
|
const localConfig = JSON.parse((0, node_fs.readFileSync)(configPath, "utf-8"));
|
|
449
|
-
const extendsRef = getExtendsRef(localConfig);
|
|
434
|
+
const extendsRef = require_helpers.getExtendsRef(localConfig);
|
|
450
435
|
if (!extendsRef?.startsWith("bos://")) return null;
|
|
451
|
-
const parsed = parseBosRef(extendsRef);
|
|
436
|
+
const parsed = require_helpers.parseBosRef(extendsRef);
|
|
452
437
|
if (!parsed) return null;
|
|
453
438
|
let parentConfig;
|
|
454
439
|
try {
|
|
@@ -528,8 +513,8 @@ async function migrateChildRootPackageJson(projectDir) {
|
|
|
528
513
|
const configPath = (0, node_path.join)(projectDir, "bos.config.json");
|
|
529
514
|
const pkgPath = (0, node_path.join)(projectDir, "package.json");
|
|
530
515
|
if (!(0, node_fs.existsSync)(configPath) || !(0, node_fs.existsSync)(pkgPath)) return false;
|
|
531
|
-
if (!getExtendsRef(readJsonFile(configPath))?.startsWith("bos://")) return false;
|
|
532
|
-
const pkg = readJsonFile(pkgPath);
|
|
516
|
+
if (!require_helpers.getExtendsRef(require_helpers.readJsonFile(configPath))?.startsWith("bos://")) return false;
|
|
517
|
+
const pkg = require_helpers.readJsonFile(pkgPath);
|
|
533
518
|
let changed = false;
|
|
534
519
|
if (pkg.private !== true) {
|
|
535
520
|
pkg.private = true;
|
|
@@ -564,7 +549,11 @@ async function migrateChildRootPackageJson(projectDir) {
|
|
|
564
549
|
scripts[key] = value;
|
|
565
550
|
changed = true;
|
|
566
551
|
}
|
|
567
|
-
for (const obsoleteScript of [
|
|
552
|
+
for (const obsoleteScript of [
|
|
553
|
+
...require_cli_init.getParentOnlyScriptKeys(projectDir),
|
|
554
|
+
"sync-catalog",
|
|
555
|
+
"init"
|
|
556
|
+
]) if (obsoleteScript in scripts) {
|
|
568
557
|
delete scripts[obsoleteScript];
|
|
569
558
|
changed = true;
|
|
570
559
|
}
|
|
@@ -630,7 +619,7 @@ async function rewriteLegacyUiImports(projectDir) {
|
|
|
630
619
|
}
|
|
631
620
|
return migrated;
|
|
632
621
|
}
|
|
633
|
-
const LEGACY_DIST_IMPORT_REWRITES = [["from \"everything-dev/
|
|
622
|
+
const LEGACY_DIST_IMPORT_REWRITES = [["from \"everything-dev/", "from \"everything-dev/"], ["from 'everything-dev/", "from 'everything-dev/"]];
|
|
634
623
|
function escapeRegex(s) {
|
|
635
624
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
636
625
|
}
|
|
@@ -775,6 +764,73 @@ async function rewriteLegacyDistImports(projectDir) {
|
|
|
775
764
|
}
|
|
776
765
|
return migrated;
|
|
777
766
|
}
|
|
767
|
+
async function runMigrationPhase(projectDir, options, parentSource) {
|
|
768
|
+
const timings = [];
|
|
769
|
+
const migratedBosConfigs = await require_timing.timePhase(timings, "migrate bos configs", () => migrateBosConfigFiles(projectDir));
|
|
770
|
+
const migratedRootPackageJson = await require_timing.timePhase(timings, "migrate root package", () => migrateChildRootPackageJson(projectDir));
|
|
771
|
+
let syncResult;
|
|
772
|
+
let addedPlugins = [];
|
|
773
|
+
if (!options.noSync && parentSource.extendsChain.length > 0) {
|
|
774
|
+
addedPlugins = await require_timing.timePhase(timings, "discover parent plugins", async () => {
|
|
775
|
+
if (options.dryRun) return [];
|
|
776
|
+
return addSelectedParentPlugins(projectDir);
|
|
777
|
+
});
|
|
778
|
+
syncResult = await require_timing.timePhase(timings, "sync template", () => require_sync.syncTemplate(projectDir, {
|
|
779
|
+
dryRun: false,
|
|
780
|
+
noInstall: true,
|
|
781
|
+
json: false
|
|
782
|
+
}));
|
|
783
|
+
}
|
|
784
|
+
await require_timing.timePhase(timings, "sync shared deps", async () => {
|
|
785
|
+
const configResult = await require_config.loadResolvedConfig({ cwd: projectDir });
|
|
786
|
+
if (!configResult) throw new Error("No bos.config.json found in current directory");
|
|
787
|
+
return require_shared_deps.syncResolvedSharedDeps({
|
|
788
|
+
configDir: projectDir,
|
|
789
|
+
hostMode: "local",
|
|
790
|
+
bosConfig: configResult.config
|
|
791
|
+
});
|
|
792
|
+
});
|
|
793
|
+
if (!options.noInstall) await require_timing.timePhase(timings, "generate types", () => require_cli_init.runTypesGen(projectDir));
|
|
794
|
+
const migratedFiles = await require_timing.timePhase(timings, "clean obsolete files", async () => {
|
|
795
|
+
const nextMigratedFiles = [
|
|
796
|
+
...migratedBosConfigs,
|
|
797
|
+
...migratedRootPackageJson ? ["package.json"] : [],
|
|
798
|
+
...await rewriteLegacyUiImports(projectDir),
|
|
799
|
+
...await rewriteLegacyPluginScopedLayerPatterns(projectDir),
|
|
800
|
+
...await rewriteLegacyDistImports(projectDir)
|
|
801
|
+
];
|
|
802
|
+
for (const file of OBSOLETE_FILES) {
|
|
803
|
+
const filePath = (0, node_path.join)(projectDir, file);
|
|
804
|
+
if ((0, node_fs.existsSync)(filePath)) {
|
|
805
|
+
(0, node_fs.rmSync)(filePath);
|
|
806
|
+
nextMigratedFiles.push(file);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
const legacyPluginDbFiles = await (0, glob.glob)("plugins/*/src/db/{migrator,load-migrations}.ts", {
|
|
810
|
+
cwd: projectDir,
|
|
811
|
+
nodir: true,
|
|
812
|
+
dot: false,
|
|
813
|
+
absolute: false
|
|
814
|
+
});
|
|
815
|
+
for (const file of legacyPluginDbFiles) {
|
|
816
|
+
(0, node_fs.rmSync)((0, node_path.join)(projectDir, file));
|
|
817
|
+
nextMigratedFiles.push(file);
|
|
818
|
+
}
|
|
819
|
+
return nextMigratedFiles;
|
|
820
|
+
});
|
|
821
|
+
let changelogUrl;
|
|
822
|
+
const mainPkg = parentSource.catalog["everything-dev"];
|
|
823
|
+
if (mainPkg) changelogUrl = buildChangelogUrl(void 0, mainPkg, parentSource.repository);
|
|
824
|
+
return {
|
|
825
|
+
status: "upgraded",
|
|
826
|
+
packages: [],
|
|
827
|
+
sync: syncResult,
|
|
828
|
+
migrated: migratedFiles.length > 0 ? migratedFiles : void 0,
|
|
829
|
+
selectedPlugins: addedPlugins.length > 0 ? addedPlugins : void 0,
|
|
830
|
+
timings,
|
|
831
|
+
changelogUrl
|
|
832
|
+
};
|
|
833
|
+
}
|
|
778
834
|
async function upgradeTemplate(projectDir, options) {
|
|
779
835
|
const timings = [];
|
|
780
836
|
if (!(0, node_fs.existsSync)((0, node_path.join)(projectDir, "package.json"))) return {
|
|
@@ -789,7 +845,7 @@ async function upgradeTemplate(projectDir, options) {
|
|
|
789
845
|
const currentCatalogEntries = readRootPackageJson(projectDir).workspaces?.catalog ?? {};
|
|
790
846
|
const workspacePkgPaths = await findWorkspacePackageJsons(projectDir);
|
|
791
847
|
const hasCatalogRefRewrites = inheritedCatalogPackageNames.length > 0 && (packageObjectNeedsCatalogRefs(readRootPackageJson(projectDir), inheritedCatalogPackageNames) || workspacePkgPaths.some((pkgPath) => packageFileNeedsCatalogRefs(pkgPath, inheritedCatalogPackageNames)));
|
|
792
|
-
const hasAuthCoreRefRewrites = packageObjectNeedsAuthCoreCatalogRef(readRootPackageJson(projectDir)) || workspacePkgPaths.some((pkgPath) => packageObjectNeedsAuthCoreCatalogRef(readJsonFile(pkgPath)));
|
|
848
|
+
const hasAuthCoreRefRewrites = packageObjectNeedsAuthCoreCatalogRef(readRootPackageJson(projectDir)) || workspacePkgPaths.some((pkgPath) => packageObjectNeedsAuthCoreCatalogRef(require_helpers.readJsonFile(pkgPath)));
|
|
793
849
|
const { packages, catalogVersionUpdates } = await require_timing.timePhase(timings, "check package versions", async () => {
|
|
794
850
|
const nextPackages = [];
|
|
795
851
|
for (const name of FRAMEWORK_PACKAGES) {
|
|
@@ -839,79 +895,81 @@ async function upgradeTemplate(projectDir, options) {
|
|
|
839
895
|
changelogUrl
|
|
840
896
|
};
|
|
841
897
|
}
|
|
898
|
+
if (options.migrationsOnly) return await runMigrationPhase(projectDir, options, parentSource);
|
|
842
899
|
await require_timing.timePhase(timings, "apply package updates", async () => {
|
|
843
900
|
if (inheritedCatalogPackageNames.length > 0) syncRootCatalogWithParent(projectDir, sourceRootCatalog);
|
|
844
901
|
if (inheritedCatalogPackageNames.length > 0) for (const pkgPath of workspacePkgPaths) updatePackageFileCatalogRefs(pkgPath, inheritedCatalogPackageNames);
|
|
845
902
|
});
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
dryRun: false,
|
|
857
|
-
noInstall: true
|
|
858
|
-
}));
|
|
859
|
-
if (inheritedCatalogPackageNames.length > 0) syncRootCatalogWithParent(projectDir, sourceRootCatalog);
|
|
860
|
-
}
|
|
861
|
-
const sharedSync = await require_timing.timePhase(timings, "sync shared deps", async () => {
|
|
862
|
-
const configResult = await require_config.loadResolvedConfig({ cwd: projectDir });
|
|
863
|
-
if (!configResult) throw new Error("No bos.config.json found in current directory");
|
|
864
|
-
return require_shared_deps.syncResolvedSharedDeps({
|
|
865
|
-
configDir: projectDir,
|
|
866
|
-
hostMode: "local",
|
|
867
|
-
bosConfig: configResult.config
|
|
868
|
-
});
|
|
869
|
-
});
|
|
870
|
-
if ((hasUpdates || addedPlugins.length > 0 || sharedSync.catalogChanged) && !options.noInstall) {
|
|
871
|
-
await require_timing.timePhase(timings, "install dependencies", () => require_cli_init.runBunInstallForUpgrade(projectDir));
|
|
872
|
-
await require_timing.timePhase(timings, "generate types", () => require_cli_init.runTypesGen(projectDir));
|
|
873
|
-
}
|
|
874
|
-
const migratedFiles = await require_timing.timePhase(timings, "clean obsolete files", async () => {
|
|
875
|
-
const nextMigratedFiles = [
|
|
876
|
-
...migratedBosConfigs,
|
|
877
|
-
...migratedRootPackageJson ? ["package.json"] : [],
|
|
878
|
-
...await rewriteLegacyUiImports(projectDir),
|
|
879
|
-
...await rewriteLegacyPluginScopedLayerPatterns(projectDir),
|
|
880
|
-
...await rewriteLegacyDistImports(projectDir)
|
|
881
|
-
];
|
|
882
|
-
for (const file of OBSOLETE_FILES) {
|
|
883
|
-
const filePath = (0, node_path.join)(projectDir, file);
|
|
884
|
-
if ((0, node_fs.existsSync)(filePath)) {
|
|
885
|
-
(0, node_fs.rmSync)(filePath);
|
|
886
|
-
nextMigratedFiles.push(file);
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
const legacyPluginDbFiles = await (0, glob.glob)("plugins/*/src/db/{migrator,load-migrations}.ts", {
|
|
903
|
+
const needsInstall = (hasUpdates || hasCatalogUpdates) && !options.noInstall;
|
|
904
|
+
if (needsInstall) await require_timing.timePhase(timings, "install dependencies", () => require_cli_init.runBunInstallForUpgrade(projectDir));
|
|
905
|
+
if (needsInstall && hasFrameworkUpdates) {
|
|
906
|
+
const childResult = (0, node_child_process.spawnSync)((0, node_path.join)(projectDir, "node_modules", ".bin", "bos"), [
|
|
907
|
+
"upgrade",
|
|
908
|
+
"--migrations-only",
|
|
909
|
+
"--no-install",
|
|
910
|
+
...options.noSync ? ["--no-sync"] : [],
|
|
911
|
+
"--json"
|
|
912
|
+
], {
|
|
890
913
|
cwd: projectDir,
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
914
|
+
stdio: [
|
|
915
|
+
"inherit",
|
|
916
|
+
"pipe",
|
|
917
|
+
"pipe"
|
|
918
|
+
],
|
|
919
|
+
encoding: "utf-8",
|
|
920
|
+
env: {
|
|
921
|
+
...node_process.default.env,
|
|
922
|
+
BOS_NO_BANNER: "1"
|
|
923
|
+
}
|
|
894
924
|
});
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
925
|
+
if (childResult.status !== 0) return {
|
|
926
|
+
status: "error",
|
|
927
|
+
packages: [...packages, ...catalogVersionUpdates.map((u) => ({
|
|
928
|
+
name: u.name,
|
|
929
|
+
from: u.from,
|
|
930
|
+
to: u.to
|
|
931
|
+
}))],
|
|
932
|
+
timings,
|
|
933
|
+
error: `Migration phase failed: ${childResult.stderr || childResult.stdout || "Unknown error"}`
|
|
934
|
+
};
|
|
935
|
+
try {
|
|
936
|
+
const childUpgrade = JSON.parse(childResult.stdout);
|
|
937
|
+
const mainPkg = packages.find((p) => p.name === "everything-dev");
|
|
938
|
+
const changelogUrl = mainPkg?.from && mainPkg.from !== mainPkg.to ? buildChangelogUrl(mainPkg.from, mainPkg.to, parentSource.repository) : void 0;
|
|
939
|
+
return {
|
|
940
|
+
...childUpgrade,
|
|
941
|
+
packages: [...packages, ...catalogVersionUpdates.map((u) => ({
|
|
942
|
+
name: u.name,
|
|
943
|
+
from: u.from,
|
|
944
|
+
to: u.to
|
|
945
|
+
}))],
|
|
946
|
+
timings: [...timings, ...childUpgrade.timings ?? []],
|
|
947
|
+
changelogUrl
|
|
948
|
+
};
|
|
949
|
+
} catch {
|
|
950
|
+
return {
|
|
951
|
+
status: "error",
|
|
952
|
+
packages: [...packages, ...catalogVersionUpdates.map((u) => ({
|
|
953
|
+
name: u.name,
|
|
954
|
+
from: u.from,
|
|
955
|
+
to: u.to
|
|
956
|
+
}))],
|
|
957
|
+
timings,
|
|
958
|
+
error: "Failed to parse migration phase output"
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
const migrationResult = await runMigrationPhase(projectDir, options, parentSource);
|
|
902
963
|
const mainPkg = packages.find((p) => p.name === "everything-dev");
|
|
903
|
-
|
|
964
|
+
const changelogUrl = mainPkg?.from && mainPkg.from !== mainPkg.to ? buildChangelogUrl(mainPkg.from, mainPkg.to, parentSource.repository) : void 0;
|
|
904
965
|
return {
|
|
905
|
-
|
|
966
|
+
...migrationResult,
|
|
906
967
|
packages: [...packages, ...catalogVersionUpdates.map((u) => ({
|
|
907
968
|
name: u.name,
|
|
908
969
|
from: u.from,
|
|
909
970
|
to: u.to
|
|
910
971
|
}))],
|
|
911
|
-
|
|
912
|
-
migrated: migratedFiles.length > 0 ? migratedFiles : void 0,
|
|
913
|
-
selectedPlugins: addedPlugins.length > 0 ? addedPlugins : void 0,
|
|
914
|
-
timings,
|
|
972
|
+
timings: [...timings, ...migrationResult.timings ?? []],
|
|
915
973
|
changelogUrl
|
|
916
974
|
};
|
|
917
975
|
}
|