From d8861f3c856075669758a5ee7e880ce135d67b53 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 24 Apr 2024 11:22:01 -0700 Subject: [PATCH] feat(tools): allow i18n sync to run on single block (#54521) --- tools/scripts/sync-i18n.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/scripts/sync-i18n.ts b/tools/scripts/sync-i18n.ts index 7e5a3a3ee65..f1546906269 100644 --- a/tools/scripts/sync-i18n.ts +++ b/tools/scripts/sync-i18n.ts @@ -20,6 +20,7 @@ const loadDirectory = async (path: string): Promise => { }; const syncChallenges = async () => { + const block = process.env.FCC_BLOCK; const ignore = ['.markdownlint.yaml', '_meta', 'english']; const basePath = join(process.cwd(), 'curriculum', 'challenges'); const allLangs = await readdir(basePath); @@ -29,6 +30,9 @@ const syncChallenges = async () => { for (const path of english) { await Promise.all( filtered.map(async lang => { + if (block && !path.includes(block)) { + return; + } const targetPath = path.replace('english', lang); // we swallow the error here to detect if the file doesn't exist const status = await stat(targetPath).catch(() => null); @@ -81,6 +85,9 @@ const syncChallenges = async () => { const langPath = join(process.cwd(), 'curriculum', 'challenges', lang); const langFiles = await loadDirectory(langPath); for (const path of langFiles) { + if (block && !path.includes(block)) { + continue; + } const engPath = path.replace(lang, 'english'); // we don't want an error, only need to know that the file exists const existsEnglish = await stat(engPath).catch(() => null);