@tandem-language-exchange/content-store 1.2.4 → 1.2.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.
|
@@ -10,7 +10,9 @@ import "../chunk-4DE47ZJD.js";
|
|
|
10
10
|
import {
|
|
11
11
|
ContentStore
|
|
12
12
|
} from "../chunk-5WQPK6GZ.js";
|
|
13
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
allProjects
|
|
15
|
+
} from "../chunk-HXG3MIJG.js";
|
|
14
16
|
|
|
15
17
|
// src/client/fetch-merged-translation-bundles.ts
|
|
16
18
|
import fs from "fs";
|
|
@@ -33,7 +35,14 @@ program.name("fetch-merged-translation-bundles").description(
|
|
|
33
35
|
const store = new ContentStore(config.s3);
|
|
34
36
|
try {
|
|
35
37
|
const files = await fetchMergedTranslationBundles(store, opts.output, filterConfig);
|
|
36
|
-
console.log("
|
|
38
|
+
console.log("\nSynced translations from:");
|
|
39
|
+
for (const [project, resourceFilter] of Object.entries(filterConfig.projects)) {
|
|
40
|
+
const all = allProjects[project];
|
|
41
|
+
if (!all?.length) continue;
|
|
42
|
+
const names = resourceFilter.length ? resourceFilter.filter((r) => all.some((a) => a.resource === r)) : all.map((a) => a.resource);
|
|
43
|
+
console.log(` - ${project}: (${names.join(", ")})`);
|
|
44
|
+
}
|
|
45
|
+
console.log("\nWrote merged translation files:");
|
|
37
46
|
for (const [locale, filePath] of Object.entries(files)) {
|
|
38
47
|
console.log(` ${locale}.json -> ${filePath}`);
|
|
39
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/fetch-merged-translation-bundles.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { Command } from 'commander';\nimport { config } from './config';\nimport { ContentStore } from '../shared/s3';\nimport { fetchMergedTranslationBundles, type TranslationFilterConfig } from '../shared/bundles';\n\nconst program = new Command();\n\nprogram\n .name('fetch-merged-translation-bundles')\n .description(\n 'Download translation bundles from S3 and write one merged {locale}.json per locale.\\n\\n' +\n 'Accepts a JSON config file that specifies projects, resources, and locales.\\n' +\n 'Example config:\\n' +\n ' { \"projects\": { \"tandem\": [], \"tandem-(website)\": [\"main\",\"ai\"] }, \"locales\": [\"en\",\"de\"] }',\n )\n .requiredOption(\n '--config <filepath>',\n 'Path to a JSON config file defining projects, resources, and locales',\n )\n .option('--output <directory>', 'Output directory', './content-cache')\n .action(\n async (opts: { config: string; output: string }) => {\n let filterConfig: TranslationFilterConfig;\n try {\n filterConfig = JSON.parse(fs.readFileSync(opts.config, 'utf-8'));\n } catch (err) {\n console.error(`Failed to read config file \"${opts.config}\":`, err);\n process.exit(1);\n }\n\n const store = new ContentStore(config.s3);\n\n try {\n const files = await fetchMergedTranslationBundles(store, opts.output, filterConfig);\n\n console.log('
|
|
1
|
+
{"version":3,"sources":["../../src/client/fetch-merged-translation-bundles.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { Command } from 'commander';\nimport { config } from './config';\nimport { ContentStore } from '../shared/s3';\nimport { fetchMergedTranslationBundles, type TranslationFilterConfig } from '../shared/bundles';\nimport { allProjects } from '../shared/lingohub';\n\nconst program = new Command();\n\nprogram\n .name('fetch-merged-translation-bundles')\n .description(\n 'Download translation bundles from S3 and write one merged {locale}.json per locale.\\n\\n' +\n 'Accepts a JSON config file that specifies projects, resources, and locales.\\n' +\n 'Example config:\\n' +\n ' { \"projects\": { \"tandem\": [], \"tandem-(website)\": [\"main\",\"ai\"] }, \"locales\": [\"en\",\"de\"] }',\n )\n .requiredOption(\n '--config <filepath>',\n 'Path to a JSON config file defining projects, resources, and locales',\n )\n .option('--output <directory>', 'Output directory', './content-cache')\n .action(\n async (opts: { config: string; output: string }) => {\n let filterConfig: TranslationFilterConfig;\n try {\n filterConfig = JSON.parse(fs.readFileSync(opts.config, 'utf-8'));\n } catch (err) {\n console.error(`Failed to read config file \"${opts.config}\":`, err);\n process.exit(1);\n }\n\n const store = new ContentStore(config.s3);\n\n try {\n const files = await fetchMergedTranslationBundles(store, opts.output, filterConfig);\n\n console.log('\\nSynced translations from:');\n for (const [project, resourceFilter] of Object.entries(filterConfig.projects)) {\n const all = allProjects[project];\n if (!all?.length) continue;\n const names = resourceFilter.length\n ? resourceFilter.filter((r) => all.some((a) => a.resource === r))\n : all.map((a) => a.resource);\n console.log(` - ${project}: (${names.join(', ')})`);\n }\n\n console.log('\\nWrote merged translation files:');\n for (const [locale, filePath] of Object.entries(files)) {\n console.log(` ${locale}.json -> ${filePath}`);\n }\n } catch (err) {\n console.error('Fetch failed:', err);\n process.exit(1);\n }\n },\n );\n\nprogram.parse();\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,SAAS,eAAe;AAMxB,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,kCAAkC,EACvC;AAAA,EACC;AAIF,EACC;AAAA,EACC;AAAA,EACA;AACF,EACC,OAAO,wBAAwB,oBAAoB,iBAAiB,EACpE;AAAA,EACC,OAAO,SAA6C;AAClD,QAAI;AACJ,QAAI;AACF,qBAAe,KAAK,MAAM,GAAG,aAAa,KAAK,QAAQ,OAAO,CAAC;AAAA,IACjE,SAAS,KAAK;AACZ,cAAQ,MAAM,+BAA+B,KAAK,MAAM,MAAM,GAAG;AACjE,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,QAAQ,IAAI,aAAa,OAAO,EAAE;AAExC,QAAI;AACF,YAAM,QAAQ,MAAM,8BAA8B,OAAO,KAAK,QAAQ,YAAY;AAElF,cAAQ,IAAI,6BAA6B;AACzC,iBAAW,CAAC,SAAS,cAAc,KAAK,OAAO,QAAQ,aAAa,QAAQ,GAAG;AAC7E,cAAM,MAAM,YAAY,OAAO;AAC/B,YAAI,CAAC,KAAK,OAAQ;AAClB,cAAM,QAAQ,eAAe,SACvB,eAAe,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,IAC9D,IAAI,IAAI,CAAC,MAAM,EAAE,QAAQ;AAC/B,gBAAQ,IAAI,OAAO,OAAO,MAAM,MAAM,KAAK,IAAI,CAAC,GAAG;AAAA,MACrD;AAEA,cAAQ,IAAI,mCAAmC;AAC/C,iBAAW,CAAC,QAAQ,QAAQ,KAAK,OAAO,QAAQ,KAAK,GAAG;AACtD,gBAAQ,IAAI,KAAK,MAAM,YAAY,QAAQ,EAAE;AAAA,MAC/C;AAAA,IACF,SAAS,KAAK;AACZ,cAAQ,MAAM,iBAAiB,GAAG;AAClC,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF;AAEF,QAAQ,MAAM;","names":[]}
|
|
@@ -10,7 +10,9 @@ import "../chunk-4DE47ZJD.js";
|
|
|
10
10
|
import {
|
|
11
11
|
ContentStore
|
|
12
12
|
} from "../chunk-5WQPK6GZ.js";
|
|
13
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
allProjects
|
|
15
|
+
} from "../chunk-HXG3MIJG.js";
|
|
14
16
|
|
|
15
17
|
// src/client/fetch-translation-bundles.ts
|
|
16
18
|
import fs from "fs";
|
|
@@ -32,7 +34,14 @@ program.name("fetch-translation-bundles").description(
|
|
|
32
34
|
const store = new ContentStore(config.s3);
|
|
33
35
|
try {
|
|
34
36
|
const files = await fetchTranslationBundles(store, opts.output, filterConfig);
|
|
35
|
-
console.log("
|
|
37
|
+
console.log("\nSynced translations from:");
|
|
38
|
+
for (const [project, resourceFilter] of Object.entries(filterConfig.projects)) {
|
|
39
|
+
const all = allProjects[project];
|
|
40
|
+
if (!all?.length) continue;
|
|
41
|
+
const names = resourceFilter.length ? resourceFilter.filter((r) => all.some((a) => a.resource === r)) : all.map((a) => a.resource);
|
|
42
|
+
console.log(` - ${project}: (${names.join(", ")})`);
|
|
43
|
+
}
|
|
44
|
+
console.log("\nFetched bundles:");
|
|
36
45
|
for (const [project, pathsByKey] of Object.entries(files)) {
|
|
37
46
|
console.log(` ${project}:`);
|
|
38
47
|
for (const [objectKey, filePath] of Object.entries(pathsByKey)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/fetch-translation-bundles.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { Command } from 'commander';\nimport { config } from './config';\nimport { ContentStore } from '../shared/s3';\nimport { fetchTranslationBundles, type TranslationFilterConfig } from '../shared/bundles';\n\nconst program = new Command();\n\nprogram\n .name('fetch-translation-bundles')\n .description(\n 'Download latest translation bundles from S3 to the local filesystem.\\n\\n' +\n 'Accepts a JSON config file that specifies projects, resources, and locales.\\n' +\n 'Example config:\\n' +\n ' { \"projects\": { \"tandem\": [], \"tandem-(website)\": [\"main\",\"ai\"] }, \"locales\": [\"en\",\"de\"] }',\n )\n .requiredOption(\n '--config <filepath>',\n 'Path to a JSON config file defining projects, resources, and locales',\n )\n .option('--output <directory>', 'Output directory', './content-cache')\n .action(async (opts: { config: string; output: string }) => {\n let filterConfig: TranslationFilterConfig;\n try {\n filterConfig = JSON.parse(fs.readFileSync(opts.config, 'utf-8'));\n } catch (err) {\n console.error(`Failed to read config file \"${opts.config}\":`, err);\n process.exit(1);\n }\n\n const store = new ContentStore(config.s3);\n\n try {\n const files = await fetchTranslationBundles(store, opts.output, filterConfig);\n\n console.log('
|
|
1
|
+
{"version":3,"sources":["../../src/client/fetch-translation-bundles.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { Command } from 'commander';\nimport { config } from './config';\nimport { ContentStore } from '../shared/s3';\nimport { fetchTranslationBundles, type TranslationFilterConfig } from '../shared/bundles';\nimport { allProjects } from '../shared/lingohub';\n\nconst program = new Command();\n\nprogram\n .name('fetch-translation-bundles')\n .description(\n 'Download latest translation bundles from S3 to the local filesystem.\\n\\n' +\n 'Accepts a JSON config file that specifies projects, resources, and locales.\\n' +\n 'Example config:\\n' +\n ' { \"projects\": { \"tandem\": [], \"tandem-(website)\": [\"main\",\"ai\"] }, \"locales\": [\"en\",\"de\"] }',\n )\n .requiredOption(\n '--config <filepath>',\n 'Path to a JSON config file defining projects, resources, and locales',\n )\n .option('--output <directory>', 'Output directory', './content-cache')\n .action(async (opts: { config: string; output: string }) => {\n let filterConfig: TranslationFilterConfig;\n try {\n filterConfig = JSON.parse(fs.readFileSync(opts.config, 'utf-8'));\n } catch (err) {\n console.error(`Failed to read config file \"${opts.config}\":`, err);\n process.exit(1);\n }\n\n const store = new ContentStore(config.s3);\n\n try {\n const files = await fetchTranslationBundles(store, opts.output, filterConfig);\n\n console.log('\\nSynced translations from:');\n for (const [project, resourceFilter] of Object.entries(filterConfig.projects)) {\n const all = allProjects[project];\n if (!all?.length) continue;\n const names = resourceFilter.length\n ? resourceFilter.filter((r) => all.some((a) => a.resource === r))\n : all.map((a) => a.resource);\n console.log(` - ${project}: (${names.join(', ')})`);\n }\n\n console.log('\\nFetched bundles:');\n for (const [project, pathsByKey] of Object.entries(files)) {\n console.log(` ${project}:`);\n for (const [objectKey, filePath] of Object.entries(pathsByKey)) {\n console.log(` ${objectKey} -> ${filePath}`);\n }\n }\n } catch (err) {\n console.error('Fetch failed:', err);\n process.exit(1);\n }\n });\n\nprogram.parse();"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,SAAS,eAAe;AAMxB,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACK,KAAK,2BAA2B,EAChC;AAAA,EACC;AAIF,EACC;AAAA,EACC;AAAA,EACA;AACF,EACC,OAAO,wBAAwB,oBAAoB,iBAAiB,EACpE,OAAO,OAAO,SAA6C;AACxD,MAAI;AACJ,MAAI;AACA,mBAAe,KAAK,MAAM,GAAG,aAAa,KAAK,QAAQ,OAAO,CAAC;AAAA,EACnE,SAAS,KAAK;AACV,YAAQ,MAAM,+BAA+B,KAAK,MAAM,MAAM,GAAG;AACjE,YAAQ,KAAK,CAAC;AAAA,EAClB;AAEA,QAAM,QAAQ,IAAI,aAAa,OAAO,EAAE;AAExC,MAAI;AACA,UAAM,QAAQ,MAAM,wBAAwB,OAAO,KAAK,QAAQ,YAAY;AAE5E,YAAQ,IAAI,6BAA6B;AACzC,eAAW,CAAC,SAAS,cAAc,KAAK,OAAO,QAAQ,aAAa,QAAQ,GAAG;AAC3E,YAAM,MAAM,YAAY,OAAO;AAC/B,UAAI,CAAC,KAAK,OAAQ;AAClB,YAAM,QAAQ,eAAe,SACvB,eAAe,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,IAC9D,IAAI,IAAI,CAAC,MAAM,EAAE,QAAQ;AAC/B,cAAQ,IAAI,OAAO,OAAO,MAAM,MAAM,KAAK,IAAI,CAAC,GAAG;AAAA,IACvD;AAEA,YAAQ,IAAI,oBAAoB;AAChC,eAAW,CAAC,SAAS,UAAU,KAAK,OAAO,QAAQ,KAAK,GAAG;AACvD,cAAQ,IAAI,KAAK,OAAO,GAAG;AAC3B,iBAAW,CAAC,WAAW,QAAQ,KAAK,OAAO,QAAQ,UAAU,GAAG;AAC5D,gBAAQ,IAAI,OAAO,SAAS,OAAO,QAAQ,EAAE;AAAA,MACjD;AAAA,IACJ;AAAA,EACJ,SAAS,KAAK;AACV,YAAQ,MAAM,iBAAiB,GAAG;AAClC,YAAQ,KAAK,CAAC;AAAA,EAClB;AACJ,CAAC;AAEL,QAAQ,MAAM;","names":[]}
|