From 2fbd102aefd1c52052a3532bd5f18fefac07779c Mon Sep 17 00:00:00 2001 From: Eli Mallon Date: Wed, 14 May 2025 21:05:37 -0700 Subject: [PATCH] build: require node >=22 (#174) * build: require node >=22 * ci: node 22 * ci: install node@22 on gitlab --- .github/workflows/build.yaml | 4 ++++ .gitlab-ci.yml | 5 ++++- hack/node-version.js | 20 ++++++++++++++++++++ package.json | 4 ++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 hack/node-version.js diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e80cf4d3..a34d5c2a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -63,6 +63,10 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/setup-node@v4 + with: + node-version: 22 + - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: ${{ matrix.xcode-version }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ede78154..1b05a9b8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -211,6 +211,9 @@ build-mac: - cd /Users/admin/streamplace - git fetch --unshallow || echo 'already unshallow' - brew install ninja go openssl@3 && go version + - export PATH="/opt/homebrew/opt/node@22/bin:$PATH" + - brew install node@22 + - node --version - sudo gem uninstall xcodeproj -x --ignore-dependencies - sudo gem install xcodeproj -v 1.25.1 - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh && bash rustup.sh -y && rm rustup.sh @@ -229,6 +232,7 @@ build-mac: windows-selftest: interruptible: true + allow_failure: true stage: build # for the moment... tags: @@ -254,7 +258,6 @@ release: - build-docker-arm64 - build-docker-manifest - build - - windows-selftest - test rules: - if: '$CI_COMMIT_TAG =~ /^v?\d+\.\d+\.\d+$/' diff --git a/hack/node-version.js b/hack/node-version.js new file mode 100644 index 00000000..5a0ed47b --- /dev/null +++ b/hack/node-version.js @@ -0,0 +1,20 @@ +const pkg = require("../package.json"); +const engines = pkg.engines; + +let version = engines.node; +if (!version.startsWith(">=")) { + console.log( + `fix package.json! idk what engines.node=${version} means, i'm just a little script :(`, + ); + process.exit(1); +} +version = version.slice(2); +const neededMajor = parseInt(version.split(".")[0]); +const runningMajor = parseInt(process.version.slice(1).split(".")[0]); + +if (runningMajor < neededMajor) { + console.log( + `Required node version ${version} not satisfied with current version ${process.version}.`, + ); + process.exit(1); +} diff --git a/package.json b/package.json index d70fcab0..18c32ee0 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,11 @@ "version": "0.0.0-monorepo", "description": "The video layer for everything.", "main": "index.js", + "engines": { + "node": ">=22.0.0" + }, "scripts": { + "preinstall": "node hack/node-version.js", "check": "yarn run check:workspaces && git ls-files | xargs prettier --check --ignore-unknown", "check:workspaces": "cd js/app && yarn run check", "fix": "git ls-files | xargs prettier --write --ignore-unknown", -- 2.51.2