| 150 | // Step 1 of the release recipe, run against a stand-in for nodejs.org: `curl` |
| 151 | // copies the requested file out of `site/` and logs the URL it was asked for. |
| 152 | function download(sums: (sha: string) => string) { |
| 153 | const root = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-node-download-')); |
| 154 | roots.push(root); |
| 155 | const site = path.join(root, 'site'); |
| 156 | const work = path.join(root, 'work'); |
| 157 | fs.mkdirSync(path.join(site, 'node-v24.22.1-linux-x64', 'bin'), { recursive: true }); |
| 158 | fs.mkdirSync(work); |
| 159 | fs.writeFileSync(path.join(site, 'node-v24.22.1-linux-x64', 'bin', 'node'), '#!/bin/sh\n'); |
| 160 | const arg = (n: number) => windows ? `$(cygpath -u "$${n}")` : `$${n}`; |
| 161 | // Packed the way nodejs.org packs a release: one top-level folder. |
| 162 | const pack = shell(`set -eu\ncd "${arg(1)}"\ntar -czf ${archive} node-v24.22.1-linux-x64`, [site]); |
| 163 | expect(pack.status, pack.stderr).toBe(0); |
| 164 | const sha = crypto.createHash('sha256').update(fs.readFileSync(path.join(site, archive))).digest('hex'); |
| 165 | fs.writeFileSync(path.join(site, 'SHASUMS256.txt'), sums(sha)); |
| 166 | const step = recipe.slice(recipe.indexOf('# 1. Download'), recipe.indexOf('# 2. Build')); |
| 167 | const result = shell(`set -euo pipefail |
| 168 | WORK="${arg(1)}" |
| 169 | SITE="${arg(2)}" |
| 170 | TARGET=linux-x64 OSFAM=linux ARCH=x64 NODE_VERSION=v24.22.1 |
| 171 | curl() { |
| 172 | local url='' out='' |
| 173 | while [ $# -gt 0 ]; do |
| 174 | case "$1" in -o) out="$2"; shift 2 ;; -*) shift ;; *) url="$1"; shift ;; esac |
| 175 | done |
| 176 | printf '%s\\n' "$url" >> "$WORK/urls" |
| 177 | cp "$SITE/\${url##*/}" "$out" |
| 178 | } |
| 179 | ${step} |
| 180 | printf 'NODE_BIN=%s\\n' "$NODE_BIN"`, [work, site]); |
| 181 | const urls = fs.existsSync(path.join(work, 'urls')) |
| 182 | ? fs.readFileSync(path.join(work, 'urls'), 'utf8').trim().split('\n') |
| 183 | : []; |
| 184 | return { result, work, urls }; |
| 185 | } |
| 186 | |
| 187 | it('ships Node 24.22.1, the October 2026 security release, or a later 24.x', () => { |
| 188 | const pin = /^NODE_VERSION="\$\{2:-v(\d+)\.(\d+)\.(\d+)\}"\r?$/m.exec(recipe); |