@unisphere/nx 4.12.1 → 4.12.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.
@@ -1 +1 @@
1
- {"version":3,"file":"add-visual.d.ts","sourceRoot":"","sources":["../../../src/generators/add-visual/add-visual.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAE,MAAM,YAAY,CAAC;AAsB9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAapD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAUjF;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,CAuBR;AAwZD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,GAAG,CAAC,CA6Ed;AAED,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"add-visual.d.ts","sourceRoot":"","sources":["../../../src/generators/add-visual/add-visual.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAE,MAAM,YAAY,CAAC;AAsB9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAapD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAUjF;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,CAuBR;AA2ZD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,GAAG,CAAC,CAgFd;AAED,eAAe,kBAAkB,CAAC"}
@@ -96,7 +96,7 @@ function addImportToRuntime(sourceFilePath, tree, vars, project) {
96
96
  (0, visual_utils_1.saveSourceFile)(tree, sourceFilePath, sourceFile.getFullText());
97
97
  console.log(`āœ… Added import for visual ${humanName}`);
98
98
  }
99
- function updateRuntimeIndexExport(tree, runtimeName, visualName, typesPackageInfo) {
99
+ function updateRuntimeIndexExport(tree, runtimeName, visualName, typesPackageInfo, visualsSubfolder) {
100
100
  const runtimeIndexPath = `${typesPackageInfo.basePath}/src/lib/${runtimeName}-runtime/index.ts`;
101
101
  if (!tree.exists(runtimeIndexPath)) {
102
102
  throw new Error(`Runtime index file not found at ${runtimeIndexPath}`);
@@ -105,7 +105,7 @@ function updateRuntimeIndexExport(tree, runtimeName, visualName, typesPackageInf
105
105
  if (!currentContent) {
106
106
  throw new Error(`Failed to read content from ${runtimeIndexPath}`);
107
107
  }
108
- const exportLine = `export * from './${visualName}-visual-types';`;
108
+ const exportLine = `export * from './${visualsSubfolder}/${visualName}-visual-types';`;
109
109
  // Check if the export already exists
110
110
  if (currentContent.includes(exportLine)) {
111
111
  return; // Already exported
@@ -181,7 +181,7 @@ function addVisualTypesToConstructor(sourceFilePath, tree, vars, project, isSing
181
181
  * Adds a private render method to the main class in the runtime file.
182
182
  * Uses Nx's generateFiles for proper template processing.
183
183
  */
184
- function addRenderMethod(sourceFilePath, tree, vars, project, typesPackageInfo) {
184
+ function addRenderMethod(sourceFilePath, tree, vars, project, typesPackageInfo, visualsSubfolder) {
185
185
  const sourceFile = (0, visual_utils_1.loadSourceFile)(tree, sourceFilePath, project);
186
186
  const methodName = `_render${vars.visualName__pascalCase}`;
187
187
  const clazz = (0, visual_utils_1.findFirstClass)(sourceFile);
@@ -249,7 +249,7 @@ function addRenderMethod(sourceFilePath, tree, vars, project, typesPackageInfo)
249
249
  ...vars,
250
250
  tmpl: '', // This removes the .template extension
251
251
  });
252
- updateRuntimeIndexExport(tree, vars.runtimeName__lowerDashCase, vars.visualName__lowerDashCase, typesPackageInfo);
252
+ updateRuntimeIndexExport(tree, vars.runtimeName__lowerDashCase, vars.visualName__lowerDashCase, typesPackageInfo, visualsSubfolder);
253
253
  // Read the processed template content
254
254
  const processedContent = (0, visual_utils_1.readTreeFile)(tree, `${tempDir}/render-method`);
255
255
  // Clean up the temporary file
@@ -267,9 +267,9 @@ function addRenderMethod(sourceFilePath, tree, vars, project, typesPackageInfo)
267
267
  /**
268
268
  * Adds an interface and schema definition to the types/core runtime types file.
269
269
  */
270
- function createVisualTypes(tree, vars, typesPackageInfo) {
270
+ function createVisualTypes(tree, vars, typesPackageInfo, visualsSubfolder) {
271
271
  // Check if the runtime types file already exists
272
- const visualTypesPath = `${typesPackageInfo.basePath}/src/lib/${vars.runtimeName__lowerDashCase}-runtime/${vars.visualName__lowerDashCase}-visual-types.ts`;
272
+ const visualTypesPath = `${typesPackageInfo.basePath}/src/lib/${vars.runtimeName__lowerDashCase}-runtime/${visualsSubfolder}/${vars.visualName__lowerDashCase}-visual-types.ts`;
273
273
  const packageName = typesPackageInfo.hasTypesPackage ? 'types' : 'core';
274
274
  if (tree.exists(visualTypesPath)) {
275
275
  throw new Error(`Visual types file "${vars.visualName__lowerDashCase}-visual-types.ts" already exists in ${packageName} package.\n` +
@@ -342,11 +342,13 @@ async function addVisualGenerator(tree, options) {
342
342
  if (options.flavor) {
343
343
  console.log(`\nProcessing flavor '${options.flavor}'...`);
344
344
  }
345
+ const targetBaseName = path.basename(targetFile, '.tsx');
346
+ const visualsSubfolder = `${targetBaseName}-visuals`;
345
347
  addImportToRuntime(targetFile, tree, templateVariables, project);
346
348
  addVisualTypesToConstructor(targetFile, tree, templateVariables, project, isSingleOccurrence);
347
349
  addSwitchCaseToRuntime(targetFile, tree, templateVariables, project);
348
- addRenderMethod(targetFile, tree, templateVariables, project, typesPackageInfo);
349
- createVisualTypes(tree, templateVariables, typesPackageInfo);
350
+ addRenderMethod(targetFile, tree, templateVariables, project, typesPackageInfo, visualsSubfolder);
351
+ createVisualTypes(tree, templateVariables, typesPackageInfo, visualsSubfolder);
350
352
  await (0, devkit_1.formatFiles)(tree);
351
353
  const flavorSummary = options.flavor ? ` (flavor: ${options.flavor})` : '';
352
354
  console.log(`\nšŸŽ‰ Successfully added visual '${visualName}' to runtime '${runtimeName}'${flavorSummary}!`);
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-analytics-types.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-11-0/migrate-analytics-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAA6C,MAAM,YAAY,CAAC;AAa7E,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA2G9D"}
1
+ {"version":3,"file":"migrate-analytics-types.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-11-0/migrate-analytics-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAA6C,MAAM,YAAY,CAAC;AAa7E,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAgH9D"}
@@ -20,16 +20,17 @@ const RENAMES = {
20
20
  };
21
21
  async function update(tree) {
22
22
  devkit_1.logger.info('šŸ”„ Migrating Kava analytics types to Application Events bucket types...');
23
- const runtimesDir = 'unisphere/runtimes';
24
- if (!tree.exists(runtimesDir)) {
25
- devkit_1.logger.info('ā„¹ļø No runtimes directory found');
23
+ const scanDirs = ['unisphere/runtimes', 'unisphere/packages'];
24
+ const existingDirs = scanDirs.filter((dir) => tree.exists(dir));
25
+ if (existingDirs.length === 0) {
26
+ devkit_1.logger.info('ā„¹ļø No runtimes or packages directory found');
26
27
  return;
27
28
  }
28
29
  const project = new ts_morph_1.Project({
29
30
  manipulationSettings: { quoteKind: ts_morph_1.QuoteKind.Single },
30
31
  });
31
32
  let updatedCount = 0;
32
- (0, devkit_1.visitNotIgnoredFiles)(tree, runtimesDir, (filePath) => {
33
+ const processFile = (filePath) => {
33
34
  if (!filePath.endsWith('.ts') && !filePath.endsWith('.tsx'))
34
35
  return;
35
36
  const content = tree.read(filePath, 'utf-8');
@@ -91,7 +92,10 @@ async function update(tree) {
91
92
  updatedCount++;
92
93
  devkit_1.logger.info(` āœ… Updated ${filePath}`);
93
94
  }
94
- });
95
+ };
96
+ for (const dir of existingDirs) {
97
+ (0, devkit_1.visitNotIgnoredFiles)(tree, dir, processFile);
98
+ }
95
99
  if (updatedCount === 0) {
96
100
  devkit_1.logger.info('ā„¹ļø No files needed analytics type migration');
97
101
  }
package/migrations.json CHANGED
@@ -873,6 +873,21 @@
873
873
  "alwaysAddToPackageJson": false
874
874
  }
875
875
  }
876
+ },
877
+ "4.12.2": {
878
+ "version": "4.12.2",
879
+ "cli": "nx",
880
+ "postUpdateMessage": "šŸŽ‰ Migration to @unisphere/nx 4.12.2 completed successfully!",
881
+ "packages": {
882
+ "@unisphere/cli": {
883
+ "version": "5.2.2",
884
+ "alwaysAddToPackageJson": false
885
+ },
886
+ "@unisphere/runtime-react": {
887
+ "version": "1.87.3",
888
+ "alwaysAddToPackageJson": false
889
+ }
890
+ }
876
891
  }
877
892
  }
878
893
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "4.12.1",
3
+ "version": "4.12.3",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",