From 647e1f9d24deea96aa2c00fdf7e0589bcd89ccbf Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Fri, 11 Oct 2024 10:42:55 -0400 Subject: [PATCH 1/2] ci: change node versions on lint & deployment workflows (#3228) Signed-off-by: Trae Yelovich --- .github/workflows/deployment.yml | 2 +- .github/workflows/lint.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 6a14c7be8e..a82c4f52c8 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -37,7 +37,7 @@ jobs: - name: Use Node.js LTS uses: actions/setup-node@v4 with: - node-version: '18.x' + node-version: '20.x' # use pnpm version 8 until Octorelease supports pnpm@9 - name: Install pnpm and Lerna diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8bcada0004..a3fe643f3d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,7 @@ jobs: - name: Use Node.js LTS uses: actions/setup-node@v4 with: - node-version: 18 + node-version: lts/* - run: | npm install -g pnpm@8 From 525d29d9073ff84c1ee3b3b1b2b19c52c5b367c1 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Fri, 11 Oct 2024 12:36:17 -0400 Subject: [PATCH 2/2] Improve process to build l10n bundle without comments (#3191) Signed-off-by: Timothy Johnson Co-authored-by: Billie Simmons --- packages/zowe-explorer/package.json | 3 +-- .../zowe-explorer/scripts/generatePoeditorJson.js | 15 ++++++++++++++- .../zowe-explorer/scripts/stripL10nComments.js | 11 ----------- 3 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 packages/zowe-explorer/scripts/stripL10nComments.js diff --git a/packages/zowe-explorer/package.json b/packages/zowe-explorer/package.json index 1d4a5b16d9..803fe2b75c 100644 --- a/packages/zowe-explorer/package.json +++ b/packages/zowe-explorer/package.json @@ -1794,8 +1794,7 @@ "madge": "madge -c --no-color --no-spinner --exclude __mocks__ --extensions js,ts src/", "pretty": "prettier --write .", "generateLocalization": "pnpm dlx @vscode/l10n-dev export --o ./l10n ./src && node ./scripts/generatePoeditorJson.js", - "copy-secrets": "node ./scripts/getSecretsPrebuilds.js", - "strip-l10n": "node ./scripts/stripL10nComments.js" + "copy-secrets": "node ./scripts/getSecretsPrebuilds.js" }, "engines": { "vscode": "^1.79.0" diff --git a/packages/zowe-explorer/scripts/generatePoeditorJson.js b/packages/zowe-explorer/scripts/generatePoeditorJson.js index 90753e24e9..afd8bac577 100644 --- a/packages/zowe-explorer/scripts/generatePoeditorJson.js +++ b/packages/zowe-explorer/scripts/generatePoeditorJson.js @@ -5,7 +5,7 @@ */ const fs = require("fs"); -const langId = process.argv[2]; +const langId = process.argv.slice(2).find(arg => !arg.startsWith("-")); const fileSuffix = langId ? `${langId}.json` : "json"; const poeditorJson = {}; const packageNls = require(__dirname + "/../package.nls." + fileSuffix); @@ -25,3 +25,16 @@ for (const [k, v] of Object.entries(l10nBundle)) { } } fs.writeFileSync(__dirname + "/../l10n/poeditor." + fileSuffix, JSON.stringify(poeditorJson, null, 2) + "\n"); + +if (process.argv.includes("--strip")) { + // Strip comments out of bundle.l10n.json and sort properties by key + const jsonFilePath = __dirname + "/../l10n/bundle.l10n.json"; + let l10nBundle = JSON.parse(fs.readFileSync(jsonFilePath, "utf-8")); + for (const [k, v] of Object.entries(l10nBundle)) { + if (typeof v === "object") { + l10nBundle[k] = l10nBundle[k].message; + } + } + l10nBundle = Object.fromEntries(Object.entries(l10nBundle).sort(([a], [b]) => a.localeCompare(b))); + fs.writeFileSync(jsonFilePath, JSON.stringify(l10nBundle, null, 2) + "\n"); +} diff --git a/packages/zowe-explorer/scripts/stripL10nComments.js b/packages/zowe-explorer/scripts/stripL10nComments.js deleted file mode 100644 index 23c60b78eb..0000000000 --- a/packages/zowe-explorer/scripts/stripL10nComments.js +++ /dev/null @@ -1,11 +0,0 @@ -// Strip comments out of bundle.l10n.json and sort properties by key -const fs = require("fs"); -const jsonFilePath = process.argv[2] || (__dirname + "/../l10n/bundle.l10n.json"); -let l10nBundle = JSON.parse(fs.readFileSync(jsonFilePath, "utf-8")); -for (const [k, v] of Object.entries(l10nBundle)) { - if (typeof v === "object") { - l10nBundle[k] = l10nBundle[k].message; - } -} -l10nBundle = Object.fromEntries(Object.entries(l10nBundle).sort(([a], [b]) => a.localeCompare(b))); -fs.writeFileSync(jsonFilePath + ".template", JSON.stringify(l10nBundle, null, 2) + "\n");