diff --git a/Dockerfile b/Dockerfile index 899ef0710..0a644d6ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ ARG DEBIAN_VERSION=13 ARG DEBIAN_VERSION_NAME=trixie ARG RUSTUP_VERSION=1.29.0 -# Keep in sync with .node-version +# Keep in sync with .node-version and devEngines.runtime in package.json ARG NODEJS_VERSION=24.15.0 # Keep in sync with .github/actions/build-policies/action.yml and policies/Makefile ARG OPA_VERSION=1.13.1 @@ -38,8 +38,10 @@ COPY ./package.json ./pnpm-workspace.yaml ./pnpm-lock.yaml /app/ COPY ./frontend/package.json /app/frontend/ # Network access: to fetch dependencies +# The base image already provides the Node.js version pinned in +# `devEngines.runtime`, so skip pnpm's own runtime download. RUN --network=default \ - pnpm install --frozen-lockfile + pnpm install --frozen-lockfile --no-runtime COPY ./frontend/ /app/frontend/ COPY ./templates/ /app/templates/ diff --git a/docs/development/contributing.md b/docs/development/contributing.md index e8a32ccbf..a9079b17e 100644 --- a/docs/development/contributing.md +++ b/docs/development/contributing.md @@ -20,7 +20,7 @@ There are two main ways to contribute to MAS: To get MAS running locally from source you will need to: - [Install Rust and Cargo](https://www.rust-lang.org/learn/get-started). The exact version is pinned in `rust-toolchain.toml`; rustup installs it automatically when you run cargo in the repo. -- [Install Node.js](https://nodejs.org/). We recommend using the latest LTS version of Node.js. The frontend uses pnpm, which is installed automatically via corepack — see below. +- [Install Node.js](https://nodejs.org/). Any recent version works to bootstrap: the exact version is pinned in `devEngines.runtime` in `package.json`, and pnpm downloads it on install. The frontend uses pnpm, which is installed automatically via corepack — see below. - [Install Open Policy Agent](https://www.openpolicyagent.org/docs#1-download-opa) ## 4. Get the source diff --git a/docs/setup/installation.md b/docs/setup/installation.md index bcdb7fbd4..9d92a24ee 100644 --- a/docs/setup/installation.md +++ b/docs/setup/installation.md @@ -64,7 +64,7 @@ The image can also be built from the source: Building from the source requires: - The [Rust toolchain](https://www.rust-lang.org/learn/get-started) pinned by `rust-toolchain.toml` (installed automatically by rustup) -- [Node.js (24 and later)](https://nodejs.org/en/), with [corepack](https://nodejs.org/api/corepack.html) enabled so pnpm@11 is provisioned automatically +- [Node.js](https://nodejs.org/en/), with [corepack](https://nodejs.org/api/corepack.html) enabled so pnpm@11 is provisioned automatically; pnpm then downloads the Node.js version pinned in `package.json` - the [Open Policy Agent](https://www.openpolicyagent.org/docs/latest/#running-opa) binary (or alternatively, Docker) 1. Get the source diff --git a/misc/build-docs.sh b/misc/build-docs.sh index da0bed402..ee9c08a6f 100644 --- a/misc/build-docs.sh +++ b/misc/build-docs.sh @@ -30,7 +30,8 @@ if [ "${CF_PAGES:-""}" = "1" ]; then MDBOOK_URL="https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-$(uname -m)-unknown-linux-gnu.tar.gz" curl --proto '=https' --tlsv1.2 -sSfL "${MDBOOK_URL}" | tar -C "$HOME/.cargo/bin" -xzv - # Enable pnpm via corepack (Node and corepack are pre-installed on Cloudflare Pages) + # Enable pnpm via corepack (Node and corepack are pre-installed on Cloudflare + # Pages, which picks the Node version from .node-version) corepack enable fi @@ -56,5 +57,7 @@ rm -rf target/book/rustdoc mv target/doc target/book/rustdoc # Build the frontend storybook -pnpm install --frozen-lockfile +# Node is already provided by Cloudflare Pages / the CI runner, so skip pnpm's +# own runtime download. +pnpm install --frozen-lockfile --no-runtime pnpm --filter mas-frontend exec storybook build -o ../target/book/storybook diff --git a/package.json b/package.json index 563c22fa7..ef74b844d 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,13 @@ "name": "matrix-authentication-service", "private": true, "packageManager": "pnpm@11.3.0+sha512.2c403d6594527287672b1f7056343a1f7c3634036a67ffabfcc2b3d7595d843768f8787148d1b57cf7956c90606bbd192857c363af19e96d2d0ec9ec5741d215", + "devEngines": { + "runtime": { + "name": "node", + "version": "24.15.0", + "onFail": "download" + } + }, "devDependencies": { "@localazy/cli": "^2.0.11", "semver": "^7.8.5" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5f0027294..72b201e08 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@localazy/cli': specifier: ^2.0.11 version: 2.0.11 + node: + specifier: runtime:24.15.0 + version: runtime:24.15.0 semver: specifier: ^7.8.5 version: 7.8.5 @@ -3953,6 +3956,127 @@ packages: resolution: {integrity: sha512-MRlTqhAfoMx/4mhEbPo3Hi02g9LJZaJkka69V6h67Cb1gjrAG0jsTE4CZX1eptNx+VCAwJmfpnDIF4P0Nh1A7A==} engines: {node: '>=18'} + node@runtime:24.15.0: + resolution: + type: variations + variants: + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-3UvHfctfTJoslkNzm7WTUAzLCUE+xCyqD47w5e8RYJU= + type: binary + url: https://nodejs.org/download/release/v24.15.0/node-v24.15.0-aix-ppc64.tar.gz + targets: + - cpu: ppc64 + os: aix + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-NyMxuWl3mrXRW5SYhPxur4jVr+h73ouogdZAC5EA/8Q= + type: binary + url: https://nodejs.org/download/release/v24.15.0/node-v24.15.0-darwin-arm64.tar.gz + targets: + - cpu: arm64 + os: darwin + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-/9XuKTRnkn8+5zGlU+uI/R9Iz3TuvC10prq+SvIoZzs= + type: binary + url: https://nodejs.org/download/release/v24.15.0/node-v24.15.0-darwin-x64.tar.gz + targets: + - cpu: x64 + os: darwin + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-c6/CNNVYwkkZh19RwtHqACoq2k6m+DYBo4OGn++mTu0= + type: binary + url: https://nodejs.org/download/release/v24.15.0/node-v24.15.0-linux-arm64.tar.gz + targets: + - cpu: arm64 + os: linux + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-sfiJAKSxY2XqulYmkwT8Edp1gdvwNVLUSV+azh/AX20= + type: binary + url: https://nodejs.org/download/release/v24.15.0/node-v24.15.0-linux-ppc64le.tar.gz + targets: + - cpu: ppc64le + os: linux + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-+YVFVDnVL+m43mqPbQe/7MxzbepSfofqyv5ajXUWo4A= + type: binary + url: https://nodejs.org/download/release/v24.15.0/node-v24.15.0-linux-s390x.tar.gz + targets: + - cpu: s390x + os: linux + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-RINoctmuxJ8ea1KpqSKHLbmisC0jWmFqVoG2qF/sjYk= + type: binary + url: https://nodejs.org/download/release/v24.15.0/node-v24.15.0-linux-x64.tar.gz + targets: + - cpu: x64 + os: linux + - resolution: + archive: zip + bin: + node: node.exe + integrity: sha256-yet0Au2ibiun5EtnJ/yFqN5WxQlbH3Hr0wYokiEaoRY= + prefix: node-v24.15.0-win-arm64 + type: binary + url: https://nodejs.org/download/release/v24.15.0/node-v24.15.0-win-arm64.zip + targets: + - cpu: arm64 + os: win32 + - resolution: + archive: zip + bin: + node: node.exe + integrity: sha256-zFFJ6r1Td5zh573FQBZDYi0MfmgAreGJKKdn6UC7DmI= + prefix: node-v24.15.0-win-x64 + type: binary + url: https://nodejs.org/download/release/v24.15.0/node-v24.15.0-win-x64.zip + targets: + - cpu: x64 + os: win32 + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-MemKqWCgZ9qR7f/V2TvEZle10qgClhLDWfXyrABgFSo= + type: binary + url: https://unofficial-builds.nodejs.org/download/release/v24.15.0/node-v24.15.0-linux-arm64-musl.tar.gz + targets: + - cpu: arm64 + os: linux + libc: musl + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-9Vr1vUicU0exE8pllMrgClSzC6V6xYdTJDEb/G9HYuM= + type: binary + url: https://unofficial-builds.nodejs.org/download/release/v24.15.0/node-v24.15.0-linux-x64-musl.tar.gz + targets: + - cpu: x64 + os: linux + libc: musl + version: 24.15.0 + hasBin: true + normalize-path@2.1.1: resolution: {integrity: sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==} engines: {node: '>=0.10.0'} @@ -8387,6 +8511,8 @@ snapshots: node-releases@2.0.52: {} + node@runtime:24.15.0: {} + normalize-path@2.1.1: dependencies: remove-trailing-separator: 1.1.0