i18next-cli 1.42.6 → 1.42.8
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/cjs/cli.js +14 -14
- package/dist/cjs/config.js +4 -4
- package/dist/cjs/extractor/core/extractor.js +11 -11
- package/dist/cjs/extractor/core/translation-manager.js +14 -0
- package/dist/cjs/linter.js +26 -7
- package/dist/cjs/locize.js +18 -18
- package/dist/cjs/rename-key.js +3 -3
- package/dist/cjs/status.js +25 -20
- package/dist/cjs/syncer.js +11 -11
- package/dist/cjs/types-generator.js +6 -6
- package/dist/esm/cli.js +14 -14
- package/dist/esm/config.js +4 -4
- package/dist/esm/extractor/core/extractor.js +11 -11
- package/dist/esm/extractor/core/translation-manager.js +14 -0
- package/dist/esm/linter.js +26 -7
- package/dist/esm/locize.js +18 -18
- package/dist/esm/rename-key.js +3 -3
- package/dist/esm/status.js +25 -20
- package/dist/esm/syncer.js +11 -11
- package/dist/esm/types-generator.js +6 -6
- package/package.json +2 -5
- package/types/extractor/core/translation-manager.d.ts.map +1 -1
- package/types/linter.d.ts.map +1 -1
package/dist/esm/syncer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { styleText } from 'node:util';
|
|
2
2
|
import { glob } from 'glob';
|
|
3
3
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { basename, resolve, dirname } from 'node:path';
|
|
@@ -73,7 +73,7 @@ async function runSyncer(config, options = {}) {
|
|
|
73
73
|
continue;
|
|
74
74
|
const primaryTranslations = await loadTranslationFile(primaryPath);
|
|
75
75
|
if (!primaryTranslations) {
|
|
76
|
-
logMessages.push(` ${
|
|
76
|
+
logMessages.push(` ${styleText('yellow', '-')} Could not read primary file: ${primaryPath}`);
|
|
77
77
|
continue;
|
|
78
78
|
}
|
|
79
79
|
const primaryKeys = getNestedKeys(primaryTranslations, keySeparator ?? '.');
|
|
@@ -100,27 +100,27 @@ async function runSyncer(config, options = {}) {
|
|
|
100
100
|
const serializedContent = serializeTranslationFile(newSecondaryTranslations, perFileFormat, indentation, raw);
|
|
101
101
|
await mkdir(dirname(fullSecondaryPath), { recursive: true });
|
|
102
102
|
await writeFile(fullSecondaryPath, serializedContent);
|
|
103
|
-
logMessages.push(` ${
|
|
103
|
+
logMessages.push(` ${styleText('green', '✓')} Synchronized: ${secondaryPath}`);
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
logMessages.push(` ${
|
|
106
|
+
logMessages.push(` ${styleText('gray', '-')} Already in sync: ${secondaryPath}`);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
spinner.succeed(
|
|
110
|
+
spinner.succeed(styleText('bold', 'Synchronization complete!'));
|
|
111
111
|
logMessages.forEach(msg => internalLogger.info ? internalLogger.info(msg) : console.log(msg));
|
|
112
112
|
if (wasAnythingSynced) {
|
|
113
113
|
await printLocizeFunnel();
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
116
|
if (typeof internalLogger.info === 'function')
|
|
117
|
-
internalLogger.info(
|
|
117
|
+
internalLogger.info(styleText(['green', 'bold'], '\n✅ All locales are already in sync.'));
|
|
118
118
|
else
|
|
119
|
-
console.log(
|
|
119
|
+
console.log(styleText(['green', 'bold'], '\n✅ All locales are already in sync.'));
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
catch (error) {
|
|
123
|
-
spinner.fail(
|
|
123
|
+
spinner.fail(styleText('red', 'Synchronization failed.'));
|
|
124
124
|
if (typeof internalLogger.error === 'function')
|
|
125
125
|
internalLogger.error(error);
|
|
126
126
|
else
|
|
@@ -130,9 +130,9 @@ async function runSyncer(config, options = {}) {
|
|
|
130
130
|
async function printLocizeFunnel() {
|
|
131
131
|
if (!(await shouldShowFunnel('syncer')))
|
|
132
132
|
return;
|
|
133
|
-
console.log(
|
|
134
|
-
console.log(
|
|
135
|
-
console.log(` Get started with the official TMS for i18next: ${
|
|
133
|
+
console.log(styleText(['green', 'bold'], '\n✅ Sync complete.'));
|
|
134
|
+
console.log(styleText('yellow', '🚀 Ready to collaborate with translators? Move your files to the cloud.'));
|
|
135
|
+
console.log(` Get started with the official TMS for i18next: ${styleText('cyan', 'npx i18next-cli locize-migrate')}`);
|
|
136
136
|
return recordFunnelShown('syncer');
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -2,7 +2,7 @@ import { ConsoleLogger } from './utils/logger.js';
|
|
|
2
2
|
import { mergeResourcesAsInterface } from 'i18next-resources-for-ts';
|
|
3
3
|
import { glob } from 'glob';
|
|
4
4
|
import { createSpinnerLike } from './utils/wrap-ora.js';
|
|
5
|
-
import
|
|
5
|
+
import { styleText } from 'node:util';
|
|
6
6
|
import { mkdir, writeFile, access, readFile } from 'node:fs/promises';
|
|
7
7
|
import { join, dirname, basename, extname, resolve, relative } from 'node:path';
|
|
8
8
|
import { transform } from '@swc/core';
|
|
@@ -109,7 +109,7 @@ async function runTypesGenerator(config, options = {}) {
|
|
|
109
109
|
}
|
|
110
110
|
const nonObjectKeys = keys.filter(k => !parsedContent[k] || typeof parsedContent[k] !== 'object');
|
|
111
111
|
if (nonObjectKeys.length > 0) {
|
|
112
|
-
console.warn(
|
|
112
|
+
console.warn(styleText('yellow', `Warning: The file ${file} contains top-level keys that are not objects (${nonObjectKeys.join(', ')}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`));
|
|
113
113
|
}
|
|
114
114
|
continue;
|
|
115
115
|
}
|
|
@@ -125,7 +125,7 @@ ${mergeResourcesAsInterface(resources, { optimize: !!enableSelector, indentation
|
|
|
125
125
|
const resourcesOutputPath = resolve(process.cwd(), config.types.resourcesFile);
|
|
126
126
|
await mkdir(dirname(resourcesOutputPath), { recursive: true });
|
|
127
127
|
await writeFile(resourcesOutputPath, interfaceDefinition);
|
|
128
|
-
logMessages.push(` ${
|
|
128
|
+
logMessages.push(` ${styleText('green', '✓')} Resources interface written to ${config.types.resourcesFile}`);
|
|
129
129
|
let outputPathExists;
|
|
130
130
|
try {
|
|
131
131
|
await access(outputPath);
|
|
@@ -152,13 +152,13 @@ declare module 'i18next' {
|
|
|
152
152
|
}`;
|
|
153
153
|
await mkdir(dirname(outputPath), { recursive: true });
|
|
154
154
|
await writeFile(outputPath, fileContent);
|
|
155
|
-
logMessages.push(` ${
|
|
155
|
+
logMessages.push(` ${styleText('green', '✓')} TypeScript definitions written to ${config.types.output || ''}`);
|
|
156
156
|
}
|
|
157
|
-
spinner.succeed(
|
|
157
|
+
spinner.succeed(styleText('bold', 'TypeScript definitions generated successfully.'));
|
|
158
158
|
logMessages.forEach(msg => typeof internalLogger.info === 'function' ? internalLogger.info(msg) : console.log(msg));
|
|
159
159
|
}
|
|
160
160
|
catch (error) {
|
|
161
|
-
spinner.fail(
|
|
161
|
+
spinner.fail(styleText('red', 'Failed to generate TypeScript definitions.'));
|
|
162
162
|
if (typeof internalLogger.error === 'function')
|
|
163
163
|
internalLogger.error(error);
|
|
164
164
|
else
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18next-cli",
|
|
3
|
-
"version": "1.42.
|
|
3
|
+
"version": "1.42.8",
|
|
4
4
|
"description": "A unified, high-performance i18next CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"memfs": "4.56.10",
|
|
64
64
|
"neostandard": "0.12.2",
|
|
65
65
|
"rollup-plugin-typescript2": "0.36.0",
|
|
66
|
-
"ts-node": "10.9.2",
|
|
67
66
|
"typescript": "5.9.3",
|
|
68
67
|
"unplugin-swc": "1.5.9",
|
|
69
68
|
"vitest": "4.0.18"
|
|
@@ -72,7 +71,6 @@
|
|
|
72
71
|
"@croct/json5-parser": "0.2.2",
|
|
73
72
|
"@swc/core": "1.15.11",
|
|
74
73
|
"yaml": "2.8.2",
|
|
75
|
-
"chalk": "5.6.2",
|
|
76
74
|
"chokidar": "5.0.0",
|
|
77
75
|
"commander": "14.0.3",
|
|
78
76
|
"execa": "9.6.1",
|
|
@@ -84,7 +82,6 @@
|
|
|
84
82
|
"minimatch": "10.1.2",
|
|
85
83
|
"ora": "9.3.0",
|
|
86
84
|
"react": "^19.2.4",
|
|
87
|
-
"react-i18next": "^16.5.4"
|
|
88
|
-
"swc-walk": "1.0.1"
|
|
85
|
+
"react-i18next": "^16.5.4"
|
|
89
86
|
}
|
|
90
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAgyBnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,oBAAoB,EAC5B,EACE,uBAA+B,EAC/B,OAAe,EAChB,GAAE;IACD,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAA;CACb,GACL,OAAO,CAAC,iBAAiB,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAgyBnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,oBAAoB,EAC5B,EACE,uBAA+B,EAC/B,OAAe,EAChB,GAAE;IACD,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAA;CACb,GACL,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAoK9B"}
|
package/types/linter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../src/linter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../src/linter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AA8J3D,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE;QAAC;YACT,OAAO,EAAE,MAAM,CAAC;SACjB;KAAC,CAAC;IACH,IAAI,EAAE;QAAC;YACL,OAAO,EAAE,OAAO,CAAC;YACjB,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;SAC1C;KAAC,CAAC;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;CACvB,CAAA;AAED,eAAO,MAAM,uBAAuB,UAET,CAAA;AAC3B,eAAO,MAAM,6BAA6B,UAAgN,CAAA;AAK1P,qBAAa,MAAO,SAAQ,YAAY,CAAC,cAAc,CAAC;IACtD,OAAO,CAAC,MAAM,CAAsB;gBAEvB,MAAM,EAAE,oBAAoB;IAKzC,SAAS,CAAE,KAAK,EAAE,OAAO;IAanB,GAAG;;;;;;;CA6FV;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,SAAS,CAAE,MAAM,EAAE,oBAAoB;;;;;;GAE5D;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,iBAkCnD;AAED;;GAEG;AACH,UAAU,eAAe;IACvB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,+GAA+G;IAC/G,IAAI,CAAC,EAAE,WAAW,GAAG,eAAe,CAAC;CACtC"}
|