@intlayer/cli 7.2.2 → 7.3.0-canary.0
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/README.md +2 -0
- package/dist/cjs/cli.cjs +18 -3
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/fill/fill.cjs +9 -10
- package/dist/cjs/fill/fill.cjs.map +1 -1
- package/dist/cjs/fill/formatFillData.cjs +9 -9
- package/dist/cjs/fill/formatFillData.cjs.map +1 -1
- package/dist/cjs/fill/listTranslationsTasks.cjs +4 -10
- package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
- package/dist/cjs/fill/translateDictionary.cjs +58 -19
- package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
- package/dist/cjs/fill/writeFill.cjs +7 -4
- package/dist/cjs/fill/writeFill.cjs.map +1 -1
- package/dist/cjs/index.cjs +6 -3
- package/dist/cjs/reviewDoc.cjs +5 -3
- package/dist/cjs/reviewDoc.cjs.map +1 -1
- package/dist/cjs/reviewDocBlockAware.cjs +2 -2
- package/dist/cjs/reviewDocBlockAware.cjs.map +1 -1
- package/dist/cjs/test/index.cjs +3 -49
- package/dist/cjs/test/listMissingTranslations.cjs +5 -2
- package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
- package/dist/cjs/test/test.cjs +51 -0
- package/dist/cjs/test/test.cjs.map +1 -0
- package/dist/cjs/transform.cjs +94 -0
- package/dist/cjs/transform.cjs.map +1 -0
- package/dist/cjs/translateDoc.cjs +7 -5
- package/dist/cjs/translateDoc.cjs.map +1 -1
- package/dist/cjs/utils/checkAccess.cjs +12 -1
- package/dist/cjs/utils/checkAccess.cjs.map +1 -1
- package/dist/cjs/utils/chunkInference.cjs +18 -2
- package/dist/cjs/utils/chunkInference.cjs.map +1 -1
- package/dist/cjs/utils/setupAI.cjs +39 -0
- package/dist/cjs/utils/setupAI.cjs.map +1 -0
- package/dist/esm/cli.mjs +16 -1
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/fill/fill.mjs +10 -11
- package/dist/esm/fill/fill.mjs.map +1 -1
- package/dist/esm/fill/formatFillData.mjs +9 -9
- package/dist/esm/fill/formatFillData.mjs.map +1 -1
- package/dist/esm/fill/listTranslationsTasks.mjs +5 -11
- package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
- package/dist/esm/fill/translateDictionary.mjs +59 -20
- package/dist/esm/fill/translateDictionary.mjs.map +1 -1
- package/dist/esm/fill/writeFill.mjs +7 -4
- package/dist/esm/fill/writeFill.mjs.map +1 -1
- package/dist/esm/index.mjs +4 -3
- package/dist/esm/reviewDoc.mjs +5 -3
- package/dist/esm/reviewDoc.mjs.map +1 -1
- package/dist/esm/reviewDocBlockAware.mjs +2 -2
- package/dist/esm/reviewDocBlockAware.mjs.map +1 -1
- package/dist/esm/test/index.mjs +3 -49
- package/dist/esm/test/listMissingTranslations.mjs +5 -3
- package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
- package/dist/esm/test/test.mjs +50 -0
- package/dist/esm/test/test.mjs.map +1 -0
- package/dist/esm/transform.mjs +92 -0
- package/dist/esm/transform.mjs.map +1 -0
- package/dist/esm/translateDoc.mjs +7 -5
- package/dist/esm/translateDoc.mjs.map +1 -1
- package/dist/esm/utils/checkAccess.mjs +13 -2
- package/dist/esm/utils/checkAccess.mjs.map +1 -1
- package/dist/esm/utils/chunkInference.mjs +18 -2
- package/dist/esm/utils/chunkInference.mjs.map +1 -1
- package/dist/esm/utils/setupAI.mjs +38 -0
- package/dist/esm/utils/setupAI.mjs.map +1 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/fill/fill.d.ts.map +1 -1
- package/dist/types/fill/formatFillData.d.ts +1 -1
- package/dist/types/fill/formatFillData.d.ts.map +1 -1
- package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -1
- package/dist/types/fill/translateDictionary.d.ts +4 -0
- package/dist/types/fill/translateDictionary.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/pull.d.ts.map +1 -1
- package/dist/types/push/pullLog.d.ts.map +1 -1
- package/dist/types/reviewDoc.d.ts.map +1 -1
- package/dist/types/reviewDocBlockAware.d.ts +3 -1
- package/dist/types/reviewDocBlockAware.d.ts.map +1 -1
- package/dist/types/test/index.d.ts +3 -12
- package/dist/types/test/listMissingTranslations.d.ts +12 -2
- package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
- package/dist/types/test/test.d.ts +11 -0
- package/dist/types/test/test.d.ts.map +1 -0
- package/dist/types/transform.d.ts +14 -0
- package/dist/types/transform.d.ts.map +1 -0
- package/dist/types/translateDoc.d.ts +3 -2
- package/dist/types/translateDoc.d.ts.map +1 -1
- package/dist/types/utils/checkAccess.d.ts.map +1 -1
- package/dist/types/utils/chunkInference.d.ts +4 -2
- package/dist/types/utils/chunkInference.d.ts.map +1 -1
- package/dist/types/utils/setupAI.d.ts +21 -0
- package/dist/types/utils/setupAI.d.ts.map +1 -0
- package/package.json +12 -10
- package/dist/cjs/test/index.cjs.map +0 -1
- package/dist/esm/test/index.mjs.map +0 -1
- package/dist/types/test/index.d.ts.map +0 -1
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import { Locale } from "@intlayer/types";
|
|
1
|
+
import { IntlayerConfig, Locale } from "@intlayer/types";
|
|
2
2
|
import { GetConfigurationOptions } from "@intlayer/config";
|
|
3
3
|
|
|
4
4
|
//#region src/test/listMissingTranslations.d.ts
|
|
5
|
+
declare const listMissingTranslationsWithConfig: (configuration: IntlayerConfig) => {
|
|
6
|
+
missingTranslations: {
|
|
7
|
+
key: string;
|
|
8
|
+
filePath?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
locales: Locale[];
|
|
11
|
+
}[];
|
|
12
|
+
missingLocales: Locale[];
|
|
13
|
+
missingRequiredLocales: Locale[];
|
|
14
|
+
};
|
|
5
15
|
declare const listMissingTranslations: (configurationOptions?: GetConfigurationOptions) => {
|
|
6
16
|
missingTranslations: {
|
|
7
17
|
key: string;
|
|
@@ -13,5 +23,5 @@ declare const listMissingTranslations: (configurationOptions?: GetConfigurationO
|
|
|
13
23
|
missingRequiredLocales: Locale[];
|
|
14
24
|
};
|
|
15
25
|
//#endregion
|
|
16
|
-
export { listMissingTranslations };
|
|
26
|
+
export { listMissingTranslations, listMissingTranslationsWithConfig };
|
|
17
27
|
//# sourceMappingURL=listMissingTranslations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listMissingTranslations.d.ts","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"sourcesContent":[],"mappings":";;;;cASa,
|
|
1
|
+
{"version":3,"file":"listMissingTranslations.d.ts","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"sourcesContent":[],"mappings":";;;;cASa,mDACI;;IADJ,GAAA,EAAA,MAAA;IACI,QAAA,CAAA,EAAA,MAAA;IASJ,EAAA,CAAA,EAAA,MAAA;aAAA;;;EAmEA,sBAAA,QAMZ,EAAA;CALwB;AApEZ,cAmEA,uBAnEA,EAAA,CAAA,oBAAA,CAAA,EAoEY,uBApEZ,EAAA,GAAA;;;;;aAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GetConfigurationOptions } from "@intlayer/config";
|
|
2
|
+
|
|
3
|
+
//#region src/test/test.d.ts
|
|
4
|
+
type ListMissingTranslationsOptions = {
|
|
5
|
+
configOptions?: GetConfigurationOptions;
|
|
6
|
+
build?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const testMissingTranslations: (options?: ListMissingTranslationsOptions) => Promise<void>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { testMissingTranslations };
|
|
11
|
+
//# sourceMappingURL=test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","names":[],"sources":["../../../src/test/test.ts"],"sourcesContent":[],"mappings":";;;KAaK,8BAAA;kBACa;EADb,KAAA,CAAA,EAAA,OAAA;AAKL,CAAA;cAAa,oCACD,mCAA8B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GetConfigurationOptions } from "@intlayer/config";
|
|
2
|
+
|
|
3
|
+
//#region src/transform.d.ts
|
|
4
|
+
type TransformOptions = {
|
|
5
|
+
files?: string[];
|
|
6
|
+
outputContentDeclarations?: string;
|
|
7
|
+
configOptions?: GetConfigurationOptions;
|
|
8
|
+
codeOnly?: boolean;
|
|
9
|
+
declarationOnly?: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare const transform: (options: TransformOptions) => Promise<void>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { transform };
|
|
14
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","names":[],"sources":["../../src/transform.ts"],"sourcesContent":[],"mappings":";;;KAaK,gBAAA;;EAAA,yBAAgB,CAAA,EAAA,MAGH;EAsBL,aA8GZ,CAAA,EApIiB,uBAsBuB;;;;cAA5B,qBAA4B,qBAAgB"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { AIClient } from "./utils/setupAI.js";
|
|
1
2
|
import { IntlayerConfig, Locale } from "@intlayer/types";
|
|
2
3
|
import { GetConfigurationOptions } from "@intlayer/config";
|
|
3
|
-
import { AIOptions } from "@intlayer/api";
|
|
4
4
|
import { ListGitFilesOptions } from "@intlayer/chokidar";
|
|
5
|
+
import { AIConfig, AIOptions } from "@intlayer/ai";
|
|
5
6
|
|
|
6
7
|
//#region src/translateDoc.d.ts
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Translate a single file for a given locale
|
|
10
11
|
*/
|
|
11
|
-
declare const translateFile: (baseFilePath: string, outputFilePath: string, locale: Locale, baseLocale: Locale, configuration: IntlayerConfig, aiOptions?: AIOptions, customInstructions?: string) => Promise<void>;
|
|
12
|
+
declare const translateFile: (baseFilePath: string, outputFilePath: string, locale: Locale, baseLocale: Locale, configuration: IntlayerConfig, aiOptions?: AIOptions, customInstructions?: string, aiClient?: AIClient, aiConfig?: AIConfig) => Promise<void>;
|
|
12
13
|
type TranslateDocOptions = {
|
|
13
14
|
docPattern: string[];
|
|
14
15
|
locales: Locale[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translateDoc.d.ts","names":[],"sources":["../../src/translateDoc.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translateDoc.d.ts","names":[],"sources":["../../src/translateDoc.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAmCA;AAGU,cAHG,aAGH,EAAA,CAAA,YAAA,EAAA,MAAA,EAAA,cAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,UAAA,EACI,MADJ,EAAA,aAAA,EAEO,cAFP,EAAA,SAAA,CAAA,EAGI,SAHJ,EAAA,kBAAA,CAAA,EAAA,MAAA,EAAA,QAAA,CAAA,EAKG,QALH,EAAA,QAAA,CAAA,EAMG,QANH,EAAA,GAMW,OANX,CAAA,IAAA,CAAA;KAmIL,mBAAA,GAlIS;EACG,UAAA,EAAA,MAAA,EAAA;EACH,OAAA,EAkIH,MAlIG,EAAA;EAED,mBAAA,EAAA,MAAA,EAAA;EACA,UAAA,EAiIC,MAjID;EAAQ,SAAA,CAAA,EAkIP,SAlIO;EAAA,2BAAA,CAAA,EAAA,MAAA;EA6HhB,aAAA,CAAA,EAOa,uBAPM;EAEb,kBAAA,CAAA,EAAA,MAAA;EAEG,oBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAK6B,IAL7B;EACA,mBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAK4B,IAL5B;EAEI,YAAA,CAAA,EAAA,OAAA;EAEyB,UAAA,CAAA,EAG5B,mBAH4B;CACD;;;AAS1C;;AAAmC,cAAtB,YAAsB,EAAA,CAAA;EAAA,UAAA;EAAA,OAAA;EAAA,mBAAA;EAAA,UAAA;EAAA,SAAA;EAAA,2BAAA;EAAA,aAAA;EAAA,kBAAA;EAAA,oBAAA;EAAA,mBAAA;EAAA,YAAA;EAAA;AAAA,CAAA,EAahC,mBAbgC,EAAA,GAab,OAba,CAAA,IAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkAccess.d.ts","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"checkAccess.d.ts","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":[],"mappings":";;;;cAUa,8BACI,mBACd;cAgCU,+BACI,4BACH,cACX"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { AIClient } from "./setupAI.js";
|
|
1
2
|
import { IntlayerConfig } from "@intlayer/types";
|
|
2
|
-
import {
|
|
3
|
+
import { Messages } from "@intlayer/api";
|
|
4
|
+
import { AIConfig, AIOptions as AIOptions$1 } from "@intlayer/ai";
|
|
3
5
|
|
|
4
6
|
//#region src/utils/chunkInference.d.ts
|
|
5
7
|
type ChunkInferenceResult = {
|
|
@@ -10,7 +12,7 @@ type ChunkInferenceResult = {
|
|
|
10
12
|
* Translates a single chunk via the OpenAI API.
|
|
11
13
|
* Includes retry logic if the call fails.
|
|
12
14
|
*/
|
|
13
|
-
declare const chunkInference: (messages: Messages, aiOptions?: AIOptions, configuration?: IntlayerConfig) => Promise<ChunkInferenceResult>;
|
|
15
|
+
declare const chunkInference: (messages: Messages, aiOptions?: AIOptions$1, configuration?: IntlayerConfig, aiClient?: AIClient, aiConfig?: AIConfig) => Promise<ChunkInferenceResult>;
|
|
14
16
|
//#endregion
|
|
15
17
|
export { chunkInference };
|
|
16
18
|
//# sourceMappingURL=chunkInference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunkInference.d.ts","names":[],"sources":["../../../src/utils/chunkInference.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunkInference.d.ts","names":[],"sources":["../../../src/utils/chunkInference.ts"],"sourcesContent":[],"mappings":";;;;;;KAMK,oBAAA;;EAAA,SAAA,EAAA,MAAA;AASL,CAAA;;;;;AAKa,cALA,cAKA,EAAA,CAAA,QAAA,EAJD,QAIC,EAAA,SAAA,CAAA,EAHC,WAGD,EAAA,aAAA,CAAA,EAFK,cAEL,EAAA,QAAA,CAAA,EADA,QACA,EAAA,QAAA,CAAA,EAAA,QAAA,EAAA,GACV,OADU,CACF,oBADE,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IntlayerConfig } from "@intlayer/types";
|
|
2
|
+
import * as _intlayer_ai0 from "@intlayer/ai";
|
|
3
|
+
import { AIConfig, AIOptions } from "@intlayer/ai";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/setupAI.d.ts
|
|
6
|
+
type AIClient = typeof _intlayer_ai0;
|
|
7
|
+
type SetupAIResult = {
|
|
8
|
+
aiClient?: AIClient;
|
|
9
|
+
aiConfig?: AIConfig;
|
|
10
|
+
isCustomAI: boolean;
|
|
11
|
+
hasAIAccess: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Checks if the @intlayer/ai package is available and configured when an API key is provided.
|
|
15
|
+
* If API key is present but package is missing, logs a warning.
|
|
16
|
+
* Also checks if the user has access to AI (either via local key or CMS auth).
|
|
17
|
+
*/
|
|
18
|
+
declare const setupAI: (configuration: IntlayerConfig, aiOptions?: AIOptions) => Promise<SetupAIResult | undefined>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { AIClient, setupAI };
|
|
21
|
+
//# sourceMappingURL=setupAI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupAI.d.ts","names":[],"sources":["../../../src/utils/setupAI.ts"],"sourcesContent":[],"mappings":";;;;;KAKY,QAAA,UAAQ;KAEf,aAAA;aACQ;EAHD,QAAA,CAAA,EAIC,QAJO;EAEf,UAAA,EAAA,OAAa;EAYL,WAgDZ,EAAA,OAAA;CA/CgB;;;;;;cADJ,yBACI,4BACH,cACX,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provides uniform command-line interface scripts for Intlayer, used in packages like intlayer-cli and intlayer.",
|
|
6
6
|
"keywords": [
|
|
@@ -66,19 +66,21 @@
|
|
|
66
66
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@
|
|
70
|
-
"@intlayer/
|
|
71
|
-
"@intlayer/
|
|
72
|
-
"@intlayer/
|
|
73
|
-
"@intlayer/
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"@intlayer/
|
|
69
|
+
"@clack/prompts": "^0.11.0",
|
|
70
|
+
"@intlayer/ai": "7.3.0-canary.0",
|
|
71
|
+
"@intlayer/api": "7.3.0-canary.0",
|
|
72
|
+
"@intlayer/chokidar": "7.3.0-canary.0",
|
|
73
|
+
"@intlayer/config": "7.3.0-canary.0",
|
|
74
|
+
"@intlayer/dictionaries-entry": "7.3.0-canary.0",
|
|
75
|
+
"@intlayer/remote-dictionaries-entry": "7.3.0-canary.0",
|
|
76
|
+
"@intlayer/types": "7.3.0-canary.0",
|
|
77
|
+
"@intlayer/unmerged-dictionaries-entry": "7.3.0-canary.0",
|
|
76
78
|
"commander": "14.0.1",
|
|
77
79
|
"eventsource": "3.0.7",
|
|
78
80
|
"fast-glob": "3.3.3"
|
|
79
81
|
},
|
|
80
82
|
"devDependencies": {
|
|
81
|
-
"@intlayer/core": "7.
|
|
83
|
+
"@intlayer/core": "7.3.0-canary.0",
|
|
82
84
|
"@types/node": "24.10.1",
|
|
83
85
|
"@utils/ts-config": "1.0.4",
|
|
84
86
|
"@utils/ts-config-types": "1.0.4",
|
|
@@ -86,7 +88,7 @@
|
|
|
86
88
|
"rimraf": "6.1.2",
|
|
87
89
|
"tsdown": "0.16.6",
|
|
88
90
|
"typescript": "5.9.3",
|
|
89
|
-
"vitest": "4.0.
|
|
91
|
+
"vitest": "4.0.13"
|
|
90
92
|
},
|
|
91
93
|
"bug": {
|
|
92
94
|
"url": "https://github.com/aymericzip/intlayer/issues"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["listMissingTranslations","ANSIColors"],"sources":["../../../src/test/index.ts"],"sourcesContent":["import { formatLocale, formatPath, prepareIntlayer } from '@intlayer/chokidar';\nimport {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n colorizeNumber,\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { listMissingTranslations } from './listMissingTranslations';\n\nexport { listMissingTranslations };\n\ntype ListMissingTranslationsOptions = {\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\nexport const testMissingTranslations = async (\n options?: ListMissingTranslationsOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n const { locales, requiredLocales } = config.internationalization;\n\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n const result = listMissingTranslations(options?.configOptions);\n\n const maxKeyColSize = result.missingTranslations\n .map((t) => ` - ${t.key}`)\n .reduce((max, t) => Math.max(max, t.length), 0);\n const maxLocalesColSize = result.missingTranslations\n .map((t) => formatLocale(t.locales, false))\n .reduce((max, t) => Math.max(max, t.length), 0);\n\n const formattedMissingTranslations = result.missingTranslations.map(\n (translation) =>\n [\n colon(` - ${colorizeKey(translation.key)}`, {\n colSize: maxKeyColSize,\n maxSize: 40,\n }),\n ' - ',\n colon(formatLocale(translation.locales, ANSIColors.RED), {\n colSize: maxLocalesColSize,\n maxSize: 40,\n }),\n\n translation.filePath ? ` - ${formatPath(translation.filePath)}` : '',\n translation.id ? ' - remote' : '',\n ].join('')\n );\n\n appLogger(`Missing translations:`, {\n level: 'info',\n });\n\n formattedMissingTranslations.forEach((t) => {\n appLogger(t, {\n level: 'info',\n });\n });\n\n appLogger(`Locales: ${formatLocale(locales)}`);\n appLogger(`Required locales: ${formatLocale(requiredLocales ?? locales)}`);\n appLogger(\n `Missing locales: ${result.missingLocales.length === 0 ? colorize('-', ANSIColors.GREEN) : formatLocale(result.missingLocales, ANSIColors.RED)}`\n );\n\n appLogger(\n `Missing required locales: ${result.missingRequiredLocales.length === 0 ? colorize('-', ANSIColors.GREEN) : formatLocale(result.missingRequiredLocales, ANSIColors.RED)}`\n );\n appLogger(\n `Total missing locales: ${colorizeNumber(result.missingLocales.length, {\n one: ANSIColors.RED,\n other: ANSIColors.RED,\n zero: ANSIColors.GREEN,\n })}`\n );\n appLogger(\n `Total missing required locales: ${colorizeNumber(\n result.missingRequiredLocales.length,\n {\n one: ANSIColors.RED,\n other: ANSIColors.RED,\n zero: ANSIColors.GREEN,\n }\n )}`\n );\n};\n"],"mappings":";;;;;;AAoBA,MAAa,0BAA0B,OACrC,YACG;CACH,MAAM,iDAA0B,SAAS,cAAc;CACvD,MAAM,EAAE,SAAS,oBAAoB,OAAO;CAE5C,MAAM,gDAAyB,QAAQ,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAEF,KAAI,SAAS,UAAU,KACrB,gDAAsB,QAAQ,EAAE,UAAU,MAAM,CAAC;UACxC,OAAO,SAAS,UAAU,YACnC,gDAAsB,OAAO;CAG/B,MAAM,SAASA,6DAAwB,SAAS,cAAc;CAE9D,MAAM,gBAAgB,OAAO,oBAC1B,KAAK,MAAM,MAAM,EAAE,MAAM,CACzB,QAAQ,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,OAAO,EAAE,EAAE;CACjD,MAAM,oBAAoB,OAAO,oBAC9B,KAAK,4CAAmB,EAAE,SAAS,MAAM,CAAC,CAC1C,QAAQ,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,OAAO,EAAE,EAAE;CAEjD,MAAM,+BAA+B,OAAO,oBAAoB,KAC7D,gBACC;+BACQ,yCAAkB,YAAY,IAAI,IAAI;GAC1C,SAAS;GACT,SAAS;GACV,CAAC;EACF;qEACmB,YAAY,SAASC,6BAAW,IAAI,EAAE;GACvD,SAAS;GACT,SAAS;GACV,CAAC;EAEF,YAAY,WAAW,0CAAiB,YAAY,SAAS,KAAK;EAClE,YAAY,KAAK,cAAc;EAChC,CAAC,KAAK,GAAG,CACb;AAED,WAAU,yBAAyB,EACjC,OAAO,QACR,CAAC;AAEF,8BAA6B,SAAS,MAAM;AAC1C,YAAU,GAAG,EACX,OAAO,QACR,CAAC;GACF;AAEF,WAAU,kDAAyB,QAAQ,GAAG;AAC9C,WAAU,2DAAkC,mBAAmB,QAAQ,GAAG;AAC1E,WACE,oBAAoB,OAAO,eAAe,WAAW,oCAAa,KAAKA,6BAAW,MAAM,yCAAgB,OAAO,gBAAgBA,6BAAW,IAAI,GAC/I;AAED,WACE,6BAA6B,OAAO,uBAAuB,WAAW,oCAAa,KAAKA,6BAAW,MAAM,yCAAgB,OAAO,wBAAwBA,6BAAW,IAAI,GACxK;AACD,WACE,gEAAyC,OAAO,eAAe,QAAQ;EACrE,KAAKA,6BAAW;EAChB,OAAOA,6BAAW;EAClB,MAAMA,6BAAW;EAClB,CAAC,GACH;AACD,WACE,yEACE,OAAO,uBAAuB,QAC9B;EACE,KAAKA,6BAAW;EAChB,OAAOA,6BAAW;EAClB,MAAMA,6BAAW;EAClB,CACF,GACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/test/index.ts"],"sourcesContent":["import { formatLocale, formatPath, prepareIntlayer } from '@intlayer/chokidar';\nimport {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n colorizeNumber,\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { listMissingTranslations } from './listMissingTranslations';\n\nexport { listMissingTranslations };\n\ntype ListMissingTranslationsOptions = {\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\nexport const testMissingTranslations = async (\n options?: ListMissingTranslationsOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n const { locales, requiredLocales } = config.internationalization;\n\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n const result = listMissingTranslations(options?.configOptions);\n\n const maxKeyColSize = result.missingTranslations\n .map((t) => ` - ${t.key}`)\n .reduce((max, t) => Math.max(max, t.length), 0);\n const maxLocalesColSize = result.missingTranslations\n .map((t) => formatLocale(t.locales, false))\n .reduce((max, t) => Math.max(max, t.length), 0);\n\n const formattedMissingTranslations = result.missingTranslations.map(\n (translation) =>\n [\n colon(` - ${colorizeKey(translation.key)}`, {\n colSize: maxKeyColSize,\n maxSize: 40,\n }),\n ' - ',\n colon(formatLocale(translation.locales, ANSIColors.RED), {\n colSize: maxLocalesColSize,\n maxSize: 40,\n }),\n\n translation.filePath ? ` - ${formatPath(translation.filePath)}` : '',\n translation.id ? ' - remote' : '',\n ].join('')\n );\n\n appLogger(`Missing translations:`, {\n level: 'info',\n });\n\n formattedMissingTranslations.forEach((t) => {\n appLogger(t, {\n level: 'info',\n });\n });\n\n appLogger(`Locales: ${formatLocale(locales)}`);\n appLogger(`Required locales: ${formatLocale(requiredLocales ?? locales)}`);\n appLogger(\n `Missing locales: ${result.missingLocales.length === 0 ? colorize('-', ANSIColors.GREEN) : formatLocale(result.missingLocales, ANSIColors.RED)}`\n );\n\n appLogger(\n `Missing required locales: ${result.missingRequiredLocales.length === 0 ? colorize('-', ANSIColors.GREEN) : formatLocale(result.missingRequiredLocales, ANSIColors.RED)}`\n );\n appLogger(\n `Total missing locales: ${colorizeNumber(result.missingLocales.length, {\n one: ANSIColors.RED,\n other: ANSIColors.RED,\n zero: ANSIColors.GREEN,\n })}`\n );\n appLogger(\n `Total missing required locales: ${colorizeNumber(\n result.missingRequiredLocales.length,\n {\n one: ANSIColors.RED,\n other: ANSIColors.RED,\n zero: ANSIColors.GREEN,\n }\n )}`\n );\n};\n"],"mappings":";;;;;AAoBA,MAAa,0BAA0B,OACrC,YACG;CACH,MAAM,SAAS,iBAAiB,SAAS,cAAc;CACvD,MAAM,EAAE,SAAS,oBAAoB,OAAO;CAE5C,MAAM,YAAY,aAAa,QAAQ,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAEF,KAAI,SAAS,UAAU,KACrB,OAAM,gBAAgB,QAAQ,EAAE,UAAU,MAAM,CAAC;UACxC,OAAO,SAAS,UAAU,YACnC,OAAM,gBAAgB,OAAO;CAG/B,MAAM,SAAS,wBAAwB,SAAS,cAAc;CAE9D,MAAM,gBAAgB,OAAO,oBAC1B,KAAK,MAAM,MAAM,EAAE,MAAM,CACzB,QAAQ,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,OAAO,EAAE,EAAE;CACjD,MAAM,oBAAoB,OAAO,oBAC9B,KAAK,MAAM,aAAa,EAAE,SAAS,MAAM,CAAC,CAC1C,QAAQ,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,OAAO,EAAE,EAAE;CAEjD,MAAM,+BAA+B,OAAO,oBAAoB,KAC7D,gBACC;EACE,MAAM,MAAM,YAAY,YAAY,IAAI,IAAI;GAC1C,SAAS;GACT,SAAS;GACV,CAAC;EACF;EACA,MAAM,aAAa,YAAY,SAAS,WAAW,IAAI,EAAE;GACvD,SAAS;GACT,SAAS;GACV,CAAC;EAEF,YAAY,WAAW,MAAM,WAAW,YAAY,SAAS,KAAK;EAClE,YAAY,KAAK,cAAc;EAChC,CAAC,KAAK,GAAG,CACb;AAED,WAAU,yBAAyB,EACjC,OAAO,QACR,CAAC;AAEF,8BAA6B,SAAS,MAAM;AAC1C,YAAU,GAAG,EACX,OAAO,QACR,CAAC;GACF;AAEF,WAAU,YAAY,aAAa,QAAQ,GAAG;AAC9C,WAAU,qBAAqB,aAAa,mBAAmB,QAAQ,GAAG;AAC1E,WACE,oBAAoB,OAAO,eAAe,WAAW,IAAI,SAAS,KAAK,WAAW,MAAM,GAAG,aAAa,OAAO,gBAAgB,WAAW,IAAI,GAC/I;AAED,WACE,6BAA6B,OAAO,uBAAuB,WAAW,IAAI,SAAS,KAAK,WAAW,MAAM,GAAG,aAAa,OAAO,wBAAwB,WAAW,IAAI,GACxK;AACD,WACE,0BAA0B,eAAe,OAAO,eAAe,QAAQ;EACrE,KAAK,WAAW;EAChB,OAAO,WAAW;EAClB,MAAM,WAAW;EAClB,CAAC,GACH;AACD,WACE,mCAAmC,eACjC,OAAO,uBAAuB,QAC9B;EACE,KAAK,WAAW;EAChB,OAAO,WAAW;EAClB,MAAM,WAAW;EAClB,CACF,GACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/test/index.ts"],"sourcesContent":[],"mappings":";;;;KAeK,8BAAA;EAAA,aAAA,CAAA,EACa,uBADiB;EAKtB,KAAA,CAAA,EAAA,OAAA;;cAAA,oCACD,mCAA8B"}
|