@transi-store/cli 1.5.1 → 1.5.2
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/CHANGELOG.md +6 -0
- package/dist/cli.js +16 -10
- package/dist/fetchTranslations.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -38,6 +38,7 @@ const schema = z.object({
|
|
|
38
38
|
});
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/fetchTranslations.ts
|
|
41
|
+
const CONCURRENCY_CALLS = 5;
|
|
41
42
|
async function fetchTranslations({ domainRoot, apiKey, org, project, format, locale, output, branch }) {
|
|
42
43
|
const params = new URLSearchParams({
|
|
43
44
|
format,
|
|
@@ -82,16 +83,21 @@ async function fetchForConfig(configPath, apiKey, branch) {
|
|
|
82
83
|
}
|
|
83
84
|
const domainRoot = result.data.domainRoot ?? "https://transi-store.com";
|
|
84
85
|
console.log(`Fetching translations from domain "${domainRoot}" for org "${result.data.org}"...`);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
const tasks = [];
|
|
87
|
+
for (const configItem of result.data.projects) for (const locale of configItem.langs) {
|
|
88
|
+
const options = {
|
|
89
|
+
domainRoot,
|
|
90
|
+
apiKey,
|
|
91
|
+
org: result.data.org,
|
|
92
|
+
project: configItem.project,
|
|
93
|
+
format: configItem.format,
|
|
94
|
+
locale,
|
|
95
|
+
output: configItem.output.replace("<lang>", locale).replace("<project>", configItem.project).replace("<format>", configItem.format),
|
|
96
|
+
branch
|
|
97
|
+
};
|
|
98
|
+
tasks.push(options);
|
|
99
|
+
}
|
|
100
|
+
for (let i = 0; i < tasks.length; i += CONCURRENCY_CALLS) await Promise.all(tasks.slice(i, i + CONCURRENCY_CALLS).map(fetchTranslations));
|
|
95
101
|
}
|
|
96
102
|
//#endregion
|
|
97
103
|
//#region src/git.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchTranslations.d.ts","sourceRoot":"","sources":["../src/fetchTranslations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchTranslations.d.ts","sourceRoot":"","sources":["../src/fetchTranslations.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,MAAM,GAAG;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,EACtC,UAAU,EACV,MAAM,EACN,GAAG,EACH,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,GACP,EAAE,MAAM,iBA+CR;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAsDf"}
|