@unisphere/nx 4.15.4 → 4.15.5
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.
- package/dist/generators/add-package/templates/new-package/src/languages/README.md +3 -3
- package/dist/generators/add-package/templates/new-package/src/lib/use-translation.tsx.template +1 -1
- package/dist/generators/add-runtime/templates/new-runtime/src/languages/README.md +2 -2
- package/dist/generators/add-runtime/templates/new-runtime/src/lib/use-translation.tsx.template +1 -1
- package/dist/migrations/4-15-5/fix-supported-languages-typo.d.ts +9 -0
- package/dist/migrations/4-15-5/fix-supported-languages-typo.d.ts.map +1 -0
- package/dist/migrations/4-15-5/fix-supported-languages-typo.js +75 -0
- package/migrations.json +8 -0
- package/package.json +1 -1
- /package/dist/generators/add-package/templates/new-package/src/languages/{supported-languges.ts → supported-languages.ts} +0 -0
- /package/dist/generators/add-runtime/templates/new-runtime/src/languages/{supported-languges.ts → supported-languages.ts} +0 -0
|
@@ -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-
|
|
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,7 +18,7 @@ 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-
|
|
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
|
|
|
@@ -27,7 +27,7 @@ languages/
|
|
|
27
27
|
1. Add your translation keys to `en-US.json`
|
|
28
28
|
2. Run `npx unisphere languages export` to generate CSV files for translators
|
|
29
29
|
3. After receiving translations, run `npx unisphere languages import` to update the `files/` directory
|
|
30
|
-
4. Add the new language code to `supported-
|
|
30
|
+
4. Add the new language code to `supported-languages.ts`
|
|
31
31
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
package/dist/generators/add-package/templates/new-package/src/lib/use-translation.tsx.template
CHANGED
|
@@ -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-
|
|
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-
|
|
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,7 +18,7 @@ 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-
|
|
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
|
|
package/dist/generators/add-runtime/templates/new-runtime/src/lib/use-translation.tsx.template
CHANGED
|
@@ -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-
|
|
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
|
+
}
|
package/migrations.json
CHANGED
|
@@ -594,6 +594,14 @@
|
|
|
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
|
+
}
|
|
597
605
|
}
|
|
598
606
|
},
|
|
599
607
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
File without changes
|