@unisphere/nx 1.21.2 → 1.22.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/migrations/1-22-0/check-nx-version.d.ts.map +1 -0
- package/dist/migrations/1-22-0/fix-dependency-versions.d.ts.map +1 -0
- package/dist/migrations/{update-1-1-5/update-nvmrc.d.ts → 1-22-0/replace-npmrc.d.ts} +1 -1
- package/dist/migrations/1-22-0/replace-npmrc.d.ts.map +1 -0
- package/dist/migrations/1-22-0/replace-npmrc.js +27 -0
- package/dist/migrations/{update-1-1-5/fix-playground-apps.d.ts → 1-22-0/replace-patches.d.ts} +1 -1
- package/dist/migrations/1-22-0/replace-patches.d.ts.map +1 -0
- package/dist/migrations/1-22-0/replace-patches.js +42 -0
- package/dist/migrations/1-22-0/summary.d.ts +2 -0
- package/dist/migrations/1-22-0/summary.d.ts.map +1 -0
- package/dist/migrations/1-22-0/summary.js +12 -0
- package/dist/migrations/1-22-0/templates/.npmrc.template +5 -0
- package/dist/migrations/{update-1-1-5 → 1-22-0}/templates/_publish-artifacts.template +76 -44
- package/dist/migrations/{update-1-1-5 → 1-22-0}/templates/cicd.template +28 -14
- package/dist/migrations/1-22-0/templates/patches/@changesets+cli+2.29.7.patch +56 -0
- package/dist/migrations/1-22-0/templates/patches/@nx+rollup+22.1.3.patch +27 -0
- package/dist/migrations/1-22-0/update-github-workflow.d.ts.map +1 -0
- package/dist/migrations/{update-1-1-5 → 1-22-0}/update-github-workflow.js +8 -6
- package/dist/migrations.json +45 -124
- package/generators.json +1 -27
- package/migrations.json +45 -124
- package/package.json +1 -1
- package/dist/generators/unisphere-migrate/generator.d.ts +0 -15
- package/dist/generators/unisphere-migrate/generator.d.ts.map +0 -1
- package/dist/generators/unisphere-migrate/generator.js +0 -169
- package/dist/generators/unisphere-migrate/run-locally.md +0 -21
- package/dist/generators/unisphere-migrate/schema.json +0 -10
- package/dist/generators/unisphere-migrate/upgrade-guide.md +0 -108
- package/dist/migrations/update-1-1-5/_update-languages.d.ts +0 -3
- package/dist/migrations/update-1-1-5/_update-languages.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/_update-languages.js +0 -130
- package/dist/migrations/update-1-1-5/check-nx-version.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/fix-dependency-versions.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/fix-playground-apps.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/fix-playground-apps.js +0 -86
- package/dist/migrations/update-1-1-5/move-runtime-info-to-core.d.ts +0 -3
- package/dist/migrations/update-1-1-5/move-runtime-info-to-core.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/move-runtime-info-to-core.js +0 -217
- package/dist/migrations/update-1-1-5/rename-widgetname-to-widgetname.d.ts +0 -3
- package/dist/migrations/update-1-1-5/rename-widgetname-to-widgetname.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/rename-widgetname-to-widgetname.js +0 -38
- package/dist/migrations/update-1-1-5/sync-package-json-files.d.ts +0 -3
- package/dist/migrations/update-1-1-5/sync-package-json-files.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/sync-package-json-files.js +0 -68
- package/dist/migrations/update-1-1-5/update-github-workflow.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/update-npmrc.d.ts +0 -3
- package/dist/migrations/update-1-1-5/update-npmrc.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/update-npmrc.js +0 -48
- package/dist/migrations/update-1-1-5/update-nvmrc.d.ts.map +0 -1
- package/dist/migrations/update-1-1-5/update-nvmrc.js +0 -26
- /package/dist/migrations/{update-1-1-5 → 1-22-0}/check-nx-version.d.ts +0 -0
- /package/dist/migrations/{update-1-1-5 → 1-22-0}/check-nx-version.js +0 -0
- /package/dist/migrations/{update-1-1-5 → 1-22-0}/fix-dependency-versions.d.ts +0 -0
- /package/dist/migrations/{update-1-1-5 → 1-22-0}/fix-dependency-versions.js +0 -0
- /package/dist/migrations/{update-1-1-5 → 1-22-0}/update-github-workflow.d.ts +0 -0
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
// Ensure these are installed in your project: npm install ts-morph --save-dev
|
|
6
|
-
const ts_morph_1 = require("ts-morph");
|
|
7
|
-
const utils_1 = require("../../generators/utils");
|
|
8
|
-
/**
|
|
9
|
-
* Finds runtimes that have both runtime-information.ts and runtime-settings.ts files
|
|
10
|
-
* in their src/ or src/lib/ directory.
|
|
11
|
-
* @param tree The file system tree.
|
|
12
|
-
* @returns An array of RuntimeInfo objects.
|
|
13
|
-
*/
|
|
14
|
-
function findRuntimesWithInformationAndSettingsFiles(tree) {
|
|
15
|
-
const runtimes = new Map();
|
|
16
|
-
const runtimesDir = 'unisphere/runtimes';
|
|
17
|
-
// Only traverse the runtimes directory
|
|
18
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, runtimesDir, (filePath) => {
|
|
19
|
-
// Look for runtime-information.ts or runtime-settings.ts files in src/ or src/lib/
|
|
20
|
-
const runtimeMatch = filePath.match(/unisphere\/runtimes\/([^\/]+)\/src(?:\/lib)?\/(runtime-information|runtime-settings)\.ts$/);
|
|
21
|
-
if (runtimeMatch) {
|
|
22
|
-
const runtimeName = runtimeMatch[1];
|
|
23
|
-
const fileType = runtimeMatch[2];
|
|
24
|
-
if (!runtimes.has(runtimeName)) {
|
|
25
|
-
runtimes.set(runtimeName, {
|
|
26
|
-
name: runtimeName,
|
|
27
|
-
path: `unisphere/runtimes/${runtimeName}`,
|
|
28
|
-
hasInformation: false,
|
|
29
|
-
hasSettings: false,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
const runtime = runtimes.get(runtimeName);
|
|
33
|
-
if (fileType === 'runtime-information') {
|
|
34
|
-
runtime.hasInformation = true;
|
|
35
|
-
runtime.informationPath = filePath;
|
|
36
|
-
}
|
|
37
|
-
else if (fileType === 'runtime-settings') {
|
|
38
|
-
runtime.hasSettings = true;
|
|
39
|
-
runtime.settingsPath = filePath;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
let res = Array.from(runtimes.values()).filter((r) => r.hasInformation && r.hasSettings);
|
|
44
|
-
return res;
|
|
45
|
-
}
|
|
46
|
-
// ------------------------------------------------------------
|
|
47
|
-
async function update(tree) {
|
|
48
|
-
devkit_1.logger.info('🔄 Starting runtime info migration to core...');
|
|
49
|
-
const runtimes = findRuntimesWithInformationAndSettingsFiles(tree);
|
|
50
|
-
if (runtimes.length === 0) {
|
|
51
|
-
devkit_1.logger.info('ℹ️ No runtimes found with local runtime-information.ts or runtime-settings.ts files.');
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
devkit_1.logger.info(`📦 Found ${runtimes.length} runtime(s) to migrate`);
|
|
55
|
-
let migratedCount = 0;
|
|
56
|
-
// Initialize the ts-morph Project once
|
|
57
|
-
const project = new ts_morph_1.Project({
|
|
58
|
-
manipulationSettings: {
|
|
59
|
-
quoteKind: ts_morph_1.QuoteKind.Single,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
for (const runtime of runtimes) {
|
|
63
|
-
devkit_1.logger.info(`\n🔄 Migrating runtime: ${runtime.name}`);
|
|
64
|
-
const nameTransforms = (0, utils_1.createNameTransforms)(runtime.name, 'runtimeName');
|
|
65
|
-
const pascalName = nameTransforms['runtimeName__pascalCase'];
|
|
66
|
-
const dashName = nameTransforms['runtimeName__lowerDashCase'];
|
|
67
|
-
const camelName = nameTransforms['runtimeName__camelCase'];
|
|
68
|
-
const corePath = `unisphere/packages/core/src/lib/${runtime.name}-runtime`;
|
|
69
|
-
const runtimeTypesPath = `${corePath}/runtime-types.ts`;
|
|
70
|
-
const indexPath = `${corePath}/index.ts`;
|
|
71
|
-
// 1. Create core runtime-types.ts file
|
|
72
|
-
let settingsContentRaw = runtime.settingsPath && tree.exists(runtime.settingsPath)
|
|
73
|
-
? tree.read(runtime.settingsPath, 'utf-8') || ''
|
|
74
|
-
: '';
|
|
75
|
-
if (settingsContentRaw) {
|
|
76
|
-
// Rename types in the content to be globally unique
|
|
77
|
-
settingsContentRaw = settingsContentRaw.replace(/\bRuntimeSettings\b/g, `${pascalName}RuntimeSettings`);
|
|
78
|
-
settingsContentRaw = settingsContentRaw.replace(/\bruntimeSettingsSchema\b/g, `${camelName}RuntimeSettingsSchema`);
|
|
79
|
-
}
|
|
80
|
-
// Export the new RuntimeName
|
|
81
|
-
const runtimeTypesContent = `${settingsContentRaw}\n\nexport const ${pascalName}RuntimeName = '${dashName}' as const;`;
|
|
82
|
-
tree.write(runtimeTypesPath, runtimeTypesContent);
|
|
83
|
-
tree.write(indexPath, `export * from './runtime-types';\n`);
|
|
84
|
-
devkit_1.logger.info(` ✅ Created runtime types in ${corePath}`);
|
|
85
|
-
// 2. Update core index.ts to export the new runtime types
|
|
86
|
-
const coreIndexPath = 'unisphere/packages/core/src/index.ts';
|
|
87
|
-
if (tree.exists(coreIndexPath)) {
|
|
88
|
-
const coreIndexContent = tree.read(coreIndexPath, 'utf-8') || '';
|
|
89
|
-
const exportLine = `export * from './lib/${runtime.name}-runtime';`;
|
|
90
|
-
if (!coreIndexContent.includes(exportLine)) {
|
|
91
|
-
const updatedCoreIndex = coreIndexContent.trimEnd() + '\n' + exportLine + '\n';
|
|
92
|
-
tree.write(coreIndexPath, updatedCoreIndex);
|
|
93
|
-
devkit_1.logger.info(` 🔗 Updated core index exports`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
devkit_1.logger.error(` ⚠️ Core index.ts not found at ${coreIndexPath}`);
|
|
98
|
-
}
|
|
99
|
-
// 3. Update runtime.tsx to import from core alias and rename usages (using ts-morph)
|
|
100
|
-
const runtimeTsxPath = `${runtime.path}/src/lib/runtime.tsx`;
|
|
101
|
-
if (tree.exists(runtimeTsxPath)) {
|
|
102
|
-
try {
|
|
103
|
-
const coreAlias = (0, utils_1.findCorePackageAlias)(tree);
|
|
104
|
-
const runtimeTsxContent = tree.read(runtimeTsxPath, 'utf-8') || '';
|
|
105
|
-
// Create a temporary in-memory SourceFile for ts-morph to parse and modify
|
|
106
|
-
const sourceFile = project.createSourceFile(runtimeTsxPath, runtimeTsxContent, { overwrite: true });
|
|
107
|
-
// Define the new, standardized names
|
|
108
|
-
const newWidgetName = `WidgetName`;
|
|
109
|
-
const newRuntimeName = `${pascalName}RuntimeName`;
|
|
110
|
-
// Define all named imports we are responsible for consolidating/adding
|
|
111
|
-
const newNamedImports = [
|
|
112
|
-
`${pascalName}RuntimeSettings`,
|
|
113
|
-
`${camelName}RuntimeSettingsSchema`,
|
|
114
|
-
newRuntimeName,
|
|
115
|
-
newWidgetName,
|
|
116
|
-
];
|
|
117
|
-
// --- A. Remove old local imports ---
|
|
118
|
-
const localImportSpecifiers = [
|
|
119
|
-
'./runtime-information',
|
|
120
|
-
'./runtime-settings',
|
|
121
|
-
'../runtime-information',
|
|
122
|
-
'../runtime-settings',
|
|
123
|
-
];
|
|
124
|
-
sourceFile.getImportDeclarations().forEach(importDeclaration => {
|
|
125
|
-
const moduleSpecifier = importDeclaration.getModuleSpecifierValue().replace(/\.ts$/, '');
|
|
126
|
-
if (localImportSpecifiers.includes(moduleSpecifier)) {
|
|
127
|
-
importDeclaration.remove();
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
// --- B. Rename usages of old identifiers to new, unique names ---
|
|
131
|
-
const identifierRenames = new Map([
|
|
132
|
-
// Base types/schemas
|
|
133
|
-
['RuntimeSettings', `${pascalName}RuntimeSettings`],
|
|
134
|
-
['runtimeSettingsSchema', `${camelName}RuntimeSettingsSchema`],
|
|
135
|
-
// Constants (Original -> New Core Name)
|
|
136
|
-
['unisphereWidgetName', newWidgetName],
|
|
137
|
-
['unisphereRuntimeName', newRuntimeName],
|
|
138
|
-
]);
|
|
139
|
-
// This loop performs the renaming in the file
|
|
140
|
-
sourceFile.forEachDescendant(node => {
|
|
141
|
-
if (node.isKind(ts_morph_1.SyntaxKind.Identifier)) {
|
|
142
|
-
const nodeText = node.getText();
|
|
143
|
-
const newText = identifierRenames.get(nodeText);
|
|
144
|
-
if (newText) {
|
|
145
|
-
node.replaceWithText(newText);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
// --- C. Add new core imports (SAFELY) ---
|
|
150
|
-
let coreImportDeclaration = sourceFile.getImportDeclaration((decl) => decl.getModuleSpecifierValue() === coreAlias);
|
|
151
|
-
// 1. Remove ONLY the specific named imports we are consolidating from any existing core imports
|
|
152
|
-
sourceFile.getImportDeclarations().forEach(importDeclaration => {
|
|
153
|
-
const specifier = importDeclaration.getModuleSpecifierValue();
|
|
154
|
-
// If it's the root core alias, remove only the named imports that we will re-add.
|
|
155
|
-
if (specifier === coreAlias) {
|
|
156
|
-
importDeclaration.getNamedImports().forEach(namedImport => {
|
|
157
|
-
const importName = namedImport.getName();
|
|
158
|
-
if (newNamedImports.includes(importName)) {
|
|
159
|
-
namedImport.remove();
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
// If the declaration is now empty, remove it completely.
|
|
163
|
-
if (importDeclaration.getNamedImports().length === 0 && !importDeclaration.getDefaultImport()) {
|
|
164
|
-
importDeclaration.remove();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
// 2. Add the new combined import for runtime types and names
|
|
169
|
-
// If the core import line was removed, we need to recreate it.
|
|
170
|
-
coreImportDeclaration = sourceFile.getImportDeclaration((decl) => decl.getModuleSpecifierValue() === coreAlias);
|
|
171
|
-
if (!coreImportDeclaration) {
|
|
172
|
-
// If it doesn't exist (i.e., was just deleted or never existed), add a new one.
|
|
173
|
-
sourceFile.addImportDeclaration({
|
|
174
|
-
moduleSpecifier: `${coreAlias}`,
|
|
175
|
-
namedImports: newNamedImports,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
// If it still exists (meaning it had other imports), just add the new ones to the existing declaration.
|
|
180
|
-
coreImportDeclaration.addNamedImports(newNamedImports);
|
|
181
|
-
}
|
|
182
|
-
// --- D. Write content back to the Tree ---
|
|
183
|
-
// Ensure the tree.write gets the updated text after all replacements
|
|
184
|
-
tree.write(runtimeTsxPath, sourceFile.getFullText());
|
|
185
|
-
devkit_1.logger.info(` 🔁 Updated imports, runtime, and widget usages using ts-morph in ${runtimeTsxPath}`);
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
devkit_1.logger.error(` ❌ Failed to update ${runtimeTsxPath} with ts-morph: ${error}`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
devkit_1.logger.warn(` ⚠️ Runtime file not found at ${runtimeTsxPath}`);
|
|
193
|
-
}
|
|
194
|
-
// 4. Delete old files
|
|
195
|
-
if (runtime.informationPath && tree.exists(runtime.informationPath)) {
|
|
196
|
-
tree.delete(runtime.informationPath);
|
|
197
|
-
devkit_1.logger.info(` 🗑️ Deleted ${runtime.informationPath}`);
|
|
198
|
-
}
|
|
199
|
-
if (runtime.settingsPath && tree.exists(runtime.settingsPath)) {
|
|
200
|
-
tree.delete(runtime.settingsPath);
|
|
201
|
-
devkit_1.logger.info(` 🗑️ Deleted ${runtime.settingsPath}`);
|
|
202
|
-
}
|
|
203
|
-
migratedCount++;
|
|
204
|
-
devkit_1.logger.info(` ✅ Successfully migrated ${runtime.name}`);
|
|
205
|
-
}
|
|
206
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
207
|
-
devkit_1.logger.info('');
|
|
208
|
-
devkit_1.logger.warn('═══════════════════════════════════════════════════════════════');
|
|
209
|
-
devkit_1.logger.warn(`✅ Migrated ${migratedCount} runtime(s) to use core package!`);
|
|
210
|
-
devkit_1.logger.warn('═══════════════════════════════════════════════════════════════');
|
|
211
|
-
devkit_1.logger.warn('');
|
|
212
|
-
devkit_1.logger.warn('⚠️ Summary of changes:');
|
|
213
|
-
devkit_1.logger.warn(' • Runtime settings/information types were moved to core and renamed.');
|
|
214
|
-
devkit_1.logger.warn(' • **unisphereWidgetName was renamed to WidgetName, imported from core, and usages were fixed.**');
|
|
215
|
-
devkit_1.logger.warn('');
|
|
216
|
-
devkit_1.logger.warn('═══════════════════════════════════════════════════════════════');
|
|
217
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rename-widgetname-to-widgetname.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-1-1-5/rename-widgetname-to-widgetname.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAIL,MAAM,YAAY,CAAC;AAEpB,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,iBAwC9C"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function update(tree) {
|
|
6
|
-
devkit_1.logger.info('🔄 Starting WidgetName to widgetName migration...');
|
|
7
|
-
let filesUpdated = 0;
|
|
8
|
-
// Update TypeScript and TSX files in the workspace
|
|
9
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
|
|
10
|
-
// Only process TypeScript and TSX files in unisphere directories
|
|
11
|
-
if ((!filePath.endsWith('.ts') && !filePath.endsWith('.tsx')) ||
|
|
12
|
-
!filePath.includes('unisphere/')) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const content = tree.read(filePath, 'utf-8');
|
|
16
|
-
if (!content)
|
|
17
|
-
return;
|
|
18
|
-
let hasChanges = false;
|
|
19
|
-
let updatedContent = content;
|
|
20
|
-
// Simple global replacement: WidgetName -> widgetName
|
|
21
|
-
if (content.includes('WidgetName')) {
|
|
22
|
-
updatedContent = updatedContent.replace(/WidgetName/g, 'widgetName');
|
|
23
|
-
hasChanges = true;
|
|
24
|
-
}
|
|
25
|
-
if (hasChanges) {
|
|
26
|
-
tree.write(filePath, updatedContent);
|
|
27
|
-
filesUpdated++;
|
|
28
|
-
devkit_1.logger.info(`✅ Updated WidgetName references in ${filePath}`);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
if (filesUpdated > 0) {
|
|
32
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
33
|
-
devkit_1.logger.info(`✅ WidgetName to widgetName migration completed. Updated ${filesUpdated} files.`);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
devkit_1.logger.info('ℹ️ No WidgetName references found to migrate.');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-package-json-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-1-1-5/sync-package-json-files.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EAIL,MAAM,YAAY,CAAC;AAEtB,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC,CAsEzE"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function update(tree) {
|
|
6
|
-
devkit_1.logger.info('🔄 Sync package json files deps...');
|
|
7
|
-
let filesUpdated = 0;
|
|
8
|
-
// Read the root package.json to get the target versions
|
|
9
|
-
const rootPackageJson = tree.read('package.json', 'utf-8');
|
|
10
|
-
if (!rootPackageJson) {
|
|
11
|
-
devkit_1.logger.error('❌ Could not read root package.json');
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const rootPackage = JSON.parse(rootPackageJson);
|
|
15
|
-
const targetVersions = {
|
|
16
|
-
...rootPackage.dependencies,
|
|
17
|
-
...rootPackage.devDependencies
|
|
18
|
-
};
|
|
19
|
-
devkit_1.logger.info(`📦 Found ${Object.keys(targetVersions).length} dependencies to sync`);
|
|
20
|
-
// Find all package.json files in packages directory
|
|
21
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
|
|
22
|
-
if (filePath.endsWith('package.json')) {
|
|
23
|
-
const content = tree.read(filePath, 'utf-8');
|
|
24
|
-
if (content) {
|
|
25
|
-
try {
|
|
26
|
-
const packageJson = JSON.parse(content);
|
|
27
|
-
let hasChanges = false;
|
|
28
|
-
// Sync dependencies
|
|
29
|
-
if (packageJson.dependencies) {
|
|
30
|
-
for (const [depName, currentVersion] of Object.entries(packageJson.dependencies)) {
|
|
31
|
-
if (targetVersions[depName] && currentVersion !== targetVersions[depName]) {
|
|
32
|
-
devkit_1.logger.info(`🔄 Updating ${depName} from ${currentVersion} to ${targetVersions[depName]} in ${filePath}`);
|
|
33
|
-
packageJson.dependencies[depName] = targetVersions[depName];
|
|
34
|
-
hasChanges = true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// Sync devDependencies
|
|
39
|
-
if (packageJson.devDependencies) {
|
|
40
|
-
for (const [depName, currentVersion] of Object.entries(packageJson.devDependencies)) {
|
|
41
|
-
if (targetVersions[depName] && currentVersion !== targetVersions[depName]) {
|
|
42
|
-
devkit_1.logger.info(`🔄 Updating ${depName} from ${currentVersion} to ${targetVersions[depName]} in ${filePath}`);
|
|
43
|
-
packageJson.devDependencies[depName] = targetVersions[depName];
|
|
44
|
-
hasChanges = true;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (hasChanges) {
|
|
49
|
-
// Write the updated package.json back
|
|
50
|
-
const updatedContent = JSON.stringify(packageJson, null, 2) + '\n';
|
|
51
|
-
tree.write(filePath, updatedContent);
|
|
52
|
-
filesUpdated++;
|
|
53
|
-
devkit_1.logger.info(`✅ Updated ${filePath}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
devkit_1.logger.error(`❌ Error parsing ${filePath}: ${error}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
if (filesUpdated > 0) {
|
|
63
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
devkit_1.logger.info('ℹ️ No package.json files needed updating.');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-github-workflow.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-1-1-5/update-github-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAI1C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-npmrc.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-1-1-5/update-npmrc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA6C,MAAM,YAAY,CAAC;AAE7E,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC,CAgDzE"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function update(tree) {
|
|
6
|
-
devkit_1.logger.info('🔄 Checking .npmrc for legacy-peer-deps=true...');
|
|
7
|
-
let filesScanned = 0;
|
|
8
|
-
let filesUpdated = 0;
|
|
9
|
-
const updateContent = (content) => {
|
|
10
|
-
const re = /(\blegacy-peer-deps\b\s*=\s*)true(\b|\s*)/gi;
|
|
11
|
-
if (re.test(content)) {
|
|
12
|
-
// Replace only the value while preserving whitespace and formatting
|
|
13
|
-
const replaced = content.replace(re, '$1false$2');
|
|
14
|
-
return replaced;
|
|
15
|
-
}
|
|
16
|
-
return null;
|
|
17
|
-
};
|
|
18
|
-
// Prefer root .npmrc, but scan workspace to be safe
|
|
19
|
-
const tryUpdateFile = (filePath) => {
|
|
20
|
-
const content = tree.read(filePath, 'utf-8');
|
|
21
|
-
if (!content)
|
|
22
|
-
return;
|
|
23
|
-
filesScanned++;
|
|
24
|
-
const updated = updateContent(content);
|
|
25
|
-
if (updated && updated !== content) {
|
|
26
|
-
tree.write(filePath, updated);
|
|
27
|
-
filesUpdated++;
|
|
28
|
-
devkit_1.logger.info(`✅ Updated ${filePath}: legacy-peer-deps=false`);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
if (tree.exists('.npmrc')) {
|
|
32
|
-
tryUpdateFile('.npmrc');
|
|
33
|
-
}
|
|
34
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, '.', (p) => {
|
|
35
|
-
if (p.endsWith('/.npmrc') || p === '.npmrc') {
|
|
36
|
-
if (p !== '.npmrc') {
|
|
37
|
-
tryUpdateFile(p);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
42
|
-
if (filesUpdated === 0) {
|
|
43
|
-
devkit_1.logger.info('ℹ️ No .npmrc files required changes.');
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
devkit_1.logger.warn(`✅ Updated ${filesUpdated} .npmrc file(s).`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-nvmrc.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-1-1-5/update-nvmrc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAuB,MAAM,YAAY,CAAC;AAEvD,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B9D"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function update(tree) {
|
|
6
|
-
devkit_1.logger.info('🔄 Updating .nvmrc to Node 24...');
|
|
7
|
-
const nvmrcPath = '.nvmrc';
|
|
8
|
-
const targetNodeVersion = '24';
|
|
9
|
-
if (tree.exists(nvmrcPath)) {
|
|
10
|
-
const currentContent = tree.read(nvmrcPath, 'utf-8');
|
|
11
|
-
if (currentContent) {
|
|
12
|
-
const currentVersion = currentContent.trim();
|
|
13
|
-
if (currentVersion === targetNodeVersion) {
|
|
14
|
-
devkit_1.logger.info('ℹ️ .nvmrc already set to Node 24.');
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
tree.write(nvmrcPath, targetNodeVersion);
|
|
18
|
-
devkit_1.logger.info(`✅ Updated .nvmrc from ${currentVersion} to ${targetNodeVersion}`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
tree.write(nvmrcPath, targetNodeVersion);
|
|
23
|
-
devkit_1.logger.info(`✅ Created .nvmrc with Node ${targetNodeVersion}`);
|
|
24
|
-
}
|
|
25
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
26
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|