@unisphere/nx 1.22.5 → 1.22.7

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.
@@ -12,7 +12,7 @@ function checkNxVersion(tree) {
12
12
  }
13
13
  const majorVersion = parseInt(nxVersion.match(/\d+/)?.[0] ?? '0');
14
14
  if (majorVersion < 22) {
15
- const errorMessage = `❌ This migration requires Nx 22 or higher. read https://unisphere.kaltura.com/docs/create/changelog/1-22-5-changelog`;
15
+ const errorMessage = `❌ This migration requires Nx 22 or higher. read https://unisphere.kaltura.com/docs/create/changelog/1-22-7-changelog`;
16
16
  devkit_1.logger.error(errorMessage);
17
17
  throw new Error(errorMessage);
18
18
  }
@@ -0,0 +1,27 @@
1
+ diff --git a/node_modules/@nx/rollup/src/plugins/with-nx/with-nx.js b/node_modules/@nx/rollup/src/plugins/with-nx/with-nx.js
2
+ index 1135bba..4762053 100644
3
+ --- a/node_modules/@nx/rollup/src/plugins/with-nx/with-nx.js
4
+ +++ b/node_modules/@nx/rollup/src/plugins/with-nx/with-nx.js
5
+ @@ -149,7 +149,13 @@ dependencies) {
6
+ else {
7
+ options.generatePackageJson ??= true;
8
+ }
9
+ - const compilerOptions = createTsCompilerOptions(projectRoot, tsConfig, options, dependencies);
10
+ + let compilerOptionsInterceptor = ((config) => config);
11
+ + if (rollupConfig.unisphere?.interceptors?.compilerOptions) {
12
+ + console.log(`[unisphere.nx.rollup] using monkey patched interceptor for TS compiler options`);
13
+ + compilerOptionsInterceptor = rollupConfig.unisphere?.interceptors?.compilerOptions;
14
+ + }
15
+ +
16
+ + const compilerOptions = compilerOptionsInterceptor(createTsCompilerOptions(projectRoot, tsConfig, options, dependencies));
17
+ compilerOptions.outDir = Array.isArray(finalConfig.output)
18
+ ? finalConfig.output[0].dir
19
+ : finalConfig.output.dir;
20
+ @@ -170,6 +176,7 @@ dependencies) {
21
+ return require('rollup-plugin-typescript2')({
22
+ check: !options.skipTypeCheck,
23
+ tsconfig: tsConfigPath,
24
+ + exclude: ['**/*.stories.ts', '**/*.stories.tsx'],
25
+ tsconfigOverride: {
26
+ compilerOptions,
27
+ },
@@ -1 +1 @@
1
- {"version":3,"file":"replace-patches.d.ts","sourceRoot":"","sources":["../../../src/migrations/1-22-0/replace-patches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAyB,MAAM,YAAY,CAAC;AAKzD,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC9D"}
1
+ {"version":3,"file":"replace-patches.d.ts","sourceRoot":"","sources":["../../../src/migrations/1-22-0/replace-patches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmC,MAAM,YAAY,CAAC;AASnE,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAwD9D"}
@@ -3,10 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = update;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const path_1 = require("path");
6
- const removePatchList = ['@changesets+cli'];
6
+ const removePatchList = ['nx+rollup+', '@changesets+cli'];
7
+ const forcePatchVersions = {
8
+ '@nx/rollup': '22.1.3',
9
+ '@changesets/cli': '2.29.7'
10
+ };
7
11
  async function update(tree) {
8
12
  devkit_1.logger.info('🔄 Creating patches');
9
13
  try {
14
+ // Check @nx/rollup version
15
+ if (Object.keys(forcePatchVersions).length !== 0) {
16
+ devkit_1.logger.info('removing patches of older versions');
17
+ const pkg = (0, devkit_1.readJson)(tree, 'package.json');
18
+ Object.keys(forcePatchVersions).forEach(key => {
19
+ const version = pkg.devDependencies?.[key] || pkg.dependencies?.[key];
20
+ if (version !== forcePatchVersions[key]) {
21
+ devkit_1.logger.error(`❌ ${key} version must be exactly ${forcePatchVersions[key]}`);
22
+ throw new Error(`${key} version must be exactly ${forcePatchVersions[key]}. did you migrate nx to other version?`);
23
+ }
24
+ });
25
+ }
10
26
  // Create patches
11
27
  const patchesPath = 'patches';
12
28
  const patchesTemplatePath = (0, path_1.join)(__dirname, 'patches');
@@ -26,6 +42,11 @@ async function update(tree) {
26
42
  }
27
43
  // Copy all patch files using generateFiles
28
44
  (0, devkit_1.generateFiles)(tree, patchesTemplatePath, `./${patchesPath}`, {});
45
+ // Log created patches
46
+ const createdPatches = tree.children(patchesPath);
47
+ for (const patchFile of createdPatches) {
48
+ devkit_1.logger.info(`✅ Created patch: ${patchFile}`);
49
+ }
29
50
  // Always log that patches were created
30
51
  devkit_1.logger.info(`✅ All patches created successfully`);
31
52
  }
@@ -7,6 +7,6 @@ async function default_1() {
7
7
  devkit_1.logger.info('🎉 Migration to @unisphere/nx 1.22.4 finished successfully!');
8
8
  devkit_1.logger.info('');
9
9
  devkit_1.logger.info('📋 Full details:');
10
- devkit_1.logger.info('https://unisphere.kaltura.com/docs/create/changelog/1-22-5-changelog');
10
+ devkit_1.logger.info('https://unisphere.kaltura.com/docs/create/changelog/1-22-7-changelog');
11
11
  devkit_1.logger.info('');
12
12
  }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<void>;
3
+ //# sourceMappingURL=remove-storybook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-storybook.d.ts","sourceRoot":"","sources":["../../../src/migrations/1-22-7/remove-storybook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAsB,MAAM,YAAY,CAAC;AAEtD,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAsI9D"}
@@ -0,0 +1,114 @@
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('🔄 Removing Storybook files and dependencies...');
7
+ let removedItems = 0;
8
+ // 1. Remove storybook folder if it exists
9
+ if (tree.exists('storybook')) {
10
+ tree.delete('storybook');
11
+ devkit_1.logger.info('📁 Removed storybook folder');
12
+ removedItems++;
13
+ }
14
+ // 2. Remove storybook dependencies from package.json
15
+ const packageJsonPath = 'package.json';
16
+ if (tree.exists(packageJsonPath)) {
17
+ try {
18
+ (0, devkit_1.updateJson)(tree, packageJsonPath, (packageJson) => {
19
+ let dependenciesRemoved = 0;
20
+ // Remove from dependencies
21
+ if (packageJson.dependencies) {
22
+ const depsToRemove = Object.keys(packageJson.dependencies).filter(dep => dep === 'storybook' || dep.startsWith('@storybook/') || dep === '@nx/storybook');
23
+ depsToRemove.forEach(dep => {
24
+ delete packageJson.dependencies[dep];
25
+ dependenciesRemoved++;
26
+ });
27
+ }
28
+ // Remove from devDependencies
29
+ if (packageJson.devDependencies) {
30
+ const devDepsToRemove = Object.keys(packageJson.devDependencies).filter(dep => dep === 'storybook' || dep.startsWith('@storybook/'));
31
+ devDepsToRemove.forEach(dep => {
32
+ delete packageJson.devDependencies[dep];
33
+ dependenciesRemoved++;
34
+ });
35
+ }
36
+ // Remove from peerDependencies
37
+ if (packageJson.peerDependencies) {
38
+ const peerDepsToRemove = Object.keys(packageJson.peerDependencies).filter(dep => dep === 'storybook' || dep.startsWith('@storybook/'));
39
+ peerDepsToRemove.forEach(dep => {
40
+ delete packageJson.peerDependencies[dep];
41
+ dependenciesRemoved++;
42
+ });
43
+ }
44
+ if (dependenciesRemoved > 0) {
45
+ devkit_1.logger.info(`📦 Removed ${dependenciesRemoved} Storybook dependencies from package.json`);
46
+ removedItems++;
47
+ }
48
+ return packageJson;
49
+ });
50
+ }
51
+ catch (error) {
52
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
53
+ devkit_1.logger.warn(`⚠️ Could not update package.json: ${errorMessage}`);
54
+ throw new Error(`⚠️ Could not update package.json: ${errorMessage}`);
55
+ }
56
+ }
57
+ // 3. Remove storybook paths from tsconfig.base.json
58
+ const tsconfigPath = 'tsconfig.base.json';
59
+ if (tree.exists(tsconfigPath)) {
60
+ try {
61
+ (0, devkit_1.updateJson)(tree, tsconfigPath, (tsconfig) => {
62
+ let pathsRemoved = 0;
63
+ if (tsconfig.compilerOptions?.paths) {
64
+ const pathsToRemove = Object.entries(tsconfig.compilerOptions.paths).filter(([key, paths]) => paths.some(path => path.startsWith('storybook/'))).map(([key]) => key);
65
+ pathsToRemove.forEach(key => {
66
+ delete tsconfig.compilerOptions.paths[key];
67
+ pathsRemoved++;
68
+ });
69
+ if (pathsRemoved > 0) {
70
+ devkit_1.logger.info(`� Removed ${pathsRemoved} Storybook paths from tsconfig.base.json`);
71
+ removedItems++;
72
+ }
73
+ }
74
+ return tsconfig;
75
+ });
76
+ }
77
+ catch (error) {
78
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
79
+ throw new Error(`⚠️ Could not update tsconfig.base.json: ${errorMessage}`);
80
+ }
81
+ }
82
+ // 4. Remove @nx/storybook plugin from nx.json
83
+ const nxJsonPath = 'nx.json';
84
+ if (tree.exists(nxJsonPath)) {
85
+ try {
86
+ (0, devkit_1.updateJson)(tree, nxJsonPath, (nxJson) => {
87
+ let pluginsRemoved = 0;
88
+ if (nxJson.plugins && Array.isArray(nxJson.plugins)) {
89
+ const originalLength = nxJson.plugins.length;
90
+ nxJson.plugins = nxJson.plugins.filter((plugin) => {
91
+ const pluginName = typeof plugin === 'string' ? plugin : plugin.plugin;
92
+ return pluginName !== '@nx/storybook/plugin' && pluginName !== '@nx/storybook';
93
+ });
94
+ pluginsRemoved = originalLength - nxJson.plugins.length;
95
+ if (pluginsRemoved > 0) {
96
+ devkit_1.logger.info(`🔌 Removed ${pluginsRemoved} Storybook plugin(s) from nx.json`);
97
+ removedItems++;
98
+ }
99
+ }
100
+ return nxJson;
101
+ });
102
+ }
103
+ catch (error) {
104
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
105
+ throw new Error(`⚠️ Could not update nx.json: ${errorMessage}`);
106
+ }
107
+ }
108
+ if (removedItems === 0) {
109
+ devkit_1.logger.info('ℹ️ No Storybook files, dependencies, or paths found to remove');
110
+ }
111
+ else {
112
+ devkit_1.logger.info(`✅ Successfully removed Storybook components (${removedItems} operations completed)`);
113
+ }
114
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<void>;
3
+ //# sourceMappingURL=update-git-ignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-git-ignore.d.ts","sourceRoot":"","sources":["../../../src/migrations/1-22-7/update-git-ignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAE1C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD9D"}
@@ -0,0 +1,55 @@
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 .gitignore to add migration-related entries...');
7
+ const gitignorePath = '.gitignore';
8
+ if (!tree.exists(gitignorePath)) {
9
+ devkit_1.logger.warn('⚠️ .gitignore file not found, creating one');
10
+ tree.write(gitignorePath, '');
11
+ }
12
+ try {
13
+ const currentContent = tree.read(gitignorePath, 'utf-8') || '';
14
+ let updatedContent = currentContent;
15
+ let addedItems = 0;
16
+ // Check if migrations.json is already in .gitignore
17
+ const migrationsJsonRegex = /^migrations\.json\s*$/gm;
18
+ if (!migrationsJsonRegex.test(updatedContent)) {
19
+ // Add migrations.json entry
20
+ if (!updatedContent.includes('# Migration files')) {
21
+ updatedContent = updatedContent.trim() + '\n\n# Migration files\n';
22
+ }
23
+ if (!updatedContent.includes('migrations.json')) {
24
+ updatedContent += 'migrations.json\n';
25
+ addedItems++;
26
+ devkit_1.logger.info('📝 Added migrations.json to .gitignore');
27
+ }
28
+ }
29
+ // Check if ai-migrations is already in .gitignore
30
+ const aiMigrationsRegex = /^ai-migrations\s*$/gm;
31
+ if (!aiMigrationsRegex.test(updatedContent)) {
32
+ // Add ai-migrations entry
33
+ if (!updatedContent.includes('# Migration files')) {
34
+ updatedContent = updatedContent.trim() + '\n\n# Migration files\n';
35
+ }
36
+ if (!updatedContent.includes('ai-migrations')) {
37
+ updatedContent += 'ai-migrations\n';
38
+ addedItems++;
39
+ devkit_1.logger.info('📝 Added ai-migrations to .gitignore');
40
+ }
41
+ }
42
+ if (addedItems > 0) {
43
+ tree.write(gitignorePath, updatedContent);
44
+ devkit_1.logger.info(`✅ Successfully updated .gitignore (added ${addedItems} entries)`);
45
+ }
46
+ else {
47
+ devkit_1.logger.info('ℹ️ Migration-related entries already exist in .gitignore');
48
+ }
49
+ }
50
+ catch (error) {
51
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
52
+ devkit_1.logger.error(`❌ Failed to update .gitignore: ${errorMessage}`);
53
+ throw new Error(`Failed to update .gitignore: ${errorMessage}`);
54
+ }
55
+ }
package/migrations.json CHANGED
@@ -18,10 +18,10 @@
18
18
  },
19
19
  "1-22-0-replace-patches": {
20
20
  "version": "1.22.0",
21
- "description": "Replaces patches with updated version for Nx 22.1.3",
21
+ "description": "Replaces patches with updated version for Nx 22.1.3 and changeset cli",
22
22
  "factory": "./dist/migrations/1-22-0/replace-patches.js",
23
23
  "cli": {
24
- "postUpdateMessage": "✅ Patches have been replaced with updated version for Nx 22.1.3."
24
+ "postUpdateMessage": "✅ Patches have been replaced with updated version for Nx 22.1.3 and changeset cli."
25
25
  }
26
26
  },
27
27
  "1-22-1-sync-inner-package-json-dependencies": {
@@ -61,8 +61,21 @@
61
61
  "000-1-22-4-summary": {
62
62
  "version": "1.22.4",
63
63
  "description": "Migration completion summary for 1.22.4",
64
- "factory": "./dist/migrations/summaries/1-22-4-summary.js"
65
- }
64
+ "factory": "./dist/migrations/1-22-4/summary.js"
65
+ },
66
+ "1-22-7-update-git-ignore": {
67
+ "version": "1.22.7",
68
+ "description": "Update .gitignore",
69
+ "factory": "./dist/migrations/1-22-7/update-git-ignore.js"
70
+ },
71
+ "1-22-7-remove-storybook": {
72
+ "version": "1.22.7",
73
+ "description": "Removes storybook files and dependencies",
74
+ "factory": "./dist/migrations/1-22-7/remove-storybook.js",
75
+ "cli": {
76
+ "postUpdateMessage": "✅ Storybook files and dependencies have been removed"
77
+ }
78
+ },
66
79
  },
67
80
  "packageJsonUpdates": {
68
81
  "1.22.0": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "1.22.5",
3
+ "version": "1.22.7",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- export default function (): Promise<void>;
2
- //# sourceMappingURL=1-22-4-summary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"1-22-4-summary.d.ts","sourceRoot":"","sources":["../../../src/migrations/summaries/1-22-4-summary.ts"],"names":[],"mappings":"AAEA,0CAOC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const devkit_1 = require("@nx/devkit");
5
- async function default_1() {
6
- devkit_1.logger.info('');
7
- devkit_1.logger.info('🎉 Migration to @unisphere/nx 1.22.4 finished successfully!');
8
- devkit_1.logger.info('');
9
- devkit_1.logger.info('📋 Full details:');
10
- devkit_1.logger.info('https://unisphere.kaltura.com/docs/create/changelog/1-22-5-changelog');
11
- devkit_1.logger.info('');
12
- }