Files
action-setup/scripts/update-bootstrap.mjs
Zoltan Kochan ea17c68df8
Test Action / Smoke (windows / v12.3.4) (push) Waiting to run
Test Action / Smoke (windows / v9.15.5) (push) Waiting to run
Test Action / Standalone Windows self-update (PATH regression) (push) Waiting to run
Test Action / Smoke (macos / v12.3.4) (push) Waiting to run
Test Action / Smoke (macos / v9.15.5) (push) Waiting to run
Test Action / Smoke (ubuntu / v10.33.0) (push) Successful in 13s
Test Action / Smoke (ubuntu / v9.15.5) (push) Successful in 8s
Test Action / Smoke (ubuntu / v12.3.4) (push) Successful in 11s
Test Action / Smoke (ubuntu / v11.25.0) (push) Successful in 12s
Test Action / Smoke (ubuntu / v9.15.5 / custom-dest) (push) Successful in 13s
Test Action / Manifest pin: devEngines onFail=download, exact (push) Successful in 7s
Test Action / Manifest pin: packageManager [email protected] (push) Successful in 9s
Test Action / Manifest pin: devEngines onFail=error, exact (#252) (push) Successful in 11s
Test Action / Manifest pin: devEngines onFail=download, range (push) Successful in 11s
Test Action / Manifest pin: devEngines onFail=error, range (#252) (push) Successful in 11s
Test Action / Manifest pin: explicit version: pnpm_config_pm_on_fail not exported (push) Successful in 12s
Test Action / Manifest pin: packageManager [email protected] (#227) (push) Successful in 14s
Test Action / Cache store path matches install (#233): devEngines range >=10 <11 (push) Successful in 10s
Test Action / Cache store path matches install (#233): packageManager [email protected] (push) Successful in 9s
Test Action / Cache store path matches install (#233): devEngines exact [email protected] (push) Successful in 10s
Test Action / run_install (null) (push) Successful in 8s
Test Action / run_install (global) (push) Successful in 9s
Test Action / Native pnpm bootstrap (npm 12) (push) Successful in 27s
feat: support pnpm v12 (#288)
* feat: support pnpm v12

Approve the pinned @pnpm/exe install script for npm 12, add pnpm 12 coverage across supported runner platforms, and clarify that action-setup remains supported alongside pnpm/setup.

* refactor: use pnpm 12 native bootstrap

Install the plain pnpm v12 package as the single native bootstrap, remove the legacy @pnpm/exe lockfile and runtime path, and retain the standalone input as a no-op for workflow compatibility.

* fix: keep bootstrap updates on pnpm 12

Handle npm's array-shaped view output and resolve only pnpm 12 distribution tags.

* fix: use native bootstrap only for pnpm 12

Route pnpm 12-only versions and ranges through the plain pnpm native package while preserving the existing Node and @pnpm/exe bootstrap paths for older releases.

* style: remove updater narrative comments
2026-09-05 01:42:41 +02:00

48 lines
1.9 KiB
JavaScript

#!/usr/bin/env node
import { execSync } from 'child_process'
import { mkdtempSync, rmSync, readFileSync, writeFileSync } from 'fs'
import { join } from 'path'
import { tmpdir } from 'os'
const BOOTSTRAP_DIR = new URL('../src/install-pnpm/bootstrap/', import.meta.url).pathname
const legacyVersion = process.argv[2] || resolveLatestVersion(11)
const nativeVersion = process.argv[3] || resolveLatestVersion(12)
console.log(`Updating bootstrap lockfiles to pnpm@${legacyVersion} and pnpm@${nativeVersion} ...`)
generateLock('pnpm-lock.json', { pnpm: legacyVersion }, 'bootstrap-pnpm')
generateLock('exe-lock.json', { '@pnpm/exe': legacyVersion }, 'bootstrap-exe')
generateLock('native-lock.json', { pnpm: nativeVersion }, 'bootstrap-native-pnpm')
console.log('Done!')
function resolveLatestVersion(major) {
const json = execSync('npm view pnpm dist-tags --json', { encoding: 'utf8' })
const parsed = JSON.parse(json)
const tags = Array.isArray(parsed) ? parsed[0] : parsed
const version = tags[`next-${major}`] || tags[`latest-${major}`]
if (!version) {
console.error(`Could not determine latest pnpm v${major} version from npm dist-tags`)
process.exit(1)
}
return version
}
function generateLock(filename, dependencies, name) {
const tmp = mkdtempSync(join(tmpdir(), 'pnpm-bootstrap-'))
try {
writeFileSync(join(tmp, 'package.json'), JSON.stringify({ private: true, dependencies }))
execSync('npm install --package-lock-only --ignore-scripts', { cwd: tmp, stdio: 'pipe' })
const lock = readFileSync(join(tmp, 'package-lock.json'), 'utf8')
const parsed = JSON.parse(lock)
parsed.name = name
writeFileSync(join(BOOTSTRAP_DIR, filename), JSON.stringify(parsed, null, 2) + '\n')
const [packageName, packageVersion] = Object.entries(dependencies)[0]
console.log(` ${filename} -> ${packageName}@${packageVersion}`)
} finally {
rmSync(tmp, { recursive: true, force: true })
}
}