mirror of
https://github.com/pnpm/action-setup.git
synced 2026-04-04 19:42:36 +08:00
Compare commits
15 Commits
fix-window
...
next
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3de0023fce | ||
|
|
f489bfced8 | ||
|
|
25df77c6d2 | ||
|
|
53ef38b049 | ||
|
|
1f69135d3d | ||
|
|
c3b2a5fad6 | ||
|
|
0ffe724fa5 | ||
|
|
a722bd2d87 | ||
|
|
49b8837b49 | ||
|
|
9fbc6cd1d1 | ||
|
|
af96d9fd0e | ||
|
|
1fb299a44f | ||
|
|
24a61aa18d | ||
|
|
ab0b84aeb1 | ||
|
|
dc312cdfd7 |
86
.github/workflows/test.yaml
vendored
86
.github/workflows/test.yaml
vendored
@@ -33,14 +33,7 @@ jobs:
|
|||||||
run: which pnpm; which pnpx
|
run: which pnpm; which pnpx
|
||||||
|
|
||||||
- name: 'Test: version'
|
- name: 'Test: version'
|
||||||
run: |
|
run: pnpm --version
|
||||||
actual="$(pnpm --version)"
|
|
||||||
echo "pnpm version: ${actual}"
|
|
||||||
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
|
|
||||||
echo "ERROR: pnpm --version did not produce valid output"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: 'Test: install in a fresh project'
|
- name: 'Test: install in a fresh project'
|
||||||
run: |
|
run: |
|
||||||
@@ -78,14 +71,7 @@ jobs:
|
|||||||
run: which pnpm && which pnpx
|
run: which pnpm && which pnpx
|
||||||
|
|
||||||
- name: 'Test: version'
|
- name: 'Test: version'
|
||||||
run: |
|
run: pnpm --version
|
||||||
actual="$(pnpm --version)"
|
|
||||||
echo "pnpm version: ${actual}"
|
|
||||||
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
|
|
||||||
echo "ERROR: pnpm --version did not produce valid output"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
test_standalone:
|
test_standalone:
|
||||||
name: Test with standalone
|
name: Test with standalone
|
||||||
@@ -112,14 +98,7 @@ jobs:
|
|||||||
run: which pnpm
|
run: which pnpm
|
||||||
|
|
||||||
- name: 'Test: version'
|
- name: 'Test: version'
|
||||||
run: |
|
run: pnpm --version
|
||||||
actual="$(pnpm --version)"
|
|
||||||
echo "pnpm version: ${actual}"
|
|
||||||
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
|
|
||||||
echo "ERROR: pnpm --version did not produce valid output"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: 'Test: install in a fresh project'
|
- name: 'Test: install in a fresh project'
|
||||||
run: |
|
run: |
|
||||||
@@ -129,56 +108,6 @@ jobs:
|
|||||||
pnpm add is-odd
|
pnpm add is-odd
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
test_dev_engines:
|
|
||||||
name: Test with devEngines.packageManager
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
- ubuntu-latest
|
|
||||||
- macos-latest
|
|
||||||
- windows-latest
|
|
||||||
version:
|
|
||||||
- '9.15.5'
|
|
||||||
- '>=9.15.0'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
|
||||||
|
|
||||||
- name: Set up package.json with devEngines.packageManager
|
|
||||||
run: echo '{"devEngines":{"packageManager":{"name":"pnpm","version":"${{ matrix.version }}","onFail":"download"}}}' > package.json
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Run the action
|
|
||||||
uses: ./
|
|
||||||
|
|
||||||
- name: 'Test: which'
|
|
||||||
run: which pnpm; which pnpx
|
|
||||||
|
|
||||||
- name: 'Test: version'
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
required='${{ matrix.version }}'
|
|
||||||
actual="$(pnpm --version)"
|
|
||||||
echo "pnpm version: ${actual}"
|
|
||||||
|
|
||||||
if [ "${required}" = ">=9.15.0" ]; then
|
|
||||||
min="9.15.0"
|
|
||||||
if [ "$(printf '%s\n' "${min}" "${actual}" | sort -V | head -n1)" != "${min}" ]; then
|
|
||||||
echo "Expected pnpm version >= ${min}, but got ${actual}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "${actual}" != "${required}" ]; then
|
|
||||||
echo "Expected pnpm version ${required}, but got ${actual}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
test_run_install:
|
test_run_install:
|
||||||
name: 'Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }})'
|
name: 'Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }})'
|
||||||
|
|
||||||
@@ -217,11 +146,4 @@ jobs:
|
|||||||
run: which pnpm; which pnpx
|
run: which pnpm; which pnpx
|
||||||
|
|
||||||
- name: 'Test: version'
|
- name: 'Test: version'
|
||||||
run: |
|
run: pnpm --version
|
||||||
actual="$(pnpm --version)"
|
|
||||||
echo "pnpm version: ${actual}"
|
|
||||||
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
|
|
||||||
echo "ERROR: pnpm --version did not produce valid output"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: pnpm/action-setup@v5
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
```
|
```
|
||||||
@@ -105,7 +105,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: pnpm/action-setup@v5
|
- uses: pnpm/action-setup@v4
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install pnpm and a few npm packages
|
### Install pnpm and a few npm packages
|
||||||
@@ -122,7 +122,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v5
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
run_install: |
|
run_install: |
|
||||||
@@ -146,7 +146,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v5
|
- uses: pnpm/action-setup@v4
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
|
|||||||
269
dist/index.js
vendored
269
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -3,8 +3,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build:bundle": "esbuild src/index.ts --bundle --platform=node --target=node24 --format=cjs --minify --outfile=dist/index.js --loader:.json=json",
|
"build:bundle": "esbuild src/index.ts --bundle --platform=node --target=node24 --format=cjs --minify --outfile=dist/index.js --loader:.json=json",
|
||||||
"build": "pnpm run build:bundle",
|
"build": "pnpm run build:bundle",
|
||||||
"start": "pnpm run build && sh ./run.sh",
|
"start": "pnpm run build && sh ./run.sh"
|
||||||
"update-bootstrap": "node scripts/update-bootstrap.mjs"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^4.1.0",
|
"@actions/cache": "^4.1.0",
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
// Usage: node scripts/update-bootstrap.mjs [version]
|
|
||||||
// If version is omitted, fetches the latest next-11 tag from npm.
|
|
||||||
// Regenerates the bootstrap lockfiles used by action-setup to install pnpm via npm.
|
|
||||||
|
|
||||||
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 version = process.argv[2] || resolveLatestVersion()
|
|
||||||
|
|
||||||
console.log(`Updating bootstrap lockfiles to pnpm@${version} ...`)
|
|
||||||
|
|
||||||
generateLock('pnpm-lock.json', { pnpm: version }, 'bootstrap-pnpm')
|
|
||||||
generateLock('exe-lock.json', { '@pnpm/exe': version }, 'bootstrap-exe')
|
|
||||||
|
|
||||||
console.log('Done!')
|
|
||||||
|
|
||||||
function resolveLatestVersion() {
|
|
||||||
const json = execSync('npm view @pnpm/exe dist-tags --json', { encoding: 'utf8' })
|
|
||||||
const tags = JSON.parse(json)
|
|
||||||
const version = tags['next-11'] || tags['latest']
|
|
||||||
if (!version) {
|
|
||||||
console.error('Could not determine latest pnpm 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')
|
|
||||||
console.log(` ${filename} -> ${Object.values(dependencies)[0]}@${version}`)
|
|
||||||
} finally {
|
|
||||||
rmSync(tmp, { recursive: true, force: true })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,40 +5,34 @@
|
|||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pnpm/exe": "11.0.0-beta.4-1"
|
"@pnpm/exe": "10.32.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pnpm/exe": {
|
"node_modules/@pnpm/exe": {
|
||||||
"version": "11.0.0-beta.4-1",
|
"version": "10.32.1",
|
||||||
"resolved": "https://registry.npmjs.org/@pnpm/exe/-/exe-11.0.0-beta.4-1.tgz",
|
"resolved": "https://registry.npmjs.org/@pnpm/exe/-/exe-10.32.1.tgz",
|
||||||
"integrity": "sha512-2VzvynS54qE+Q0LGXzTCFKChq79Yr1xKLTAEkvIcBLoM+puRuI3xyrqtWx47esxhjbQlF0jRUyU8ISbSG92yBQ==",
|
"integrity": "sha512-baEtwHeZwmZAdBuuDDL6tbdGg5KpxhPxr3QFfYTGXvY6ws+Z1bN0mQ7ZjcaXBSC1HuLpVXnZ6NsBiaZ2DMv4vg==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
|
||||||
"@reflink/reflink": "0.1.19"
|
|
||||||
},
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"pn": "pn",
|
"pnpm": "pnpm"
|
||||||
"pnpm": "pnpm",
|
|
||||||
"pnpx": "pnpx",
|
|
||||||
"pnx": "pnx"
|
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/pnpm"
|
"url": "https://opencollective.com/pnpm"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@pnpm/linux-arm64": "11.0.0-beta.4-1",
|
"@pnpm/linux-arm64": "10.32.1",
|
||||||
"@pnpm/linux-x64": "11.0.0-beta.4-1",
|
"@pnpm/linux-x64": "10.32.1",
|
||||||
"@pnpm/macos-arm64": "11.0.0-beta.4-1",
|
"@pnpm/macos-arm64": "10.32.1",
|
||||||
"@pnpm/macos-x64": "11.0.0-beta.4-1",
|
"@pnpm/macos-x64": "10.32.1",
|
||||||
"@pnpm/win-arm64": "11.0.0-beta.4-1",
|
"@pnpm/win-arm64": "10.32.1",
|
||||||
"@pnpm/win-x64": "11.0.0-beta.4-1"
|
"@pnpm/win-x64": "10.32.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pnpm/linux-arm64": {
|
"node_modules/@pnpm/linux-arm64": {
|
||||||
"version": "11.0.0-beta.4-1",
|
"version": "10.32.1",
|
||||||
"resolved": "https://registry.npmjs.org/@pnpm/linux-arm64/-/linux-arm64-11.0.0-beta.4-1.tgz",
|
"resolved": "https://registry.npmjs.org/@pnpm/linux-arm64/-/linux-arm64-10.32.1.tgz",
|
||||||
"integrity": "sha512-aPf2hhCwWQQ1vNm3Sxq6BLtqnvv6eZ8iJq/oqJOm2WFzq9l59jbmn0eaUtDOlafjfzkijqg+cj46h0XT2Dqsfw==",
|
"integrity": "sha512-6uB0B+XvunQwHGzIMk2JCkl4Ur6BtM4XbJSwB/mgpWmXDoX/KTJmgx2lodcTjgJSGSySCHfIVuTR9sj/F2D4EA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -47,14 +41,17 @@
|
|||||||
"os": [
|
"os": [
|
||||||
"linux"
|
"linux"
|
||||||
],
|
],
|
||||||
|
"bin": {
|
||||||
|
"pnpm": "pnpm"
|
||||||
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/pnpm"
|
"url": "https://opencollective.com/pnpm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pnpm/linux-x64": {
|
"node_modules/@pnpm/linux-x64": {
|
||||||
"version": "11.0.0-beta.4-1",
|
"version": "10.32.1",
|
||||||
"resolved": "https://registry.npmjs.org/@pnpm/linux-x64/-/linux-x64-11.0.0-beta.4-1.tgz",
|
"resolved": "https://registry.npmjs.org/@pnpm/linux-x64/-/linux-x64-10.32.1.tgz",
|
||||||
"integrity": "sha512-1hTcyZSVJWpPNHs3u7RbfbAmZXPBLIZQVt/z1XjcDnzI8S49NGIvir876/gq9jL69ZPoE1a6z+qSe3zUPmw0ng==",
|
"integrity": "sha512-AM2tv23Fg7h+nV+adqA/SkZKUysSIEetHfBwYFl8ArgdgkqbGoQy0rAOdKYQBb920CqfexXfI8OA8kPCzRxYng==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -63,14 +60,17 @@
|
|||||||
"os": [
|
"os": [
|
||||||
"linux"
|
"linux"
|
||||||
],
|
],
|
||||||
|
"bin": {
|
||||||
|
"pnpm": "pnpm"
|
||||||
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/pnpm"
|
"url": "https://opencollective.com/pnpm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pnpm/macos-arm64": {
|
"node_modules/@pnpm/macos-arm64": {
|
||||||
"version": "11.0.0-beta.4-1",
|
"version": "10.32.1",
|
||||||
"resolved": "https://registry.npmjs.org/@pnpm/macos-arm64/-/macos-arm64-11.0.0-beta.4-1.tgz",
|
"resolved": "https://registry.npmjs.org/@pnpm/macos-arm64/-/macos-arm64-10.32.1.tgz",
|
||||||
"integrity": "sha512-7iJdDfWaRWeoGBvU3gJcxbReYM83IhiWFZPHMSW+ga44W/qTzczYIeGeCorsxQRKBPnw2qK3hh9bevkyX6XOWw==",
|
"integrity": "sha512-Zr4JkhRbtGVsYgbuGZO0dq/6FPOn072Pdo0ubmqWtc14cUATKgAJD7efG03yqr3MLgtwFHgdtUzZ1WsaYAtUTA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -79,14 +79,17 @@
|
|||||||
"os": [
|
"os": [
|
||||||
"darwin"
|
"darwin"
|
||||||
],
|
],
|
||||||
|
"bin": {
|
||||||
|
"pnpm": "pnpm"
|
||||||
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/pnpm"
|
"url": "https://opencollective.com/pnpm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pnpm/macos-x64": {
|
"node_modules/@pnpm/macos-x64": {
|
||||||
"version": "11.0.0-beta.4-1",
|
"version": "10.32.1",
|
||||||
"resolved": "https://registry.npmjs.org/@pnpm/macos-x64/-/macos-x64-11.0.0-beta.4-1.tgz",
|
"resolved": "https://registry.npmjs.org/@pnpm/macos-x64/-/macos-x64-10.32.1.tgz",
|
||||||
"integrity": "sha512-wREXbc2hrSd6r/dyPYuFIkkFoIbtmke5rlJrcITe65OvIQmSW+Fp3X8PBIYcnx3lJyk4809YlqI184yovUaMZA==",
|
"integrity": "sha512-Yk6q3oFDu//OniXJxfTSHo+aew1LX81FcbzJAtEkcCeTQ0SLbQT6J3QiOMNikp8n8IjNhsy+bn2bdkUxaw+akA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -95,14 +98,17 @@
|
|||||||
"os": [
|
"os": [
|
||||||
"darwin"
|
"darwin"
|
||||||
],
|
],
|
||||||
|
"bin": {
|
||||||
|
"pnpm": "pnpm"
|
||||||
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/pnpm"
|
"url": "https://opencollective.com/pnpm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pnpm/win-arm64": {
|
"node_modules/@pnpm/win-arm64": {
|
||||||
"version": "11.0.0-beta.4-1",
|
"version": "10.32.1",
|
||||||
"resolved": "https://registry.npmjs.org/@pnpm/win-arm64/-/win-arm64-11.0.0-beta.4-1.tgz",
|
"resolved": "https://registry.npmjs.org/@pnpm/win-arm64/-/win-arm64-10.32.1.tgz",
|
||||||
"integrity": "sha512-ygHjDdc0h2uCIcBa30Cnd2ciGWFNC0qm2t0w88PYEC/1rmbGCDfqeGtf/8R8THzTVOuw/pOzIDTs6QEhB6aPOg==",
|
"integrity": "sha512-P8rsP5IUetpYjr2iwggoswL2qUukYrJoToXWuMyo8immn58CsYxaXsHVQ1Oq1R3XMfmGGWTXLsiJuQ7H991MRg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -111,14 +117,17 @@
|
|||||||
"os": [
|
"os": [
|
||||||
"win32"
|
"win32"
|
||||||
],
|
],
|
||||||
|
"bin": {
|
||||||
|
"pnpm": "pnpm.exe"
|
||||||
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/pnpm"
|
"url": "https://opencollective.com/pnpm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pnpm/win-x64": {
|
"node_modules/@pnpm/win-x64": {
|
||||||
"version": "11.0.0-beta.4-1",
|
"version": "10.32.1",
|
||||||
"resolved": "https://registry.npmjs.org/@pnpm/win-x64/-/win-x64-11.0.0-beta.4-1.tgz",
|
"resolved": "https://registry.npmjs.org/@pnpm/win-x64/-/win-x64-10.32.1.tgz",
|
||||||
"integrity": "sha512-//5eHf7Zw4MtgJhlD4VUbemngxMnhwySgZNGu0ngkNBRVjnESE7NoXZZ5kHIdatv6VQpqkCthNZrheaiJedSGw==",
|
"integrity": "sha512-i24GwbtBO8ojrhp8WWimX7NgZs0UKH1171oRt6qcRL+a+FxE0Eggv2y0KP7ZI7F3+LZMarwr3tnYsZryfciUOg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -127,156 +136,12 @@
|
|||||||
"os": [
|
"os": [
|
||||||
"win32"
|
"win32"
|
||||||
],
|
],
|
||||||
|
"bin": {
|
||||||
|
"pnpm": "pnpm.exe"
|
||||||
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/pnpm"
|
"url": "https://opencollective.com/pnpm"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"node_modules/@reflink/reflink": {
|
|
||||||
"version": "0.1.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/@reflink/reflink/-/reflink-0.1.19.tgz",
|
|
||||||
"integrity": "sha512-DmCG8GzysnCZ15bres3N5AHCmwBwYgp0As6xjhQ47rAUTUXxJiK+lLUxaGsX3hd/30qUpVElh05PbGuxRPgJwA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
|
||||||
"@reflink/reflink-darwin-arm64": "0.1.19",
|
|
||||||
"@reflink/reflink-darwin-x64": "0.1.19",
|
|
||||||
"@reflink/reflink-linux-arm64-gnu": "0.1.19",
|
|
||||||
"@reflink/reflink-linux-arm64-musl": "0.1.19",
|
|
||||||
"@reflink/reflink-linux-x64-gnu": "0.1.19",
|
|
||||||
"@reflink/reflink-linux-x64-musl": "0.1.19",
|
|
||||||
"@reflink/reflink-win32-arm64-msvc": "0.1.19",
|
|
||||||
"@reflink/reflink-win32-x64-msvc": "0.1.19"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@reflink/reflink-darwin-arm64": {
|
|
||||||
"version": "0.1.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/@reflink/reflink-darwin-arm64/-/reflink-darwin-arm64-0.1.19.tgz",
|
|
||||||
"integrity": "sha512-ruy44Lpepdk1FqDz38vExBY/PVUsjxZA+chd9wozjUH9JjuDT/HEaQYA6wYN9mf041l0yLVar6BCZuWABJvHSA==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@reflink/reflink-darwin-x64": {
|
|
||||||
"version": "0.1.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/@reflink/reflink-darwin-x64/-/reflink-darwin-x64-0.1.19.tgz",
|
|
||||||
"integrity": "sha512-By85MSWrMZa+c26TcnAy8SDk0sTUkYlNnwknSchkhHpGXOtjNDUOxJE9oByBnGbeuIE1PiQsxDG3Ud+IVV9yuA==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@reflink/reflink-linux-arm64-gnu": {
|
|
||||||
"version": "0.1.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/@reflink/reflink-linux-arm64-gnu/-/reflink-linux-arm64-gnu-0.1.19.tgz",
|
|
||||||
"integrity": "sha512-7P+er8+rP9iNeN+bfmccM4hTAaLP6PQJPKWSA4iSk2bNvo6KU6RyPgYeHxXmzNKzPVRcypZQTpFgstHam6maVg==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@reflink/reflink-linux-arm64-musl": {
|
|
||||||
"version": "0.1.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/@reflink/reflink-linux-arm64-musl/-/reflink-linux-arm64-musl-0.1.19.tgz",
|
|
||||||
"integrity": "sha512-37iO/Dp6m5DDaC2sf3zPtx/hl9FV3Xze4xoYidrxxS9bgP3S8ALroxRK6xBG/1TtfXKTvolvp+IjrUU6ujIGmA==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@reflink/reflink-linux-x64-gnu": {
|
|
||||||
"version": "0.1.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/@reflink/reflink-linux-x64-gnu/-/reflink-linux-x64-gnu-0.1.19.tgz",
|
|
||||||
"integrity": "sha512-jbI8jvuYCaA3MVUdu8vLoLAFqC+iNMpiSuLbxlAgg7x3K5bsS8nOpTRnkLF7vISJ+rVR8W+7ThXlXlUQ93ulkw==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@reflink/reflink-linux-x64-musl": {
|
|
||||||
"version": "0.1.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/@reflink/reflink-linux-x64-musl/-/reflink-linux-x64-musl-0.1.19.tgz",
|
|
||||||
"integrity": "sha512-e9FBWDe+lv7QKAwtKOt6A2W/fyy/aEEfr0g6j/hWzvQcrzHCsz07BNQYlNOjTfeytrtLU7k449H1PI95jA4OjQ==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@reflink/reflink-win32-arm64-msvc": {
|
|
||||||
"version": "0.1.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/@reflink/reflink-win32-arm64-msvc/-/reflink-win32-arm64-msvc-0.1.19.tgz",
|
|
||||||
"integrity": "sha512-09PxnVIQcd+UOn4WAW73WU6PXL7DwGS6wPlkMhMg2zlHHG65F3vHepOw06HFCq+N42qkaNAc8AKIabWvtk6cIQ==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"win32"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@reflink/reflink-win32-x64-msvc": {
|
|
||||||
"version": "0.1.19",
|
|
||||||
"resolved": "https://registry.npmjs.org/@reflink/reflink-win32-x64-msvc/-/reflink-win32-x64-msvc-0.1.19.tgz",
|
|
||||||
"integrity": "sha512-E//yT4ni2SyhwP8JRjVGWr3cbnhWDiPLgnQ66qqaanjjnMiu3O/2tjCPQXlcGc/DEYofpDc9fvhv6tALQsMV9w==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"win32"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,22 +5,20 @@
|
|||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pnpm": "11.0.0-beta.4-1"
|
"pnpm": "latest"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/pnpm": {
|
"node_modules/pnpm": {
|
||||||
"version": "11.0.0-beta.4-1",
|
"version": "10.32.1",
|
||||||
"resolved": "https://registry.npmjs.org/pnpm/-/pnpm-11.0.0-beta.4-1.tgz",
|
"resolved": "https://registry.npmjs.org/pnpm/-/pnpm-10.32.1.tgz",
|
||||||
"integrity": "sha512-zkZWSclaXz4NI43dkF0uYx8bGXjoy7T1KNPKjaGt1pQcJVD6foShIVum5dO47t5hpTvDNfPUGUGxXcM/RXRZRQ==",
|
"integrity": "sha512-pwaTjw6JrBRWtlY+q07fHR+vM2jRGR/FxZeQ6W3JGORFarLmfWE94QQ9LoyB+HMD5rQNT/7KnfFe8a1Wc0jyvg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"pn": "bin/pnpm.mjs",
|
"pnpm": "bin/pnpm.cjs",
|
||||||
"pnpm": "bin/pnpm.mjs",
|
"pnpx": "bin/pnpx.cjs"
|
||||||
"pnpx": "bin/pnpx.mjs",
|
|
||||||
"pnx": "bin/pnpx.mjs"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=22.13"
|
"node": ">=18.12"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/pnpm"
|
"url": "https://opencollective.com/pnpm"
|
||||||
|
|||||||
@@ -13,12 +13,7 @@ const BOOTSTRAP_PNPM_PACKAGE_JSON = JSON.stringify({ private: true, dependencies
|
|||||||
const BOOTSTRAP_EXE_PACKAGE_JSON = JSON.stringify({ private: true, dependencies: { '@pnpm/exe': exeLock.packages['node_modules/@pnpm/exe'].version } })
|
const BOOTSTRAP_EXE_PACKAGE_JSON = JSON.stringify({ private: true, dependencies: { '@pnpm/exe': exeLock.packages['node_modules/@pnpm/exe'].version } })
|
||||||
|
|
||||||
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||||
const { version, dest, packageJsonFile } = inputs
|
const { version, dest, packageJsonFile, standalone } = inputs
|
||||||
|
|
||||||
// pnpm v11 requires Node >= 22.13; use standalone (exe) bootstrap which
|
|
||||||
// bundles its own Node.js when the system Node is too old
|
|
||||||
const systemNode = await getSystemNodeVersion()
|
|
||||||
const standalone = inputs.standalone || systemNode.major < 22 || (systemNode.major === 22 && systemNode.minor < 13)
|
|
||||||
|
|
||||||
// Install bootstrap pnpm via npm (integrity verified by committed lockfile)
|
// Install bootstrap pnpm via npm (integrity verified by committed lockfile)
|
||||||
await rm(dest, { recursive: true, force: true })
|
await rm(dest, { recursive: true, force: true })
|
||||||
@@ -34,34 +29,24 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
|||||||
return npmExitCode
|
return npmExitCode
|
||||||
}
|
}
|
||||||
|
|
||||||
// On Windows with standalone mode, npm's .bin shims can't properly
|
const pnpmHome = path.join(dest, 'node_modules', '.bin')
|
||||||
// execute the extensionless @pnpm/exe native binaries. Add the
|
|
||||||
// @pnpm/exe directory directly to PATH so pnpm.exe is found natively.
|
|
||||||
const pnpmHome = standalone && process.platform === 'win32'
|
|
||||||
? path.join(dest, 'node_modules', '@pnpm', 'exe')
|
|
||||||
: path.join(dest, 'node_modules', '.bin')
|
|
||||||
// pnpm expects PNPM_HOME/bin in PATH for global binaries (e.g. node
|
|
||||||
// installed via `pnpm runtime`). Add it first so the next addPath
|
|
||||||
// (pnpmHome itself, which contains pnpm.exe) has higher precedence.
|
|
||||||
addPath(path.join(pnpmHome, 'bin'))
|
|
||||||
addPath(pnpmHome)
|
addPath(pnpmHome)
|
||||||
|
addPath(path.join(pnpmHome, 'bin'))
|
||||||
exportVariable('PNPM_HOME', pnpmHome)
|
exportVariable('PNPM_HOME', pnpmHome)
|
||||||
|
|
||||||
// Ensure pnpm bin link exists — npm ci sometimes doesn't create it
|
// Ensure pnpm bin link exists — npm ci sometimes doesn't create it
|
||||||
if (process.platform !== 'win32') {
|
const pnpmBinLink = path.join(pnpmHome, 'pnpm')
|
||||||
const pnpmBinLink = path.join(dest, 'node_modules', '.bin', 'pnpm')
|
if (!existsSync(pnpmBinLink)) {
|
||||||
if (!existsSync(pnpmBinLink)) {
|
await mkdir(pnpmHome, { recursive: true })
|
||||||
await mkdir(path.join(dest, 'node_modules', '.bin'), { recursive: true })
|
const target = standalone
|
||||||
const target = standalone
|
? path.join('..', '@pnpm', 'exe', 'pnpm')
|
||||||
? path.join('..', '@pnpm', 'exe', 'pnpm')
|
: path.join('..', 'pnpm', 'bin', 'pnpm.cjs')
|
||||||
: path.join('..', 'pnpm', 'bin', 'pnpm.mjs')
|
await symlink(target, pnpmBinLink)
|
||||||
await symlink(target, pnpmBinLink)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bootstrapPnpm = standalone
|
const bootstrapPnpm = standalone
|
||||||
? path.join(dest, 'node_modules', '@pnpm', 'exe', process.platform === 'win32' ? 'pnpm.exe' : 'pnpm')
|
? path.join(dest, 'node_modules', '@pnpm', 'exe', 'pnpm')
|
||||||
: path.join(dest, 'node_modules', 'pnpm', 'bin', 'pnpm.mjs')
|
: path.join(dest, 'node_modules', 'pnpm', 'bin', 'pnpm.cjs')
|
||||||
|
|
||||||
// Determine the target version
|
// Determine the target version
|
||||||
const targetVersion = readTargetVersion({ version, packageJsonFile })
|
const targetVersion = readTargetVersion({ version, packageJsonFile })
|
||||||
@@ -85,17 +70,15 @@ function readTargetVersion(opts: {
|
|||||||
const { version, packageJsonFile } = opts
|
const { version, packageJsonFile } = opts
|
||||||
const { GITHUB_WORKSPACE } = process.env
|
const { GITHUB_WORKSPACE } = process.env
|
||||||
|
|
||||||
let packageManager: string | undefined
|
let packageManager: unknown
|
||||||
let devEngines: { packageManager?: { name?: string; version?: string } } | undefined
|
|
||||||
|
|
||||||
if (GITHUB_WORKSPACE) {
|
if (GITHUB_WORKSPACE) {
|
||||||
try {
|
try {
|
||||||
const content = readFileSync(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8');
|
const content = readFileSync(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8');
|
||||||
const manifest = packageJsonFile.endsWith(".yaml")
|
({ packageManager } = packageJsonFile.endsWith(".yaml")
|
||||||
? parseYaml(content, { merge: true })
|
? parseYaml(content, { merge: true })
|
||||||
: JSON.parse(content)
|
: JSON.parse(content)
|
||||||
packageManager = manifest.packageManager
|
)
|
||||||
devEngines = manifest.devEngines
|
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
// Swallow error if package.json doesn't exist in root
|
// Swallow error if package.json doesn't exist in root
|
||||||
if (!util.types.isNativeError(error) || !('code' in error) || error.code !== 'ENOENT') throw error
|
if (!util.types.isNativeError(error) || !('code' in error) || error.code !== 'ENOENT') throw error
|
||||||
@@ -117,12 +100,8 @@ Remove one of these versions to avoid version mismatch errors like ERR_PNPM_BAD_
|
|||||||
return version
|
return version
|
||||||
}
|
}
|
||||||
|
|
||||||
// pnpm will automatically download and switch to the right version
|
|
||||||
if (typeof packageManager === 'string' && packageManager.startsWith('pnpm@')) {
|
if (typeof packageManager === 'string' && packageManager.startsWith('pnpm@')) {
|
||||||
return undefined
|
// pnpm will handle version management via packageManager field
|
||||||
}
|
|
||||||
|
|
||||||
if (devEngines?.packageManager?.name === 'pnpm' && devEngines.packageManager.version) {
|
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,21 +115,7 @@ Otherwise, please specify the pnpm version in the action configuration.`)
|
|||||||
throw new Error(`No pnpm version is specified.
|
throw new Error(`No pnpm version is specified.
|
||||||
Please specify it by one of the following ways:
|
Please specify it by one of the following ways:
|
||||||
- in the GitHub Action config with the key "version"
|
- in the GitHub Action config with the key "version"
|
||||||
- in the package.json with the key "packageManager"
|
- in the package.json with the key "packageManager"`)
|
||||||
- in the package.json with the key "devEngines.packageManager"`)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSystemNodeVersion(): Promise<{ major: number; minor: number }> {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
const cp = spawn('node', ['--version'], { stdio: ['pipe', 'pipe', 'pipe'], shell: process.platform === 'win32' })
|
|
||||||
let output = ''
|
|
||||||
cp.stdout.on('data', (data: Buffer) => { output += data.toString() })
|
|
||||||
cp.on('close', () => {
|
|
||||||
const match = output.match(/^v(\d+)\.(\d+)/)
|
|
||||||
resolve(match ? { major: parseInt(match[1], 10), minor: parseInt(match[2], 10) } : { major: 0, minor: 0 })
|
|
||||||
})
|
|
||||||
cp.on('error', () => resolve({ major: 0, minor: 0 }))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function runCommand(cmd: string, args: string[], opts: { cwd: string }): Promise<number> {
|
function runCommand(cmd: string, args: string[], opts: { cwd: string }): Promise<number> {
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { setOutput } from '@actions/core'
|
import { setOutput, addPath } from '@actions/core'
|
||||||
import { Inputs } from '../inputs'
|
import { Inputs } from '../inputs'
|
||||||
import { getBinDest } from '../utils'
|
import { getBinDest } from '../utils'
|
||||||
|
|
||||||
export function setOutputs(inputs: Inputs) {
|
export function setOutputs(inputs: Inputs) {
|
||||||
const binDest = getBinDest(inputs)
|
const binDest = getBinDest(inputs)
|
||||||
// NOTE: addPath is already called in installPnpm — do not call it again
|
addPath(binDest)
|
||||||
// here, as a second addPath would shadow the correct entry on Windows.
|
|
||||||
setOutput('dest', inputs.dest)
|
setOutput('dest', inputs.dest)
|
||||||
setOutput('bin_dest', binDest)
|
setOutput('bin_dest', binDest)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user