From cfa615e3528821178ab1740c67d55692cb0f9b24 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 7 Mar 2024 10:20:47 +0100 Subject: [PATCH 1/2] Support nodejs 18 --- bin/exempt-lint.mjs | 3 +++ bin/sync-lint-exemptions.mjs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bin/exempt-lint.mjs b/bin/exempt-lint.mjs index 08652ad05..64d564e71 100755 --- a/bin/exempt-lint.mjs +++ b/bin/exempt-lint.mjs @@ -16,6 +16,9 @@ import fs from "node:fs/promises"; +// Nodejs v18 compatibility (v18 is end-of-life in april 2025) +if(!("crypto" in globalThis)) globalThis.crypto = (await import("node:crypto")).webcrypto; + const lintRule = process.argv[2]; if (!lintRule) { throw new Error( diff --git a/bin/sync-lint-exemptions.mjs b/bin/sync-lint-exemptions.mjs index cbf18fe3c..ea7614b68 100755 --- a/bin/sync-lint-exemptions.mjs +++ b/bin/sync-lint-exemptions.mjs @@ -11,6 +11,9 @@ import fs from "node:fs/promises"; +// Nodejs v18 compatibility (v18 is end-of-life in april 2025) +if(!("crypto" in globalThis)) globalThis.crypto = (await import("node:crypto")).webcrypto; + const exemptionsFilePath = "../apps/lint_exemptions.js"; const exemptions = (await import(exemptionsFilePath)).default; From b90577cc9788a3c0acf5c3905e8577ae984bbf73 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 7 Mar 2024 10:23:36 +0100 Subject: [PATCH 2/2] Downgrade CI to nodejs 18 To ensure the scripts still work for people that haven't updated to v20 yet --- .github/workflows/nodejs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 440d0b19e..bebe18748 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -11,10 +11,10 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive - - name: Use Node.js 20.x + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: - node-version: 20.x + node-version: 18.x - name: Install testing dependencies run: npm ci - name: Test all apps and widgets