@unisphere/nx 1.9.0 → 1.11.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.
@@ -0,0 +1,15 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ * Unisphere Migrate Generator
4
+ *
5
+ * This generator runs all migrations manually from migrations.json.
6
+ * Use this to force-run migrations locally or when nx migrate isn't detecting them.
7
+ *
8
+ * Usage:
9
+ * npx nx g @unisphere/nx:unisphere-migrate
10
+ *
11
+ * Or with local path:
12
+ * npx nx g /path/to/packages/nx:unisphere-migrate
13
+ */
14
+ export default function unisphereManualMigrate(tree: Tree): Promise<void>;
15
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/unisphere-migrate/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmC,MAAM,YAAY,CAAC;AAKnE;;;;;;;;;;;GAWG;AACH,wBAA8B,sBAAsB,CAAC,IAAI,EAAE,IAAI,iBA6K9D"}
@@ -1,27 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = testMigrationLocally;
3
+ exports.default = unisphereManualMigrate;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const fs_1 = require("fs");
6
6
  const path_1 = require("path");
7
+ const child_process_1 = require("child_process");
7
8
  /**
8
- * Test Migration Locally Generator
9
+ * Unisphere Migrate Generator
9
10
  *
10
- * This generator mimics the full `nx migrate` flow for local testing.
11
- * It reads migrations.json and executes everything in the correct order,
12
- * including showing post-upgrade messages.
11
+ * This generator runs all migrations manually from migrations.json.
12
+ * Use this to force-run migrations locally or when nx migrate isn't detecting them.
13
13
  *
14
14
  * Usage:
15
- * npx nx g @unisphere/nx:test-migration-locally
15
+ * npx nx g @unisphere/nx:unisphere-migrate
16
16
  *
17
17
  * Or with local path:
18
- * npx nx g ./packages/nx:test-migration-locally
18
+ * npx nx g /path/to/packages/nx:unisphere-migrate
19
19
  */
20
- async function testMigrationLocally(tree) {
20
+ async function unisphereManualMigrate(tree) {
21
21
  devkit_1.logger.info('');
22
- devkit_1.logger.info('🧪 TESTING MIGRATIONS LOCALLY');
22
+ devkit_1.logger.info('🔄 RUNNING UNISPHERE MIGRATIONS MANUALLY');
23
23
  devkit_1.logger.info('='.repeat(70));
24
- devkit_1.logger.info('This simulates the full `nx migrate` flow for testing purposes.');
24
+ devkit_1.logger.info('This runs all migrations from migrations.json.');
25
25
  devkit_1.logger.info('='.repeat(70));
26
26
  devkit_1.logger.info('');
27
27
  try {
@@ -29,7 +29,7 @@ async function testMigrationLocally(tree) {
29
29
  const migrationsJsonPath = (0, path_1.join)(__dirname, '../../../migrations.json');
30
30
  const migrationsJson = JSON.parse((0, fs_1.readFileSync)(migrationsJsonPath, 'utf-8'));
31
31
  const migrations = migrationsJson.migrations;
32
- const packageUpdates = migrationsJson.packageJsonUpdates?.['1.1.5'];
32
+ const packageUpdates = migrationsJson.packageJsonUpdates?.['1.9.0'];
33
33
  // Show what will be run
34
34
  devkit_1.logger.info(`📋 Migrations to run: ${Object.keys(migrations).length}`);
35
35
  Object.entries(migrations).forEach(([name, config]) => {
@@ -50,11 +50,13 @@ async function testMigrationLocally(tree) {
50
50
  try {
51
51
  // Construct the migration path
52
52
  const migrationPath = migrationConfig.implementation
53
- .replace('./dist/migrations/', '../../migrations/')
54
- .replace(/\.js$/, '');
53
+ .replace('./dist/migrations/', '../../migrations/');
55
54
  // Import and run the migration
56
- const migrationModule = await import(migrationPath);
57
- const migrationFn = migrationModule.default;
55
+ // Using eval to bypass TypeScript restrictions on require in ESM
56
+ const absolutePath = (0, path_1.join)(__dirname, migrationPath);
57
+ const requireFn = eval('require');
58
+ const migrationModule = requireFn(absolutePath);
59
+ const migrationFn = migrationModule.default || migrationModule;
58
60
  if (typeof migrationFn !== 'function') {
59
61
  throw new Error(`Migration ${migrationName} does not export a default function`);
60
62
  }
@@ -76,9 +78,64 @@ async function testMigrationLocally(tree) {
76
78
  throw error;
77
79
  }
78
80
  }
79
- // Step 2: Format files
81
+ // Step 2: Apply package.json updates
82
+ if (packageUpdates?.packages && Object.keys(packageUpdates.packages).length > 0) {
83
+ devkit_1.logger.info('');
84
+ devkit_1.logger.info('='.repeat(70));
85
+ devkit_1.logger.info('📦 APPLYING PACKAGE UPDATES');
86
+ devkit_1.logger.info('='.repeat(70));
87
+ devkit_1.logger.info('');
88
+ // Resolve "latest" versions to actual version with ^
89
+ const resolvedVersions = {};
90
+ const packagesToResolve = Object.entries(packageUpdates.packages)
91
+ .filter(([, config]) => config.version === 'latest')
92
+ .map(([pkgName]) => pkgName);
93
+ if (packagesToResolve.length > 0) {
94
+ devkit_1.logger.info('🔍 Resolving "latest" versions...');
95
+ for (const pkgName of packagesToResolve) {
96
+ try {
97
+ const result = (0, child_process_1.execSync)(`npm view ${pkgName} version`, { encoding: 'utf-8' });
98
+ const latestVersion = result.trim();
99
+ resolvedVersions[pkgName] = `^${latestVersion}`;
100
+ devkit_1.logger.info(` • ${pkgName}: latest → ^${latestVersion}`);
101
+ }
102
+ catch (error) {
103
+ devkit_1.logger.warn(` ⚠️ Could not resolve latest version for ${pkgName}, keeping "latest"`);
104
+ resolvedVersions[pkgName] = 'latest';
105
+ }
106
+ }
107
+ devkit_1.logger.info('');
108
+ }
109
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
110
+ const deps = json.dependencies || {};
111
+ const devDeps = json.devDependencies || {};
112
+ Object.entries(packageUpdates.packages).forEach(([pkgName, config]) => {
113
+ // Use resolved version for "latest", otherwise use as-is
114
+ const version = resolvedVersions[pkgName] || config.version;
115
+ const alwaysAdd = config.alwaysAddToPackageJson !== false;
116
+ if (deps[pkgName]) {
117
+ deps[pkgName] = version;
118
+ devkit_1.logger.info(` ✅ Updated ${pkgName} to ${version} (dependencies)`);
119
+ }
120
+ else if (devDeps[pkgName]) {
121
+ devDeps[pkgName] = version;
122
+ devkit_1.logger.info(` ✅ Updated ${pkgName} to ${version} (devDependencies)`);
123
+ }
124
+ else if (alwaysAdd) {
125
+ deps[pkgName] = version;
126
+ devkit_1.logger.info(` ➕ Added ${pkgName}@${version} (dependencies)`);
127
+ }
128
+ });
129
+ return json;
130
+ });
131
+ devkit_1.logger.info('');
132
+ devkit_1.logger.info('✅ Package updates applied');
133
+ devkit_1.logger.info('⚠️ Run "npm install" to install updated packages');
134
+ devkit_1.logger.info('');
135
+ }
136
+ // Step 3: Format files
80
137
  await (0, devkit_1.formatFiles)(tree);
81
- // Step 3: Show final summary message
138
+ // Step 4: Show final summary message
82
139
  devkit_1.logger.info('');
83
140
  devkit_1.logger.info('='.repeat(70));
84
141
  devkit_1.logger.info('✅ ALL MIGRATIONS COMPLETED');
@@ -0,0 +1,18 @@
1
+ ## Run Unisphere migrations manually
2
+
3
+ From the consumer project root:
4
+
5
+ ```bash
6
+ npx nx g @unisphere/nx:unisphere-migrate
7
+ ```
8
+
9
+ Or using the local path:
10
+
11
+ ```bash
12
+ npx nx g {path}/unisphere-nx-workspace-plugin/packages/nx:unisphere-migrate
13
+ ```
14
+
15
+ This will run ALL migrations defined in migrations.json manually.
16
+
17
+
18
+ npx nx g /home/tokomeno/kaltura/unisphere/pl/unisphere-nx-workspace-plugin/packages/nx:unisphere-migrate
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "cli": "nx",
4
+ "$id": "UnisphereMigrate",
5
+ "title": "Unisphere Manual Migrate",
6
+ "description": "Manually run all Unisphere migrations from migrations.json",
7
+ "type": "object",
8
+ "properties": {},
9
+ "required": []
10
+ }
@@ -23,11 +23,6 @@
23
23
  "description": "Moves runtime-information.ts and runtime-settings.ts to core package",
24
24
  "implementation": "./dist/migrations/update-1-1-5/move-runtime-info-to-core.js"
25
25
  },
26
- "update-npmrc": {
27
- "version": "1.9.0",
28
- "description": "Set legacy-peer-deps=false in .npmrc files",
29
- "implementation": "./dist/migrations/update-1-1-5/update-npmrc.js"
30
- },
31
26
  "sync-package-json-files": {
32
27
  "version": "1.9.0",
33
28
  "description": "Syncs package json files",
@@ -60,10 +55,18 @@
60
55
  },
61
56
  "packageJsonUpdates": {
62
57
  "1.9.0": {
63
- "version": "1.6.0",
58
+ "version": "1.9.0",
64
59
  "cli": "nx",
65
- "postUpdateMessage": "\n🎉 Migration to @unisphere/nx 1.1.5 completed successfully!\n\n📋 Summary of changes:\n • Upgraded to Nx 22\n • Updated Node.js to version 24 (.nvmrc)\n • Pinned @changesets/cli to exact version\n • Updated GitHub workflow to use Node 24\n • Updated all @unisphere and @kaltura packages\n • Upgraded to React 19\n\n⚠️ Important next steps:\n 1. Install dependencies: npm install\n 2. Ensure you have Node.js 24.x installed (check with: node --version)\n 3. Review and test your application\n 4. Commit the changes\n\nFor more information, visit: https://github.com/your-org/unisphere\n",
60
+ "postUpdateMessage": "\n🎉 Migration to @unisphere/nx 1.9.0 completed successfully!\n\n📋 Summary of changes:\n • Upgraded MUI to v7\n • Updated Node.js to version 24 (.nvmrc)\n • Updated all @unisphere and @kaltura packages\n • Upgraded to React 19\n\n⚠️ Important next steps:\n 1. Ensure you have Node.js 24.x and run nvm use\n 2. Remove node_modules and Install dependencies: npm install\n 3. Review and test your application\n 4. Commit the changes\n",
66
61
  "packages": {
62
+ "@mui/material": {
63
+ "version": "^7.3.1",
64
+ "alwaysAddToPackageJson": false
65
+ },
66
+ "@mui/icons-material": {
67
+ "version": "^7.3.1",
68
+ "alwaysAddToPackageJson": false
69
+ },
67
70
  "@kaltura/ds-react-bits": {
68
71
  "version": "latest",
69
72
  "alwaysAddToPackageJson": false
@@ -81,7 +84,7 @@
81
84
  "alwaysAddToPackageJson": false
82
85
  },
83
86
  "@unisphere/cli": {
84
- "version": "latest",
87
+ "version": "^1.54.0",
85
88
  "alwaysAddToPackageJson": false
86
89
  },
87
90
  "@unisphere/core": {
package/generators.json CHANGED
@@ -20,16 +20,11 @@
20
20
  "schema": "./dist/generators/add-visual/schema.json",
21
21
  "description": "add-visual generator"
22
22
  },
23
- "migrate-to-1-1-5": {
24
- "factory": "./dist/generators/migrate-to-1-1-5/migrate-to-1-1-5",
25
- "schema": "./dist/generators/migrate-to-1-1-5/schema.json",
26
- "description": "Migrates your project to @unisphere/nx v1.1.5 with package updates, WidgetName renaming, and React 19 preparation"
27
- },
28
- "test-migration-locally": {
29
- "factory": "./dist/generators/test-migration-locally/generator",
30
- "schema": "./dist/generators/test-migration-locally/schema.json",
31
- "description": "Test migrations locally (mimics nx migrate flow with post-upgrade messages)",
32
- "hidden": true
23
+ "unisphere-migrate": {
24
+ "factory": "./dist/generators/unisphere-migrate/generator",
25
+ "schema": "./dist/generators/unisphere-migrate/schema.json",
26
+ "description": "Manually run all Unisphere migrations from migrations.json",
27
+ "hidden": false
33
28
  }
34
29
  }
35
30
  }
package/migrations.json CHANGED
@@ -23,11 +23,6 @@
23
23
  "description": "Moves runtime-information.ts and runtime-settings.ts to core package",
24
24
  "implementation": "./dist/migrations/update-1-1-5/move-runtime-info-to-core.js"
25
25
  },
26
- "update-npmrc": {
27
- "version": "1.9.0",
28
- "description": "Set legacy-peer-deps=false in .npmrc files",
29
- "implementation": "./dist/migrations/update-1-1-5/update-npmrc.js"
30
- },
31
26
  "sync-package-json-files": {
32
27
  "version": "1.9.0",
33
28
  "description": "Syncs package json files",
@@ -60,10 +55,18 @@
60
55
  },
61
56
  "packageJsonUpdates": {
62
57
  "1.9.0": {
63
- "version": "1.6.0",
58
+ "version": "1.9.0",
64
59
  "cli": "nx",
65
- "postUpdateMessage": "\n🎉 Migration to @unisphere/nx 1.1.5 completed successfully!\n\n📋 Summary of changes:\n • Upgraded to Nx 22\n • Updated Node.js to version 24 (.nvmrc)\n • Pinned @changesets/cli to exact version\n • Updated GitHub workflow to use Node 24\n • Updated all @unisphere and @kaltura packages\n • Upgraded to React 19\n\n⚠️ Important next steps:\n 1. Install dependencies: npm install\n 2. Ensure you have Node.js 24.x installed (check with: node --version)\n 3. Review and test your application\n 4. Commit the changes\n\nFor more information, visit: https://github.com/your-org/unisphere\n",
60
+ "postUpdateMessage": "\n🎉 Migration to @unisphere/nx 1.9.0 completed successfully!\n\n📋 Summary of changes:\n • Upgraded MUI to v7\n • Updated Node.js to version 24 (.nvmrc)\n • Updated all @unisphere and @kaltura packages\n • Upgraded to React 19\n\n⚠️ Important next steps:\n 1. Ensure you have Node.js 24.x and run nvm use\n 2. Remove node_modules and Install dependencies: npm install\n 3. Review and test your application\n 4. Commit the changes\n",
66
61
  "packages": {
62
+ "@mui/material": {
63
+ "version": "^7.3.1",
64
+ "alwaysAddToPackageJson": false
65
+ },
66
+ "@mui/icons-material": {
67
+ "version": "^7.3.1",
68
+ "alwaysAddToPackageJson": false
69
+ },
67
70
  "@kaltura/ds-react-bits": {
68
71
  "version": "latest",
69
72
  "alwaysAddToPackageJson": false
@@ -81,7 +84,7 @@
81
84
  "alwaysAddToPackageJson": false
82
85
  },
83
86
  "@unisphere/cli": {
84
- "version": "latest",
87
+ "version": "^1.54.0",
85
88
  "alwaysAddToPackageJson": false
86
89
  },
87
90
  "@unisphere/core": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,3 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function migrateGenerator(tree: Tree): Promise<void>;
3
- //# sourceMappingURL=migrate-to-1-1-5.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrate-to-1-1-5.d.ts","sourceRoot":"","sources":["../../../src/generators/migrate-to-1-1-5/migrate-to-1-1-5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAiB1C,wBAA8B,gBAAgB,CAAC,IAAI,EAAE,IAAI,iBA4CxD"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = migrateGenerator;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nx/devkit");
6
- const update_packages_1 = tslib_1.__importDefault(require("./update-packages"));
7
- const rename_widgetname_to_widgetname_1 = tslib_1.__importDefault(require("../../migrations/update-1-1-5/rename-widgetname-to-widgetname"));
8
- const fix_playground_apps_1 = tslib_1.__importDefault(require("../../migrations/update-1-1-5/fix-playground-apps"));
9
- const sync_package_json_files_1 = tslib_1.__importDefault(require("../../migrations/update-1-1-5/sync-package-json-files"));
10
- const move_runtime_info_to_core_1 = tslib_1.__importDefault(require("../../migrations/update-1-1-5/move-runtime-info-to-core"));
11
- // import updateLanguagesMigration from '../../migrations/update-1-1-5/_update-languages';
12
- const update_npmrc_1 = tslib_1.__importDefault(require("../../migrations/update-1-1-5/update-npmrc"));
13
- const check_nx_version_1 = tslib_1.__importDefault(require("../../migrations/update-1-1-5/check-nx-version"));
14
- const update_nvmrc_1 = tslib_1.__importDefault(require("../../migrations/update-1-1-5/update-nvmrc"));
15
- const fix_dependency_versions_1 = tslib_1.__importDefault(require("../../migrations/update-1-1-5/fix-dependency-versions"));
16
- const update_github_workflow_1 = tslib_1.__importDefault(require("../../migrations/update-1-1-5/update-github-workflow"));
17
- async function migrateGenerator(tree) {
18
- try {
19
- (0, check_nx_version_1.default)(tree);
20
- await (0, update_packages_1.default)(tree);
21
- await (0, update_nvmrc_1.default)(tree);
22
- await (0, fix_dependency_versions_1.default)(tree);
23
- await (0, update_github_workflow_1.default)(tree);
24
- await (0, rename_widgetname_to_widgetname_1.default)(tree);
25
- await (0, fix_playground_apps_1.default)(tree);
26
- await (0, move_runtime_info_to_core_1.default)(tree);
27
- // await updateLanguagesMigration(tree);
28
- await (0, update_npmrc_1.default)(tree);
29
- await (0, sync_package_json_files_1.default)(tree);
30
- devkit_1.logger.info('');
31
- devkit_1.logger.warn('═══════════════════════════════════════════════════════════════');
32
- devkit_1.logger.warn('✅ Migrations completed!');
33
- devkit_1.logger.warn('═══════════════════════════════════════════════════════════════');
34
- devkit_1.logger.warn('');
35
- devkit_1.logger.warn('📋 Next steps:');
36
- devkit_1.logger.warn('1. Review the changes made to package.json files');
37
- devkit_1.logger.warn('2. Remove node_modules: rm -rf node_modules');
38
- devkit_1.logger.warn('3. Install dependencies: npm install');
39
- devkit_1.logger.warn('4. Update old react code manually or run the codemod:');
40
- devkit_1.logger.warn(' npx codemod@latest react/19/migration-recipe --target ./src');
41
- devkit_1.logger.warn('5. Run npm run check to see if there are any errors');
42
- devkit_1.logger.warn('');
43
- devkit_1.logger.warn('═══════════════════════════════════════════════════════════════');
44
- }
45
- catch (error) {
46
- devkit_1.logger.error(`❌ Migration failed: ${error?.message || 'Unknown error'}`);
47
- throw error;
48
- }
49
- }
@@ -1,9 +0,0 @@
1
- To run the migration locally
2
-
3
- `
4
- npx nx generate {path-to-repo}/unisphere-nx-workspace-plugin/packages/nx:migrate-to-1-1-5
5
- `
6
-
7
-
8
- npx nx generate /home/tokomeno/kaltura/unisphere/pl/unisphere-nx-workspace-plugin/packages/nx:migrate-to-1-1-5
9
-
@@ -1 +0,0 @@
1
- export interface MigrateTo115GeneratorSchema {}
@@ -1,10 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "cli": "nx",
4
- "$id": "migrate-to-1-1-5",
5
- "title": "Migrate to @unisphere/nx v1.1.5",
6
- "description": "Migrates your project to @unisphere/nx v1.1.5 with package updates, WidgetName renaming, and React 19 preparation",
7
- "type": "object",
8
- "properties": {},
9
- "additionalProperties": false
10
- }
@@ -1,3 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function updatePackages(tree: Tree): Promise<void>;
3
- //# sourceMappingURL=update-packages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-packages.d.ts","sourceRoot":"","sources":["../../../src/generators/migrate-to-1-1-5/update-packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAU,MAAM,YAAY,CAAC;AAqBvD,wBAA8B,cAAc,CAAC,IAAI,EAAE,IAAI,iBA2GtD"}
@@ -1,205 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = updatePackages;
4
- const devkit_1 = require("@nx/devkit");
5
- const child_process_1 = require("child_process");
6
- /**
7
- * Fetches the latest version of a package from npm registry
8
- */
9
- async function getLatestVersion(packageName) {
10
- try {
11
- const result = (0, child_process_1.execSync)(`npm view ${packageName} version`, {
12
- encoding: 'utf8',
13
- stdio: ['pipe', 'pipe', 'pipe'],
14
- });
15
- return result.trim();
16
- }
17
- catch (error) {
18
- devkit_1.logger.warn(`Failed to fetch latest version for ${packageName}, keeping 'latest'`);
19
- return 'latest';
20
- }
21
- }
22
- async function updatePackages(tree) {
23
- // Read the current package.json
24
- const packageJsonContent = tree.read('package.json', 'utf-8');
25
- if (!packageJsonContent) {
26
- devkit_1.logger.error('No package.json found');
27
- return;
28
- }
29
- const packageJson = JSON.parse(packageJsonContent);
30
- // Get the 1.1.5 package updates
31
- devkit_1.logger.info('Fetching latest versions from npm registry...');
32
- // Resolve all 'latest' versions to actual version numbers
33
- const resolvedPackageUpdates = { ...packageUpdates };
34
- for (const [packageName, config] of Object.entries(packageUpdates.packages)) {
35
- if (config.version === 'latest') {
36
- const latestVersion = await getLatestVersion(packageName);
37
- resolvedPackageUpdates.packages[packageName] = {
38
- ...config,
39
- version: `^${latestVersion}`, // Add ^ prefix to latest versions
40
- };
41
- }
42
- }
43
- devkit_1.logger.info('Updating packages based on migrations.json...');
44
- let hasChanges = false;
45
- // Process each package update
46
- for (const [packageName, updateConfig] of Object.entries(resolvedPackageUpdates.packages)) {
47
- const { version, alwaysAddToPackageJson, addToPackageJson } = updateConfig;
48
- // Check if package exists in any dependency type
49
- const existsInDependencies = packageJson.dependencies && packageJson.dependencies[packageName];
50
- const existsInDevDependencies = packageJson.devDependencies && packageJson.devDependencies[packageName];
51
- const existsInOptionalDependencies = packageJson.optionalDependencies &&
52
- packageJson.optionalDependencies[packageName];
53
- const existsInPeerDependencies = packageJson.peerDependencies && packageJson.peerDependencies[packageName];
54
- const packageExists = existsInDependencies ||
55
- existsInDevDependencies ||
56
- existsInOptionalDependencies ||
57
- existsInPeerDependencies;
58
- // If alwaysAddToPackageJson is false, only update if package already exists
59
- if (alwaysAddToPackageJson === false && !packageExists) {
60
- devkit_1.logger.info(`Skipping ${packageName} (not installed, alwaysAddToPackageJson: false)`);
61
- continue;
62
- }
63
- // Update existing packages in their current location
64
- if (existsInDependencies) {
65
- devkit_1.logger.info(`Updating ${packageName} to ${version} in dependencies`);
66
- packageJson.dependencies[packageName] = version;
67
- hasChanges = true;
68
- }
69
- else if (existsInDevDependencies) {
70
- devkit_1.logger.info(`Updating ${packageName} to ${version} in devDependencies`);
71
- packageJson.devDependencies[packageName] = version;
72
- hasChanges = true;
73
- }
74
- else if (existsInOptionalDependencies) {
75
- devkit_1.logger.info(`Updating ${packageName} to ${version} in optionalDependencies`);
76
- packageJson.optionalDependencies[packageName] = version;
77
- hasChanges = true;
78
- }
79
- else if (existsInPeerDependencies) {
80
- devkit_1.logger.info(`Updating ${packageName} to ${version} in peerDependencies`);
81
- packageJson.peerDependencies[packageName] = version;
82
- hasChanges = true;
83
- }
84
- else if (alwaysAddToPackageJson !== false && addToPackageJson) {
85
- // Add new package to specified location if alwaysAddToPackageJson is not false
86
- const targetDeps = addToPackageJson;
87
- if (!packageJson[targetDeps]) {
88
- packageJson[targetDeps] = {};
89
- }
90
- devkit_1.logger.info(`Adding ${packageName} to ${version} in ${targetDeps}`);
91
- packageJson[targetDeps][packageName] = version;
92
- hasChanges = true;
93
- }
94
- }
95
- if (hasChanges) {
96
- // Write the updated package.json
97
- tree.write('package.json', JSON.stringify(packageJson, null, 2) + '\n');
98
- devkit_1.logger.info('✅ Package.json updated successfully!');
99
- devkit_1.logger.info('');
100
- devkit_1.logger.info('📦 Updated packages based on migrations.json packageJsonUpdates->1.1.5');
101
- devkit_1.logger.info('');
102
- devkit_1.logger.info('🔄 Run "npm install" to install the updated packages');
103
- }
104
- else {
105
- devkit_1.logger.info('No packages needed to be updated');
106
- }
107
- await (0, devkit_1.formatFiles)(tree);
108
- }
109
- var packageUpdates = {
110
- packages: {
111
- '@kaltura/ds-react-bits': {
112
- version: 'latest',
113
- alwaysAddToPackageJson: false,
114
- },
115
- '@kaltura/ds-react-icons': {
116
- version: 'latest',
117
- alwaysAddToPackageJson: false,
118
- },
119
- '@kaltura/ds-react-theme': {
120
- version: 'latest',
121
- alwaysAddToPackageJson: false,
122
- },
123
- '@kaltura/ds-react-utils': {
124
- version: 'latest',
125
- alwaysAddToPackageJson: false,
126
- },
127
- '@unisphere/cli': {
128
- version: 'latest',
129
- alwaysAddToPackageJson: false,
130
- },
131
- '@unisphere/core': {
132
- version: 'latest',
133
- alwaysAddToPackageJson: false,
134
- },
135
- '@unisphere/notifications-core': {
136
- version: 'latest',
137
- alwaysAddToPackageJson: false,
138
- },
139
- '@unisphere/notifications-runtime-react': {
140
- version: 'latest',
141
- alwaysAddToPackageJson: false,
142
- },
143
- '@unisphere/nx': {
144
- version: 'latest',
145
- alwaysAddToPackageJson: false,
146
- },
147
- '@unisphere/runtime': {
148
- version: 'latest',
149
- alwaysAddToPackageJson: false,
150
- },
151
- '@unisphere/runtime-js': {
152
- version: 'latest',
153
- alwaysAddToPackageJson: false,
154
- },
155
- '@unisphere/runtime-react': {
156
- version: 'latest',
157
- alwaysAddToPackageJson: false,
158
- },
159
- '@unisphere/ui-i18n-react': {
160
- version: 'latest',
161
- alwaysAddToPackageJson: false,
162
- },
163
- react: {
164
- version: '^19.0.0',
165
- alwaysAddToPackageJson: false,
166
- },
167
- 'react-dom': {
168
- version: '^19.0.0',
169
- alwaysAddToPackageJson: false,
170
- },
171
- '@types/node': {
172
- version: '^20.19.1',
173
- alwaysAddToPackageJson: false,
174
- },
175
- '@types/react': {
176
- version: '^19.0.0',
177
- alwaysAddToPackageJson: false,
178
- },
179
- '@types/react-dom': {
180
- version: '^19.0.0',
181
- alwaysAddToPackageJson: false,
182
- },
183
- '@swc/helpers': {
184
- version: '~0.5.17',
185
- alwaysAddToPackageJson: false,
186
- },
187
- 'react-codemod': {
188
- version: '^5.4.4',
189
- alwaysAddToPackageJson: false,
190
- },
191
- '@nx/nx-linux-x64-gnu': {
192
- version: '22.0.1',
193
- addToPackageJson: 'optionalDependencies',
194
- alwaysAddToPackageJson: false,
195
- },
196
- '@emotion/react': {
197
- version: '11.14.0',
198
- alwaysAddToPackageJson: false,
199
- },
200
- '@emotion/styled': {
201
- version: '11.14.1',
202
- alwaysAddToPackageJson: false,
203
- },
204
- },
205
- };
@@ -1,16 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- /**
3
- * Test Migration Locally Generator
4
- *
5
- * This generator mimics the full `nx migrate` flow for local testing.
6
- * It reads migrations.json and executes everything in the correct order,
7
- * including showing post-upgrade messages.
8
- *
9
- * Usage:
10
- * npx nx g @unisphere/nx:test-migration-locally
11
- *
12
- * Or with local path:
13
- * npx nx g ./packages/nx:test-migration-locally
14
- */
15
- export default function testMigrationLocally(tree: Tree): Promise<void>;
16
- //# sourceMappingURL=generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/test-migration-locally/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAuB,MAAM,YAAY,CAAC;AAIvD;;;;;;;;;;;;GAYG;AACH,wBAA8B,oBAAoB,CAAC,IAAI,EAAE,IAAI,iBA+G5D"}
@@ -1,9 +0,0 @@
1
- To run the migration locally
2
-
3
- `
4
- npx nx generate {path-to-repo}/unisphere-nx-workspace-plugin/packages/nx:test-migration-locally
5
- `
6
-
7
-
8
- npx nx generate /home/tokomeno/kaltura/unisphere/pl/unisphere-nx-workspace-plugin/packages/nx:test-migration-locally
9
-
@@ -1,10 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "cli": "nx",
4
- "$id": "TestMigrationLocally",
5
- "title": "Test Migration Locally",
6
- "description": "Runs migrations locally for testing (mimics nx migrate flow)",
7
- "type": "object",
8
- "properties": {},
9
- "required": []
10
- }