@unisphere/nx 2.2.2 → 3.2.3

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.
Files changed (130) hide show
  1. package/dist/generators/add-application/add-application.d.ts.map +1 -1
  2. package/dist/generators/add-application/add-application.js +76 -59
  3. package/dist/generators/add-application/schema.d.ts +3 -1
  4. package/dist/generators/add-application/schema.json +4 -8
  5. package/dist/generators/add-application/templates/default/.env-template +6 -0
  6. package/dist/generators/add-application/templates/default/.eslintrc.json +1 -1
  7. package/dist/generators/add-application/templates/default/jest.config.ts +3 -3
  8. package/dist/generators/add-application/templates/default/project.json.template +2 -2
  9. package/dist/generators/add-application/templates/default/readme.md.template +11 -0
  10. package/dist/generators/add-application/templates/default/src/app/app.tsx.template +77 -77
  11. package/dist/generators/add-application/templates/default/tsconfig.json +1 -1
  12. package/dist/generators/add-application/templates/default/webpack.config.js.template +6 -1
  13. package/dist/generators/add-package/README.md +2 -2
  14. package/dist/generators/add-package/add-package.d.ts.map +1 -1
  15. package/dist/generators/add-package/add-package.js +11 -23
  16. package/dist/generators/add-package/schema.d.ts +1 -1
  17. package/dist/generators/add-package/schema.json +27 -19
  18. package/dist/generators/add-package/templates/new-package/.eslintrc.json +1 -1
  19. package/dist/generators/add-package/templates/new-package/package.json.template +0 -1
  20. package/dist/generators/add-package/templates/new-package/project.json.template +4 -4
  21. package/dist/generators/add-package/templates/new-package/rollup.config.js +1 -1
  22. package/dist/generators/add-package/templates/new-package/tsconfig.json +1 -1
  23. package/dist/generators/add-package/templates/new-package/tsconfig.lib.json.template +1 -1
  24. package/dist/generators/add-package/templates/new-package/tsconfig.spec.json +1 -1
  25. package/dist/generators/add-runtime/add-runtime.d.ts.map +1 -1
  26. package/dist/generators/add-runtime/add-runtime.js +62 -9
  27. package/dist/generators/add-runtime/schema.d.ts +1 -0
  28. package/dist/generators/add-runtime/schema.json +1 -9
  29. package/dist/generators/add-runtime/templates/new-runtime/src/lib/create-factory.tsx.template +4 -4
  30. package/dist/generators/add-runtime/templates/new-runtime/src/lib/runtime.tsx.template +26 -2
  31. package/dist/generators/add-visual/add-visual.d.ts +1 -1
  32. package/dist/generators/add-visual/add-visual.d.ts.map +1 -1
  33. package/dist/generators/add-visual/add-visual.js +108 -15
  34. package/dist/generators/add-visual/schema.d.ts +3 -3
  35. package/dist/generators/add-visual/schema.json +2 -24
  36. package/dist/generators/dependency-config.d.ts.map +1 -1
  37. package/dist/generators/dependency-config.js +1 -0
  38. package/dist/generators/internal-dev-runner/generator.d.ts +3 -0
  39. package/dist/generators/internal-dev-runner/generator.d.ts.map +1 -0
  40. package/dist/generators/internal-dev-runner/generator.js +45 -0
  41. package/dist/generators/internal-dev-runner/schema.json +9 -0
  42. package/dist/generators/remove/remove.d.ts +19 -0
  43. package/dist/generators/remove/remove.d.ts.map +1 -0
  44. package/dist/generators/remove/remove.js +270 -0
  45. package/dist/generators/remove/schema.d.ts +4 -0
  46. package/dist/generators/remove/schema.json +38 -0
  47. package/dist/generators/rename-package/rename-package.d.ts +3 -0
  48. package/dist/generators/rename-package/rename-package.d.ts.map +1 -1
  49. package/dist/generators/rename-package/rename-package.js +139 -20
  50. package/dist/generators/utils.d.ts +30 -1
  51. package/dist/generators/utils.d.ts.map +1 -1
  52. package/dist/generators/utils.js +258 -7
  53. package/dist/migrations/1-22-0/patches/@changesets+cli+2.29.7.patch +36 -4
  54. package/dist/migrations/3-0-0/add-define-plugin-to-webpack.d.ts +3 -0
  55. package/dist/migrations/3-0-0/add-define-plugin-to-webpack.d.ts.map +1 -0
  56. package/dist/migrations/3-0-0/add-define-plugin-to-webpack.js +233 -0
  57. package/dist/migrations/3-0-0/add-env-to-application-gitignore.d.ts +3 -0
  58. package/dist/migrations/3-0-0/add-env-to-application-gitignore.d.ts.map +1 -0
  59. package/dist/migrations/3-0-0/add-env-to-application-gitignore.js +117 -0
  60. package/dist/migrations/3-0-0/fix-vite-config-cache-paths.d.ts +10 -0
  61. package/dist/migrations/3-0-0/fix-vite-config-cache-paths.d.ts.map +1 -0
  62. package/dist/migrations/3-0-0/fix-vite-config-cache-paths.js +66 -0
  63. package/dist/migrations/3-0-0/patches/@changesets+cli+2.29.7.patch +88 -0
  64. package/dist/migrations/3-0-0/post-cleanup-empty-directories.d.ts +12 -0
  65. package/dist/migrations/3-0-0/post-cleanup-empty-directories.d.ts.map +1 -0
  66. package/dist/migrations/3-0-0/post-cleanup-empty-directories.js +62 -0
  67. package/dist/migrations/3-0-0/pre-cleanup-empty-directories.d.ts +14 -0
  68. package/dist/migrations/3-0-0/pre-cleanup-empty-directories.d.ts.map +1 -0
  69. package/dist/migrations/3-0-0/pre-cleanup-empty-directories.js +105 -0
  70. package/dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.d.ts +3 -0
  71. package/dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.d.ts.map +1 -0
  72. package/dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.js +21 -0
  73. package/dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.d.ts +9 -0
  74. package/dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.d.ts.map +1 -0
  75. package/dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.js +88 -0
  76. package/dist/migrations/3-0-0/remove-publish-config-from-packages.d.ts +9 -0
  77. package/dist/migrations/3-0-0/remove-publish-config-from-packages.d.ts.map +1 -0
  78. package/dist/migrations/3-0-0/remove-publish-config-from-packages.js +45 -0
  79. package/dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.d.ts +15 -0
  80. package/dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.d.ts.map +1 -0
  81. package/dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.js +563 -0
  82. package/dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.d.ts +23 -0
  83. package/dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.d.ts.map +1 -0
  84. package/dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.js +645 -0
  85. package/dist/migrations/3-0-0/replace-github-workflow.d.ts +3 -0
  86. package/dist/migrations/3-0-0/replace-github-workflow.d.ts.map +1 -0
  87. package/dist/migrations/3-0-0/replace-github-workflow.js +48 -0
  88. package/dist/migrations/3-0-0/sync-package-lock.d.ts +10 -0
  89. package/dist/migrations/3-0-0/sync-package-lock.d.ts.map +1 -0
  90. package/dist/migrations/3-0-0/sync-package-lock.js +26 -0
  91. package/dist/migrations/3-0-0/templates/_publish-artifacts.template +363 -0
  92. package/dist/migrations/3-0-0/templates/cicd.template +89 -0
  93. package/dist/migrations/3-0-0/update-changeset-patch.d.ts +3 -0
  94. package/dist/migrations/3-0-0/update-changeset-patch.d.ts.map +1 -0
  95. package/dist/migrations/3-0-0/update-changeset-patch.js +31 -0
  96. package/dist/migrations/3-0-0/upgrade-schema-to-2-0-0.d.ts +21 -0
  97. package/dist/migrations/3-0-0/upgrade-schema-to-2-0-0.d.ts.map +1 -0
  98. package/dist/migrations/3-0-0/upgrade-schema-to-2-0-0.js +105 -0
  99. package/dist/migrations/utils/has-react-dependency.d.ts +14 -0
  100. package/dist/migrations/utils/has-react-dependency.d.ts.map +1 -0
  101. package/dist/migrations/utils/has-react-dependency.js +72 -0
  102. package/dist/shared.d.ts +6 -0
  103. package/dist/shared.d.ts.map +1 -0
  104. package/dist/shared.js +9 -0
  105. package/generators.json +12 -1
  106. package/migrations.json +117 -0
  107. package/package.json +3 -2
  108. package/dist/generators/add-application/templates/local-dev-playground/.babelrc +0 -11
  109. package/dist/generators/add-application/templates/local-dev-playground/.eslintrc.json +0 -22
  110. package/dist/generators/add-application/templates/local-dev-playground/jest.config.ts +0 -11
  111. package/dist/generators/add-application/templates/local-dev-playground/package.json +0 -6
  112. package/dist/generators/add-application/templates/local-dev-playground/project.json +0 -9
  113. package/dist/generators/add-application/templates/local-dev-playground/src/app/app.tsx.template +0 -212
  114. package/dist/generators/add-application/templates/local-dev-playground/src/app/components/header.tsx.template +0 -123
  115. package/dist/generators/add-application/templates/local-dev-playground/src/app/components/settings-buttons.tsx +0 -57
  116. package/dist/generators/add-application/templates/local-dev-playground/src/app/components/settings-form.tsx +0 -108
  117. package/dist/generators/add-application/templates/local-dev-playground/src/app/components/settings.tsx +0 -74
  118. package/dist/generators/add-application/templates/local-dev-playground/src/app/configuration-provider.tsx +0 -163
  119. package/dist/generators/add-application/templates/local-dev-playground/src/app/definitions.ts +0 -25
  120. package/dist/generators/add-application/templates/local-dev-playground/src/app/utils/merge-deep.ts +0 -31
  121. package/dist/generators/add-application/templates/local-dev-playground/src/favicon.ico +0 -0
  122. package/dist/generators/add-application/templates/local-dev-playground/src/index.html +0 -17
  123. package/dist/generators/add-application/templates/local-dev-playground/src/main.tsx +0 -13
  124. package/dist/generators/add-application/templates/local-dev-playground/src/styles.css +0 -0
  125. package/dist/generators/add-application/templates/local-dev-playground/tsconfig.app.json +0 -24
  126. package/dist/generators/add-application/templates/local-dev-playground/tsconfig.json +0 -20
  127. package/dist/generators/add-application/templates/local-dev-playground/tsconfig.spec.json +0 -25
  128. package/dist/generators/add-application/templates/local-dev-playground/webpack.config.js +0 -33
  129. /package/dist/generators/add-runtime/templates/{core-templates → types-templates}/__runtimeName__-runtime/index.ts.template +0 -0
  130. /package/dist/generators/add-runtime/templates/{core-templates → types-templates}/__runtimeName__-runtime/runtime-types.ts.template +0 -0
@@ -2,6 +2,10 @@ import { Tree } from '@nx/devkit';
2
2
  export interface UnisphereConfig {
3
3
  company: string;
4
4
  name: string;
5
+ runtimes: Record<string, {
6
+ sourceRoot: string;
7
+ visuals: string[];
8
+ }>;
5
9
  }
6
10
  export declare function validateUnisphereConfig(tree: Tree): UnisphereConfig;
7
11
  export declare function updateTsConfigPaths(tree: Tree, pathKey: string, pathValue: string): void;
@@ -16,7 +20,7 @@ export declare function findTypesPackageAlias(tree: Tree): string | null;
16
20
  export interface TypesPackageInfo {
17
21
  /** The tsconfig alias for the package (e.g., "@mycompany/types" or "@mycompany/core") */
18
22
  alias: string;
19
- /** The base path to the package (e.g., "unisphere/packages/types" or "unisphere/packages/core") */
23
+ /** The base path to the package (e.g., "unisphere/packages/types" or "unisphere/packages/public/core") */
20
24
  basePath: string;
21
25
  /** Whether the types package exists (true) or falling back to core (false) */
22
26
  hasTypesPackage: boolean;
@@ -32,5 +36,30 @@ type NameTransformations<Prefix extends string> = {
32
36
  export declare function createNameTransforms<Prefix extends string>(baseName: string, prefix: Prefix): NameTransformations<Prefix>;
33
37
  export declare function isPackageInstalled(tree: Tree, packageName: string): string | false;
34
38
  export declare function checkIfRuntimeExists(tree: Tree, runtimeName: string): boolean;
39
+ /**
40
+ * Maps package scope to subdirectory name
41
+ * @param scope - The package scope ('public', 'internal', 'none')
42
+ * @returns The subdirectory name ('unisphere', 'kaltura-corp', 'local')
43
+ */
44
+ export declare function getSubdirectoryFromScope(scope: 'public' | 'internal' | 'none' | 'kaltura-ai'): string;
45
+ /**
46
+ * Extracts the subdirectory from a package sourceRoot path
47
+ * @param sourceRoot - The sourceRoot path (e.g., "unisphere/packages/kaltura-corp/shared")
48
+ * @returns The subdirectory name ('unisphere', 'kaltura-corp', 'local') or null if flat structure
49
+ */
50
+ export declare function extractSubdirectoryFromSourceRoot(sourceRoot: string): string | null;
51
+ /**
52
+ * Extracts the package name from a package sourceRoot path
53
+ * @param sourceRoot - The sourceRoot path (e.g., "unisphere/packages/corp/shared" or "unisphere/packages/shared")
54
+ * @returns The package name
55
+ */
56
+ export declare function extractPackageNameFromSourceRoot(sourceRoot: string): string;
57
+ /**
58
+ * Adds a script to the root package.json
59
+ * @param tree - The file system tree
60
+ * @param scriptName - The name of the script (e.g., "dev:my-app")
61
+ * @param scriptCommand - The command to run (e.g., "npx unisphere application serve my-app --port 4002")
62
+ */
63
+ export declare function addScriptToRootPackageJson(tree: Tree, scriptName: string, scriptCommand: string): void;
35
64
  export {};
36
65
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/generators/utils.ts"],"names":[],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EAClB,aAAa,EAAE,MAAM,GACpB,IAAI,CAyBN"}
@@ -10,7 +10,90 @@ exports.findTypesOrCorePackageInfo = findTypesOrCorePackageInfo;
10
10
  exports.createNameTransforms = createNameTransforms;
11
11
  exports.isPackageInstalled = isPackageInstalled;
12
12
  exports.checkIfRuntimeExists = checkIfRuntimeExists;
13
+ exports.getSubdirectoryFromScope = getSubdirectoryFromScope;
14
+ exports.extractSubdirectoryFromSourceRoot = extractSubdirectoryFromSourceRoot;
15
+ exports.extractPackageNameFromSourceRoot = extractPackageNameFromSourceRoot;
16
+ exports.addScriptToRootPackageJson = addScriptToRootPackageJson;
13
17
  const devkit_1 = require("@nx/devkit");
18
+ /**
19
+ * Extracts visual type names from a runtime.tsx file
20
+ * Looks for visualTypes object in the constructor's super() call
21
+ * Returns empty array if file doesn't exist or parsing fails
22
+ */
23
+ function extractVisualTypesFromRuntime(tree, runtimeSourceRoot) {
24
+ const runtimeFilePath = `${runtimeSourceRoot}/src/lib/runtime.tsx`;
25
+ // Check if runtime.tsx exists
26
+ if (!tree.exists(runtimeFilePath)) {
27
+ return [];
28
+ }
29
+ try {
30
+ // Read the file content
31
+ const content = tree.read(runtimeFilePath, 'utf-8');
32
+ if (!content) {
33
+ return [];
34
+ }
35
+ // Find the start of visualTypes
36
+ const visualTypesStart = content.indexOf('visualTypes:');
37
+ if (visualTypesStart === -1) {
38
+ return [];
39
+ }
40
+ // Find the opening brace after visualTypes
41
+ const openBraceIndex = content.indexOf('{', visualTypesStart);
42
+ if (openBraceIndex === -1) {
43
+ return [];
44
+ }
45
+ // Count braces to find the matching closing brace
46
+ let braceCount = 1;
47
+ let currentIndex = openBraceIndex + 1;
48
+ let closeBraceIndex = -1;
49
+ while (currentIndex < content.length && braceCount > 0) {
50
+ if (content[currentIndex] === '{') {
51
+ braceCount++;
52
+ }
53
+ else if (content[currentIndex] === '}') {
54
+ braceCount--;
55
+ if (braceCount === 0) {
56
+ closeBraceIndex = currentIndex;
57
+ break;
58
+ }
59
+ }
60
+ currentIndex++;
61
+ }
62
+ if (closeBraceIndex === -1) {
63
+ return [];
64
+ }
65
+ // Extract the content between the braces
66
+ const visualTypesContent = content.substring(openBraceIndex + 1, closeBraceIndex);
67
+ // Find the minimum indentation level (first-level properties)
68
+ const lines = visualTypesContent.split('\n');
69
+ const indentations = [];
70
+ for (const line of lines) {
71
+ const match = line.match(/^(\s*)(\w+)\s*:/);
72
+ if (match) {
73
+ indentations.push(match[1].length);
74
+ }
75
+ }
76
+ // If no properties found, return empty array
77
+ if (indentations.length === 0) {
78
+ return [];
79
+ }
80
+ // Find minimum indentation (first-level properties)
81
+ const minIndent = Math.min(...indentations);
82
+ // Extract visual names (only first-level properties with minimum indentation)
83
+ const visuals = [];
84
+ for (const line of lines) {
85
+ const match = line.match(/^(\s*)(\w+)\s*:/);
86
+ if (match && match[1].length === minIndent) {
87
+ visuals.push(match[2]);
88
+ }
89
+ }
90
+ return visuals;
91
+ }
92
+ catch (error) {
93
+ // If any error occurs during parsing, return empty array
94
+ return [];
95
+ }
96
+ }
14
97
  function validateUnisphereConfig(tree) {
15
98
  // Check if file exists
16
99
  if (!tree.exists('.unisphere')) {
@@ -45,9 +128,24 @@ function validateUnisphereConfig(tree) {
45
128
  ' "name": "your-experience-name"\n' +
46
129
  '}');
47
130
  }
131
+ // Extract runtimes with their visual types
132
+ const runtimes = {};
133
+ if (config.elements?.runtimes) {
134
+ for (const [runtimeName, runtimeConfig] of Object.entries(config.elements.runtimes)) {
135
+ const sourceRoot = runtimeConfig.sourceRoot;
136
+ if (sourceRoot && typeof sourceRoot === 'string') {
137
+ const visuals = extractVisualTypesFromRuntime(tree, sourceRoot);
138
+ runtimes[runtimeName] = {
139
+ sourceRoot,
140
+ visuals,
141
+ };
142
+ }
143
+ }
144
+ }
48
145
  return {
49
146
  company: config.company,
50
147
  name: config.name,
148
+ runtimes,
51
149
  };
52
150
  }
53
151
  function updateTsConfigPaths(tree, pathKey, pathValue) {
@@ -124,6 +222,28 @@ function validateRuntimeExists(tree, runtimeName) {
124
222
  }
125
223
  return runtimeConfig.sourceRoot;
126
224
  }
225
+ /**
226
+ * Checks if a path matches the core package pattern
227
+ * Supports both old (unisphere/packages/core) and new (unisphere/packages/<visibility>/core) patterns
228
+ */
229
+ function isCorePackagePath(pathValue) {
230
+ // Old pattern: unisphere/packages/core/src/index.ts
231
+ // New patterns with subdirectories
232
+ const corePatterns = [
233
+ 'unisphere/packages/local/core/src/index.ts',
234
+ 'unisphere/packages/kaltura-corp/core/src/index.ts',
235
+ 'unisphere/packages/unisphere/core/src/index.ts',
236
+ 'unisphere/packages/kaltura-ai/core/src/index.ts',
237
+ ];
238
+ return corePatterns.includes(pathValue);
239
+ }
240
+ /**
241
+ * Extracts the base path from a tsconfig path value
242
+ * e.g., "unisphere/packages/public/core/src/index.ts" -> "unisphere/packages/public/core"
243
+ */
244
+ function extractBasePath(pathValue) {
245
+ return pathValue.replace('/src/index.ts', '');
246
+ }
127
247
  function findCorePackageAlias(tree) {
128
248
  if (!tree.exists('tsconfig.base.json')) {
129
249
  throw new Error('tsconfig.base.json not found in the project root.');
@@ -133,19 +253,38 @@ function findCorePackageAlias(tree) {
133
253
  if (!tsconfigBase.compilerOptions?.paths) {
134
254
  throw new Error('No paths found in tsconfig.base.json compilerOptions.');
135
255
  }
136
- // Find the key that has the value "unisphere/packages/core/src/index.ts"
256
+ // Find the key that has a core package path (supports both old and new patterns)
137
257
  for (const [key, paths] of Object.entries(tsconfigBase.compilerOptions.paths)) {
138
- if (Array.isArray(paths) && paths.includes('unisphere/packages/core/src/index.ts')) {
258
+ if (Array.isArray(paths) && paths.some(p => isCorePackagePath(p))) {
139
259
  return key;
140
260
  }
141
261
  }
142
262
  throw new Error('Core package not found in tsconfig.base.json paths. ' +
143
- 'Expected to find a key with value "unisphere/packages/core/src/index.ts"');
263
+ 'Expected to find a key with value matching "unisphere/packages/[<visibility>/]core/src/index.ts"');
144
264
  }
145
265
  catch (error) {
146
266
  throw new Error(`Failed to read tsconfig.base.json: ${error instanceof Error ? error.message : 'Unknown error'}`);
147
267
  }
148
268
  }
269
+ /**
270
+ * Checks if a path matches the types package pattern
271
+ * Supports both old (unisphere/packages/types) and new (unisphere/packages/<visibility>/types) patterns
272
+ */
273
+ function isTypesPackagePath(pathValue) {
274
+ const typesPatterns = [
275
+ 'unisphere/packages/types/src/index.ts',
276
+ // Old subdirectory names (for backwards compatibility)
277
+ 'unisphere/packages/private/types/src/index.ts',
278
+ 'unisphere/packages/corp/types/src/index.ts',
279
+ 'unisphere/packages/public/types/src/index.ts',
280
+ // New subdirectory names (v3 migration)
281
+ 'unisphere/packages/local/types/src/index.ts',
282
+ 'unisphere/packages/kaltura-corp/types/src/index.ts',
283
+ 'unisphere/packages/unisphere/types/src/index.ts',
284
+ 'unisphere/packages/kaltura-ai/types/src/index.ts',
285
+ ];
286
+ return typesPatterns.includes(pathValue);
287
+ }
149
288
  /**
150
289
  * Tries to find the types package alias in tsconfig.base.json
151
290
  * Returns null if types package is not found
@@ -159,9 +298,9 @@ function findTypesPackageAlias(tree) {
159
298
  if (!tsconfigBase.compilerOptions?.paths) {
160
299
  return null;
161
300
  }
162
- // Find the key that has the value "unisphere/packages/types/src/index.ts"
301
+ // Find the key that has a types package path (supports both old and new patterns)
163
302
  for (const [key, paths] of Object.entries(tsconfigBase.compilerOptions.paths)) {
164
- if (Array.isArray(paths) && paths.includes('unisphere/packages/types/src/index.ts')) {
303
+ if (Array.isArray(paths) && paths.some(p => isTypesPackagePath(p))) {
165
304
  return key;
166
305
  }
167
306
  }
@@ -171,6 +310,32 @@ function findTypesPackageAlias(tree) {
171
310
  return null;
172
311
  }
173
312
  }
313
+ /**
314
+ * Finds the actual base path for a package from tsconfig.base.json
315
+ */
316
+ function findPackageBasePath(tree, pathMatcher) {
317
+ if (!tree.exists('tsconfig.base.json')) {
318
+ return null;
319
+ }
320
+ try {
321
+ const tsconfigBase = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
322
+ if (!tsconfigBase.compilerOptions?.paths) {
323
+ return null;
324
+ }
325
+ for (const [, paths] of Object.entries(tsconfigBase.compilerOptions.paths)) {
326
+ if (Array.isArray(paths)) {
327
+ const matchingPath = paths.find(p => pathMatcher(p));
328
+ if (matchingPath) {
329
+ return extractBasePath(matchingPath);
330
+ }
331
+ }
332
+ }
333
+ return null;
334
+ }
335
+ catch {
336
+ return null;
337
+ }
338
+ }
174
339
  /**
175
340
  * Finds the types package if it exists, otherwise falls back to core package.
176
341
  * Returns info about which package to use for runtime types.
@@ -178,21 +343,39 @@ function findTypesPackageAlias(tree) {
178
343
  function findTypesOrCorePackageInfo(tree) {
179
344
  const typesAlias = findTypesPackageAlias(tree);
180
345
  if (typesAlias) {
346
+ const basePath = findPackageBasePath(tree, isTypesPackagePath);
347
+ if (!basePath) {
348
+ throw new Error('Types package base path not found');
349
+ }
181
350
  return {
182
351
  alias: typesAlias,
183
- basePath: 'unisphere/packages/types',
352
+ basePath,
184
353
  hasTypesPackage: true,
185
354
  };
186
355
  }
187
356
  // Fallback to core package
188
357
  const coreAlias = findCorePackageAlias(tree);
358
+ const basePath = findPackageBasePath(tree, isCorePackagePath);
359
+ if (!basePath) {
360
+ throw new Error('Core package base path not found');
361
+ }
189
362
  return {
190
363
  alias: coreAlias,
191
- basePath: 'unisphere/packages/core',
364
+ basePath,
192
365
  hasTypesPackage: false,
193
366
  };
194
367
  }
195
368
  function createNameTransforms(baseName, prefix) {
369
+ if (!baseName) {
370
+ return {
371
+ [`${prefix}`]: '',
372
+ [`${prefix}__lowerDashCase`]: '',
373
+ [`${prefix}__camelCase`]: '',
374
+ [`${prefix}__pascalCase`]: '',
375
+ [`${prefix}__constantCase`]: '',
376
+ [`${prefix}__humanReadable`]: '',
377
+ }; // Type assertion to match the defined type
378
+ }
196
379
  const nameVariants = (0, devkit_1.names)(baseName); // Assuming 'names' function is available and returns NameVariants
197
380
  const humanReadable = baseName
198
381
  .replace(/[-_]/g, ' ')
@@ -244,3 +427,71 @@ function checkIfRuntimeExists(tree, runtimeName) {
244
427
  return false;
245
428
  }
246
429
  }
430
+ /**
431
+ * Maps package scope to subdirectory name
432
+ * @param scope - The package scope ('public', 'internal', 'none')
433
+ * @returns The subdirectory name ('unisphere', 'kaltura-corp', 'local')
434
+ */
435
+ function getSubdirectoryFromScope(scope) {
436
+ const scopeToSubdirectory = {
437
+ 'public': 'unisphere',
438
+ 'internal': 'kaltura-corp',
439
+ 'none': 'local',
440
+ 'kaltura-ai': 'kaltura-ai',
441
+ };
442
+ return scopeToSubdirectory[scope];
443
+ }
444
+ /**
445
+ * Extracts the subdirectory from a package sourceRoot path
446
+ * @param sourceRoot - The sourceRoot path (e.g., "unisphere/packages/kaltura-corp/shared")
447
+ * @returns The subdirectory name ('unisphere', 'kaltura-corp', 'local') or null if flat structure
448
+ */
449
+ function extractSubdirectoryFromSourceRoot(sourceRoot) {
450
+ const parts = sourceRoot.split('/');
451
+ // Expected format: unisphere/packages/<subdirectory>/<packageName>
452
+ // Or old format: unisphere/packages/<packageName>
453
+ if (parts.length === 4 && parts[0] === 'unisphere' && parts[1] === 'packages') {
454
+ const subdirectory = parts[2];
455
+ if (['local', 'kaltura-corp', 'unisphere', 'kaltura-ai'].includes(subdirectory)) {
456
+ return subdirectory;
457
+ }
458
+ }
459
+ return null; // Flat structure
460
+ }
461
+ /**
462
+ * Extracts the package name from a package sourceRoot path
463
+ * @param sourceRoot - The sourceRoot path (e.g., "unisphere/packages/corp/shared" or "unisphere/packages/shared")
464
+ * @returns The package name
465
+ */
466
+ function extractPackageNameFromSourceRoot(sourceRoot) {
467
+ const parts = sourceRoot.split('/');
468
+ // Return the last part of the path
469
+ return parts[parts.length - 1];
470
+ }
471
+ /**
472
+ * Adds a script to the root package.json
473
+ * @param tree - The file system tree
474
+ * @param scriptName - The name of the script (e.g., "dev:my-app")
475
+ * @param scriptCommand - The command to run (e.g., "npx unisphere application serve my-app --port 4002")
476
+ */
477
+ function addScriptToRootPackageJson(tree, scriptName, scriptCommand) {
478
+ if (!tree.exists('package.json')) {
479
+ devkit_1.logger.warn('⚠️ package.json not found in root directory, cannot add script');
480
+ return;
481
+ }
482
+ try {
483
+ const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
484
+ // Ensure scripts object exists
485
+ if (!packageJson.scripts) {
486
+ packageJson.scripts = {};
487
+ }
488
+ // Only add if script doesn't already exist
489
+ if (!packageJson.scripts[scriptName]) {
490
+ packageJson.scripts[scriptName] = scriptCommand;
491
+ (0, devkit_1.writeJson)(tree, 'package.json', packageJson);
492
+ }
493
+ }
494
+ catch (error) {
495
+ devkit_1.logger.warn(`⚠️ Failed to add script to package.json: ${error instanceof Error ? error.message : 'Unknown error'}`);
496
+ }
497
+ }
@@ -2,7 +2,7 @@ diff --git a/node_modules/@changesets/cli/dist/changesets-cli.cjs.js b/node_modu
2
2
  index 53fc925..8ee486e 100644
3
3
  --- a/node_modules/@changesets/cli/dist/changesets-cli.cjs.js
4
4
  +++ b/node_modules/@changesets/cli/dist/changesets-cli.cjs.js
5
- @@ -310,22 +310,7 @@ async function createChangeset(changedPackages, allPackages) {
5
+ @@ -310,22 +310,23 @@ async function createChangeset(changedPackages, allPackages) {
6
6
  const packagesToRelease = await getPackagesToRelease(changedPackages, allPackages);
7
7
  let pkgJsonsByName = getPkgJsonsByName(allPackages);
8
8
  let pkgsLeftToGetBumpTypeFor = new Set(packagesToRelease);
@@ -22,7 +22,23 @@ index 53fc925..8ee486e 100644
22
22
  - }
23
23
  - return x;
24
24
  - })).filter(x => x !== "all packages");
25
- + let pkgsThatShouldBeMajorBumped = [];
25
+ + let nonRuntimePackages = packagesToRelease.filter(pkgName => !pkgName.includes('unisphere-runtime-'));
26
+ + let pkgsThatShouldBeMajorBumped = nonRuntimePackages.length > 0 ? (await askCheckboxPlus(bold(`Which packages should have a ${red("major")} bump?`), [{
27
+ + name: "all packages",
28
+ + choices: nonRuntimePackages.map(pkgName => {
29
+ + return {
30
+ + name: pkgName,
31
+ + message: formatPkgNameAndVersion(pkgName, pkgJsonsByName.get(pkgName).version)
32
+ + };
33
+ + })
34
+ + }], x => {
35
+ + // this removes changed packages and unchanged packages from the list
36
+ + // of packages shown after selection
37
+ + if (Array.isArray(x)) {
38
+ + return x.filter(x => x !== "all packages").map(x => cyan(x)).join(", ");
39
+ + }
40
+ + return x;
41
+ + })).filter(x => x !== "all packages") : [];
26
42
  for (const pkgName of pkgsThatShouldBeMajorBumped) {
27
43
  // for packages that are under v1, we want to make sure major releases are intended,
28
44
  // as some repo-wide sweeping changes have mistakenly release first majors
@@ -30,7 +46,7 @@ diff --git a/node_modules/@changesets/cli/dist/changesets-cli.esm.js b/node_modu
30
46
  index 6c363c0..40aad33 100644
31
47
  --- a/node_modules/@changesets/cli/dist/changesets-cli.esm.js
32
48
  +++ b/node_modules/@changesets/cli/dist/changesets-cli.esm.js
33
- @@ -272,22 +272,7 @@ async function createChangeset(changedPackages, allPackages) {
49
+ @@ -272,22 +272,23 @@ async function createChangeset(changedPackages, allPackages) {
34
50
  const packagesToRelease = await getPackagesToRelease(changedPackages, allPackages);
35
51
  let pkgJsonsByName = getPkgJsonsByName(allPackages);
36
52
  let pkgsLeftToGetBumpTypeFor = new Set(packagesToRelease);
@@ -50,7 +66,23 @@ index 6c363c0..40aad33 100644
50
66
  - }
51
67
  - return x;
52
68
  - })).filter(x => x !== "all packages");
53
- + let pkgsThatShouldBeMajorBumped = [];
69
+ + let nonRuntimePackages = packagesToRelease.filter(pkgName => !pkgName.includes('unisphere-runtime-'));
70
+ + let pkgsThatShouldBeMajorBumped = nonRuntimePackages.length > 0 ? (await askCheckboxPlus(bold(`Which packages should have a ${red("major")} bump?`), [{
71
+ + name: "all packages",
72
+ + choices: nonRuntimePackages.map(pkgName => {
73
+ + return {
74
+ + name: pkgName,
75
+ + message: formatPkgNameAndVersion(pkgName, pkgJsonsByName.get(pkgName).version)
76
+ + };
77
+ + })
78
+ + }], x => {
79
+ + // this removes changed packages and unchanged packages from the list
80
+ + // of packages shown after selection
81
+ + if (Array.isArray(x)) {
82
+ + return x.filter(x => x !== "all packages").map(x => cyan(x)).join(", ");
83
+ + }
84
+ + return x;
85
+ + })).filter(x => x !== "all packages") : [];
54
86
  for (const pkgName of pkgsThatShouldBeMajorBumped) {
55
87
  // for packages that are under v1, we want to make sure major releases are intended,
56
88
  // as some repo-wide sweeping changes have mistakenly release first majors
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<void>;
3
+ //# sourceMappingURL=add-define-plugin-to-webpack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-define-plugin-to-webpack.d.ts","sourceRoot":"","sources":["../../../src/migrations/3-0-0/add-define-plugin-to-webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,YAAY,CAAC;AAiHpD,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAwK9D"}