@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.5.2
4
+
5
+ ### Fixed
6
+
7
+ - Limit http calls with cli #108
8
+
3
9
  ## 1.5.1
4
10
 
5
11
  ### Fixed
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
- for (const configItem of result.data.projects) for (const locale of configItem.langs) fetchTranslations({
86
- domainRoot,
87
- apiKey,
88
- org: result.data.org,
89
- project: configItem.project,
90
- format: configItem.format,
91
- locale,
92
- output: configItem.output.replace("<lang>", locale).replace("<project>", configItem.project).replace("<format>", configItem.format),
93
- branch
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":"AAOA,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,CA8Cf"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transi-store/cli",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dist/cli.js",