@unisphere/nx 4.15.4 → 4.15.6

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.
@@ -7,7 +7,7 @@ This folder contains the internationalization (i18n) setup for this package.
7
7
  ```
8
8
  languages/
9
9
  ├── en-US.json # Default English translations (source of truth)
10
- ├── supported-languges.ts # List of supported language codes
10
+ ├── supported-languages.ts # List of supported language codes
11
11
  ├── files/ # Translated language files (e.g., de-DE.json, fr-FR.json)
12
12
  │ └── .gitkeep
13
13
  ├── _db/ # Translation database for change tracking (git-ignored)
@@ -18,16 +18,32 @@ languages/
18
18
  ## How It Works
19
19
 
20
20
  - **`en-US.json`** — The master translation file. All keys are defined here in English.
21
- - **`supported-languges.ts`** — Exports the list of supported language codes. Add new languages here when translations are available.
21
+ - **`supported-languages.ts`** — Exports the list of supported language codes. Add new languages here when translations are available.
22
22
  - **`files/`** — Contains translated JSON files for each supported language (excluding en-US). These are generated via the Unisphere CLI export/import workflow.
23
23
  - **`_db/`** — Used internally by the CLI to track translation changes between exports. Do not commit.
24
24
 
25
+ ## Adding a New Language
26
+
27
+ To add support for a new language, run:
28
+
29
+ ```bash
30
+ npx unisphere language add <language-COUNTRY>
31
+ ```
32
+
33
+ For example, to add Hebrew:
34
+
35
+ ```bash
36
+ npx unisphere language add he-IL
37
+ ```
38
+
39
+ This will set up the language files and update `supported-languages.ts` automatically.
40
+
25
41
  ## Adding Translations
26
42
 
27
43
  1. Add your translation keys to `en-US.json`
28
44
  2. Run `npx unisphere languages export` to generate CSV files for translators
29
45
  3. After receiving translations, run `npx unisphere languages import` to update the `files/` directory
30
- 4. Add the new language code to `supported-languges.ts`
46
+ 4. Add the new language code to `supported-languages.ts`
31
47
 
32
48
  ## Usage
33
49
 
@@ -1,6 +1,6 @@
1
1
  import en from '../languages/en-US.json';
2
2
  import { createUseTranslation } from '@unisphere/ui-i18n-react';
3
- import { supportedLanguages } from '../languages/supported-languges';
3
+ import { supportedLanguages } from '../languages/supported-languages';
4
4
 
5
5
  export const useTranslation = createUseTranslation({
6
6
  packageName: '<%= packageJsonName %>',
@@ -7,7 +7,7 @@ This folder contains the internationalization (i18n) setup for this runtime.
7
7
  ```
8
8
  languages/
9
9
  ├── en-US.json # Default English translations (source of truth)
10
- ├── supported-languges.ts # List of supported language codes
10
+ ├── supported-languages.ts # List of supported language codes
11
11
  ├── files/ # Translated language files (e.g., de-DE.json, fr-FR.json)
12
12
  │ └── .gitkeep
13
13
  ├── _db/ # Translation database for change tracking (git-ignored)
@@ -18,10 +18,26 @@ languages/
18
18
  ## How It Works
19
19
 
20
20
  - **`en-US.json`** — The master translation file. All keys are defined here in English.
21
- - **`supported-languges.ts`** — Exports the list of supported language codes. Add new languages here when translations are available.
21
+ - **`supported-languages.ts`** — Exports the list of supported language codes. Add new languages here when translations are available.
22
22
  - **`files/`** — Contains translated JSON files for each supported language (excluding en-US). These are generated via the Unisphere CLI export/import workflow.
23
23
  - **`_db/`** — Used internally by the CLI to track translation changes between exports. Do not commit.
24
24
 
25
+ ## Adding a New Language
26
+
27
+ To add support for a new language, run:
28
+
29
+ ```bash
30
+ npx unisphere language add <language-COUNTRY>
31
+ ```
32
+
33
+ For example, to add Hebrew:
34
+
35
+ ```bash
36
+ npx unisphere language add he-IL
37
+ ```
38
+
39
+ This will set up the language files and update `supported-languages.ts` automatically.
40
+
25
41
  ## CLI Commands
26
42
 
27
43
  ```bash
@@ -1,6 +1,6 @@
1
1
  import en from '../languages/en-US.json';
2
2
  import { createUseTranslation } from '@unisphere/ui-i18n-react';
3
- import { supportedLanguages } from '../languages/supported-languges';
3
+ import { supportedLanguages } from '../languages/supported-languages';
4
4
 
5
5
  export const useTranslation = createUseTranslation({
6
6
  packageName: 'self',
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Migration: Fix supported-languges.ts typo
3
+ *
4
+ * Renames supported-languges.ts to supported-languages.ts (fixes missing "a")
5
+ * and updates all imports that reference the old filename.
6
+ */
7
+ import { Tree } from '@nx/devkit';
8
+ export default function update(tree: Tree): Promise<void>;
9
+ //# sourceMappingURL=fix-supported-languages-typo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-supported-languages-typo.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-15-5/fix-supported-languages-typo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAuD,MAAM,YAAY,CAAC;AAcvF,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA4E9D"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ /**
3
+ * Migration: Fix supported-languges.ts typo
4
+ *
5
+ * Renames supported-languges.ts to supported-languages.ts (fixes missing "a")
6
+ * and updates all imports that reference the old filename.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = update;
10
+ const devkit_1 = require("@nx/devkit");
11
+ const TYPO_FILENAME = 'supported-languges.ts';
12
+ const FIXED_FILENAME = 'supported-languages.ts';
13
+ const TYPO_IMPORT = 'supported-languges';
14
+ const FIXED_IMPORT = 'supported-languages';
15
+ async function update(tree) {
16
+ devkit_1.logger.info('🔄 Fixing supported-languges.ts typo...');
17
+ if (!tree.exists('.unisphere')) {
18
+ devkit_1.logger.info('ℹ️ No .unisphere config found, skipping');
19
+ return;
20
+ }
21
+ const config = (0, devkit_1.readJson)(tree, '.unisphere');
22
+ const packages = config.elements?.packages || {};
23
+ const runtimes = config.elements?.runtimes || {};
24
+ let fixedCount = 0;
25
+ // Process all packages and runtimes
26
+ const allElements = [
27
+ ...Object.entries(packages).map(([name, cfg]) => ({ name, sourceRoot: cfg.sourceRoot })),
28
+ ...Object.entries(runtimes).map(([name, cfg]) => ({ name, sourceRoot: cfg.sourceRoot })),
29
+ ];
30
+ for (const element of allElements) {
31
+ const { name, sourceRoot } = element;
32
+ const typoPath = `${sourceRoot}/src/languages/${TYPO_FILENAME}`;
33
+ const fixedPath = `${sourceRoot}/src/languages/${FIXED_FILENAME}`;
34
+ // Step 1: Rename the file if it exists with the typo
35
+ if (tree.exists(typoPath)) {
36
+ const content = tree.read(typoPath, 'utf-8');
37
+ tree.write(fixedPath, content || '');
38
+ tree.delete(typoPath);
39
+ devkit_1.logger.info(` ✅ Renamed ${TYPO_FILENAME} → ${FIXED_FILENAME} in ${name}`);
40
+ fixedCount++;
41
+ }
42
+ else if (!tree.exists(fixedPath)) {
43
+ // Neither exists, skip this element
44
+ continue;
45
+ }
46
+ // Step 2: Update imports in all .ts/.tsx files under this element
47
+ (0, devkit_1.visitNotIgnoredFiles)(tree, sourceRoot, (filePath) => {
48
+ if (!filePath.endsWith('.ts') && !filePath.endsWith('.tsx')) {
49
+ return;
50
+ }
51
+ const content = tree.read(filePath, 'utf-8');
52
+ if (!content || !content.includes(TYPO_IMPORT)) {
53
+ return;
54
+ }
55
+ const updatedContent = content.replace(new RegExp(TYPO_IMPORT, 'g'), FIXED_IMPORT);
56
+ tree.write(filePath, updatedContent);
57
+ });
58
+ // Step 3: Update README.md if it references the typo
59
+ const readmePath = `${sourceRoot}/src/languages/README.md`;
60
+ if (tree.exists(readmePath)) {
61
+ const readmeContent = tree.read(readmePath, 'utf-8');
62
+ if (readmeContent && readmeContent.includes(TYPO_IMPORT)) {
63
+ const updatedReadme = readmeContent.replace(new RegExp(TYPO_IMPORT, 'g'), FIXED_IMPORT);
64
+ tree.write(readmePath, updatedReadme);
65
+ }
66
+ }
67
+ }
68
+ await (0, devkit_1.formatFiles)(tree);
69
+ if (fixedCount > 0) {
70
+ devkit_1.logger.info(`✅ Fixed typo in ${fixedCount} element(s)`);
71
+ }
72
+ else {
73
+ devkit_1.logger.info('ℹ️ No elements with the typo found (already fixed or not applicable)');
74
+ }
75
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Migration: Move @unisphere/nx to devDependencies
3
+ *
4
+ * @unisphere/nx is a build/development tool (Nx plugin with generators and
5
+ * migrations) and should not be in production dependencies. This migration
6
+ * moves it from dependencies to devDependencies, preserving the existing version.
7
+ */
8
+ import { Tree } from '@nx/devkit';
9
+ export default function update(tree: Tree): Promise<void>;
10
+ //# sourceMappingURL=move-nx-to-dev-dependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-nx-to-dev-dependencies.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-15-6/move-nx-to-dev-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAsB,MAAM,YAAY,CAAC;AAItD,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC9D"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * Migration: Move @unisphere/nx to devDependencies
4
+ *
5
+ * @unisphere/nx is a build/development tool (Nx plugin with generators and
6
+ * migrations) and should not be in production dependencies. This migration
7
+ * moves it from dependencies to devDependencies, preserving the existing version.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.default = update;
11
+ const devkit_1 = require("@nx/devkit");
12
+ const TARGET_PACKAGE = '@unisphere/nx';
13
+ async function update(tree) {
14
+ devkit_1.logger.info('🔄 Moving @unisphere/nx to devDependencies...');
15
+ const packageJsonPath = 'package.json';
16
+ if (!tree.exists(packageJsonPath)) {
17
+ devkit_1.logger.warn('⚠️ No package.json found, skipping');
18
+ return;
19
+ }
20
+ let moved = false;
21
+ (0, devkit_1.updateJson)(tree, packageJsonPath, (packageJson) => {
22
+ // If it's in dependencies, move it to devDependencies
23
+ if (packageJson.dependencies?.[TARGET_PACKAGE]) {
24
+ const version = packageJson.dependencies[TARGET_PACKAGE];
25
+ // Ensure devDependencies exists
26
+ if (!packageJson.devDependencies) {
27
+ packageJson.devDependencies = {};
28
+ }
29
+ // Move to devDependencies (preserve version)
30
+ packageJson.devDependencies[TARGET_PACKAGE] = version;
31
+ delete packageJson.dependencies[TARGET_PACKAGE];
32
+ moved = true;
33
+ devkit_1.logger.info(`📦 Moved ${TARGET_PACKAGE}@${version} from dependencies to devDependencies`);
34
+ }
35
+ return packageJson;
36
+ });
37
+ if (!moved) {
38
+ devkit_1.logger.info(`ℹ️ ${TARGET_PACKAGE} is not in dependencies (already in devDependencies or not present)`);
39
+ }
40
+ devkit_1.logger.info('✅ @unisphere/nx placement verified');
41
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Migration: Update languages README with "Adding a New Language" section
3
+ *
4
+ * Adds instructions for `npx unisphere language add <language-COUNTRY>`
5
+ * to all existing languages/README.md files.
6
+ */
7
+ import { Tree } from '@nx/devkit';
8
+ export default function update(tree: Tree): Promise<void>;
9
+ //# sourceMappingURL=update-languages-readme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-languages-readme.d.ts","sourceRoot":"","sources":["../../../src/migrations/4-15-6/update-languages-readme.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAoB,MAAM,YAAY,CAAC;AA2BpD,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAwD9D"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ /**
3
+ * Migration: Update languages README with "Adding a New Language" section
4
+ *
5
+ * Adds instructions for `npx unisphere language add <language-COUNTRY>`
6
+ * to all existing languages/README.md files.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = update;
10
+ const devkit_1 = require("@nx/devkit");
11
+ const NEW_SECTION = `## Adding a New Language
12
+
13
+ To add support for a new language, run:
14
+
15
+ \`\`\`bash
16
+ npx unisphere language add <language-COUNTRY>
17
+ \`\`\`
18
+
19
+ For example, to add Hebrew:
20
+
21
+ \`\`\`bash
22
+ npx unisphere language add he-IL
23
+ \`\`\`
24
+
25
+ This will set up the language files and update \`supported-languages.ts\` automatically.
26
+
27
+ `;
28
+ async function update(tree) {
29
+ devkit_1.logger.info('🔄 Updating languages README files...');
30
+ if (!tree.exists('.unisphere')) {
31
+ devkit_1.logger.info('ℹ️ No .unisphere config found, skipping');
32
+ return;
33
+ }
34
+ const config = (0, devkit_1.readJson)(tree, '.unisphere');
35
+ const packages = config.elements?.packages || {};
36
+ const runtimes = config.elements?.runtimes || {};
37
+ let updatedCount = 0;
38
+ const allElements = [
39
+ ...Object.entries(packages).map(([name, cfg]) => ({ name, sourceRoot: cfg.sourceRoot })),
40
+ ...Object.entries(runtimes).map(([name, cfg]) => ({ name, sourceRoot: cfg.sourceRoot })),
41
+ ];
42
+ for (const element of allElements) {
43
+ const readmePath = `${element.sourceRoot}/src/languages/README.md`;
44
+ if (!tree.exists(readmePath)) {
45
+ continue;
46
+ }
47
+ const content = tree.read(readmePath, 'utf-8');
48
+ if (!content) {
49
+ continue;
50
+ }
51
+ // Skip if already has the section
52
+ if (content.includes('npx unisphere language add')) {
53
+ continue;
54
+ }
55
+ // Insert before "## CLI Commands" or "## Adding Translations"
56
+ let updatedContent;
57
+ if (content.includes('## Adding Translations')) {
58
+ updatedContent = content.replace('## Adding Translations', NEW_SECTION + '## Adding Translations');
59
+ }
60
+ else if (content.includes('## CLI Commands')) {
61
+ updatedContent = content.replace('## CLI Commands', NEW_SECTION + '## CLI Commands');
62
+ }
63
+ else {
64
+ // Append at the end
65
+ updatedContent = content + '\n' + NEW_SECTION;
66
+ }
67
+ tree.write(readmePath, updatedContent);
68
+ updatedCount++;
69
+ }
70
+ if (updatedCount > 0) {
71
+ devkit_1.logger.info(`✅ Updated ${updatedCount} languages README file(s)`);
72
+ }
73
+ else {
74
+ devkit_1.logger.info('ℹ️ No README files needed updating');
75
+ }
76
+ }
package/migrations.json CHANGED
@@ -594,6 +594,30 @@
594
594
  "cli": {
595
595
  "postUpdateMessage": "✅ @unisphere/cli moved to devDependencies"
596
596
  }
597
+ },
598
+ "4.15.5-fix-supported-languages-typo": {
599
+ "version": "4.15.5",
600
+ "description": "Fixes typo in supported-languges.ts filename (renames to supported-languages.ts) and updates imports",
601
+ "factory": "./dist/migrations/4-15-5/fix-supported-languages-typo.js",
602
+ "cli": {
603
+ "postUpdateMessage": "✅ Fixed supported-languges.ts typo (renamed to supported-languages.ts)"
604
+ }
605
+ },
606
+ "4.15.6-move-nx-to-dev-dependencies": {
607
+ "version": "4.15.6",
608
+ "description": "Moves @unisphere/nx from dependencies to devDependencies (build tool, not production dependency)",
609
+ "factory": "./dist/migrations/4-15-6/move-nx-to-dev-dependencies.js",
610
+ "cli": {
611
+ "postUpdateMessage": "✅ @unisphere/nx moved to devDependencies"
612
+ }
613
+ },
614
+ "4.15.6-update-languages-readme": {
615
+ "version": "4.15.6",
616
+ "description": "Adds 'Adding a New Language' instructions to languages README files",
617
+ "factory": "./dist/migrations/4-15-6/update-languages-readme.js",
618
+ "cli": {
619
+ "postUpdateMessage": "✅ Languages README files updated with 'npx unisphere language add' instructions"
620
+ }
597
621
  }
598
622
  },
599
623
  "packageJsonUpdates": {
@@ -1130,10 +1154,10 @@
1130
1154
  }
1131
1155
  }
1132
1156
  },
1133
- "4.15.4": {
1134
- "version": "4.15.4",
1157
+ "4.15.6": {
1158
+ "version": "4.15.6",
1135
1159
  "cli": "nx",
1136
- "postUpdateMessage": "🎉 Migration to @unisphere/nx 4.15.4 completed successfully!",
1160
+ "postUpdateMessage": "🎉 Migration to @unisphere/nx 4.15.6 completed successfully!",
1137
1161
  "packages": {
1138
1162
  "@unisphere/cli": {
1139
1163
  "version": "6.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "4.15.4",
3
+ "version": "4.15.6",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",