Skip to content

Commit b196fe8

Browse files
committed
Merge branch 'master' into fix/skip-install-if-existing
2 parents c320937 + 6e7bdbd commit b196fe8

File tree

5 files changed

+88
-40
lines changed

5 files changed

+88
-40
lines changed

dist/index.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"scripts": {
44
"build:bundle": "esbuild src/index.ts --bundle --platform=node --target=node24 --format=cjs --minify --outfile=dist/index.js --loader:.json=json",
55
"build": "pnpm run build:bundle",
6-
"start": "pnpm run build && sh ./run.sh"
6+
"start": "pnpm run build && sh ./run.sh",
7+
"update-bootstrap": "node scripts/update-bootstrap.mjs"
78
},
89
"dependencies": {
910
"@actions/cache": "^4.1.0",

scripts/update-bootstrap.mjs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env node
2+
3+
// Usage: node scripts/update-bootstrap.mjs [version]
4+
// If version is omitted, fetches the latest next-11 tag from npm.
5+
// Regenerates the bootstrap lockfiles used by action-setup to install pnpm via npm.
6+
7+
import { execSync } from 'child_process'
8+
import { mkdtempSync, rmSync, readFileSync, writeFileSync } from 'fs'
9+
import { join } from 'path'
10+
import { tmpdir } from 'os'
11+
12+
const BOOTSTRAP_DIR = new URL('../src/install-pnpm/bootstrap/', import.meta.url).pathname
13+
14+
const version = process.argv[2] || resolveLatestVersion()
15+
16+
console.log(`Updating bootstrap lockfiles to pnpm@${version} ...`)
17+
18+
generateLock('pnpm-lock.json', { pnpm: version }, 'bootstrap-pnpm')
19+
generateLock('exe-lock.json', { '@pnpm/exe': version }, 'bootstrap-exe')
20+
21+
console.log('Done!')
22+
23+
function resolveLatestVersion() {
24+
const json = execSync('npm view @pnpm/exe dist-tags --json', { encoding: 'utf8' })
25+
const tags = JSON.parse(json)
26+
const version = tags['next-11'] || tags['latest']
27+
if (!version) {
28+
console.error('Could not determine latest pnpm version from npm dist-tags')
29+
process.exit(1)
30+
}
31+
return version
32+
}
33+
34+
function generateLock(filename, dependencies, name) {
35+
const tmp = mkdtempSync(join(tmpdir(), 'pnpm-bootstrap-'))
36+
try {
37+
writeFileSync(join(tmp, 'package.json'), JSON.stringify({ private: true, dependencies }))
38+
execSync('npm install --package-lock-only --ignore-scripts', { cwd: tmp, stdio: 'pipe' })
39+
const lock = readFileSync(join(tmp, 'package-lock.json'), 'utf8')
40+
const parsed = JSON.parse(lock)
41+
parsed.name = name
42+
writeFileSync(join(BOOTSTRAP_DIR, filename), JSON.stringify(parsed, null, 2) + '\n')
43+
console.log(` ${filename} -> ${Object.values(dependencies)[0]}@${version}`)
44+
} finally {
45+
rmSync(tmp, { recursive: true, force: true })
46+
}
47+
}

src/install-pnpm/bootstrap/exe-lock.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"packages": {
66
"": {
77
"dependencies": {
8-
"@pnpm/exe": "11.0.0-beta.3"
8+
"@pnpm/exe": "11.0.0-beta.4-1"
99
}
1010
},
1111
"node_modules/@pnpm/exe": {
12-
"version": "11.0.0-beta.3",
13-
"resolved": "https://registry.npmjs.org/@pnpm/exe/-/exe-11.0.0-beta.3.tgz",
14-
"integrity": "sha512-yWNlHHdYmvf4c0MCkCzAa4csJDPdA+7yJCbXBUDXMbUu/0Zv/AxtO77q24MwlnBUC0dWeA+0F/pPmdkR9aTV2A==",
12+
"version": "11.0.0-beta.4-1",
13+
"resolved": "https://registry.npmjs.org/@pnpm/exe/-/exe-11.0.0-beta.4-1.tgz",
14+
"integrity": "sha512-2VzvynS54qE+Q0LGXzTCFKChq79Yr1xKLTAEkvIcBLoM+puRuI3xyrqtWx47esxhjbQlF0jRUyU8ISbSG92yBQ==",
1515
"hasInstallScript": true,
1616
"license": "MIT",
1717
"dependencies": {
@@ -27,18 +27,18 @@
2727
"url": "https://opencollective.com/pnpm"
2828
},
2929
"optionalDependencies": {
30-
"@pnpm/linux-arm64": "11.0.0-beta.3",
31-
"@pnpm/linux-x64": "11.0.0-beta.3",
32-
"@pnpm/macos-arm64": "11.0.0-beta.3",
33-
"@pnpm/macos-x64": "11.0.0-beta.3",
34-
"@pnpm/win-arm64": "11.0.0-beta.3",
35-
"@pnpm/win-x64": "11.0.0-beta.3"
30+
"@pnpm/linux-arm64": "11.0.0-beta.4-1",
31+
"@pnpm/linux-x64": "11.0.0-beta.4-1",
32+
"@pnpm/macos-arm64": "11.0.0-beta.4-1",
33+
"@pnpm/macos-x64": "11.0.0-beta.4-1",
34+
"@pnpm/win-arm64": "11.0.0-beta.4-1",
35+
"@pnpm/win-x64": "11.0.0-beta.4-1"
3636
}
3737
},
3838
"node_modules/@pnpm/linux-arm64": {
39-
"version": "11.0.0-beta.3",
40-
"resolved": "https://registry.npmjs.org/@pnpm/linux-arm64/-/linux-arm64-11.0.0-beta.3.tgz",
41-
"integrity": "sha512-TF2fyuCY9GggR4kfhjo1hMmgn+rIohenwNoH0tLPM7JlBK7/UAIFt1LI+o999tRwTCEw7gnxHFwtI2vyQuDfNw==",
39+
"version": "11.0.0-beta.4-1",
40+
"resolved": "https://registry.npmjs.org/@pnpm/linux-arm64/-/linux-arm64-11.0.0-beta.4-1.tgz",
41+
"integrity": "sha512-aPf2hhCwWQQ1vNm3Sxq6BLtqnvv6eZ8iJq/oqJOm2WFzq9l59jbmn0eaUtDOlafjfzkijqg+cj46h0XT2Dqsfw==",
4242
"cpu": [
4343
"arm64"
4444
],
@@ -52,9 +52,9 @@
5252
}
5353
},
5454
"node_modules/@pnpm/linux-x64": {
55-
"version": "11.0.0-beta.3",
56-
"resolved": "https://registry.npmjs.org/@pnpm/linux-x64/-/linux-x64-11.0.0-beta.3.tgz",
57-
"integrity": "sha512-7GrLsnSuDH62y486GUTwJdohGIC1ugz9ZJkbKOHgxIAkNGcSTJ1IkkdARtv7/WMmOEwwESDmtpOQ6LmjnpDMSA==",
55+
"version": "11.0.0-beta.4-1",
56+
"resolved": "https://registry.npmjs.org/@pnpm/linux-x64/-/linux-x64-11.0.0-beta.4-1.tgz",
57+
"integrity": "sha512-1hTcyZSVJWpPNHs3u7RbfbAmZXPBLIZQVt/z1XjcDnzI8S49NGIvir876/gq9jL69ZPoE1a6z+qSe3zUPmw0ng==",
5858
"cpu": [
5959
"x64"
6060
],
@@ -68,9 +68,9 @@
6868
}
6969
},
7070
"node_modules/@pnpm/macos-arm64": {
71-
"version": "11.0.0-beta.3",
72-
"resolved": "https://registry.npmjs.org/@pnpm/macos-arm64/-/macos-arm64-11.0.0-beta.3.tgz",
73-
"integrity": "sha512-NQKgI1DURrEiOUzpxL0Mc+yn7DV4tpShqGnjaJLbz8ZCXsX/qhmybebvCG3r+IfSk3P5KID66lcgC/Osiaz0Dg==",
71+
"version": "11.0.0-beta.4-1",
72+
"resolved": "https://registry.npmjs.org/@pnpm/macos-arm64/-/macos-arm64-11.0.0-beta.4-1.tgz",
73+
"integrity": "sha512-7iJdDfWaRWeoGBvU3gJcxbReYM83IhiWFZPHMSW+ga44W/qTzczYIeGeCorsxQRKBPnw2qK3hh9bevkyX6XOWw==",
7474
"cpu": [
7575
"arm64"
7676
],
@@ -84,9 +84,9 @@
8484
}
8585
},
8686
"node_modules/@pnpm/macos-x64": {
87-
"version": "11.0.0-beta.3",
88-
"resolved": "https://registry.npmjs.org/@pnpm/macos-x64/-/macos-x64-11.0.0-beta.3.tgz",
89-
"integrity": "sha512-Ky22KFYHXx8+8WU4KJT9NXVgzFioL2w9pHTQjsqTK70AbxiErscPYhrFIehlCNbXjgs+tGVIy13QNKkiwvmS8w==",
87+
"version": "11.0.0-beta.4-1",
88+
"resolved": "https://registry.npmjs.org/@pnpm/macos-x64/-/macos-x64-11.0.0-beta.4-1.tgz",
89+
"integrity": "sha512-wREXbc2hrSd6r/dyPYuFIkkFoIbtmke5rlJrcITe65OvIQmSW+Fp3X8PBIYcnx3lJyk4809YlqI184yovUaMZA==",
9090
"cpu": [
9191
"x64"
9292
],
@@ -100,9 +100,9 @@
100100
}
101101
},
102102
"node_modules/@pnpm/win-arm64": {
103-
"version": "11.0.0-beta.3",
104-
"resolved": "https://registry.npmjs.org/@pnpm/win-arm64/-/win-arm64-11.0.0-beta.3.tgz",
105-
"integrity": "sha512-7L8TFNDm25m+XYSyhcola3YFd/li6BZzzl56SsyGnZabsvUslMwnDiJad48wOz8IuN7zsrTSGh+X/x6F+GdrFQ==",
103+
"version": "11.0.0-beta.4-1",
104+
"resolved": "https://registry.npmjs.org/@pnpm/win-arm64/-/win-arm64-11.0.0-beta.4-1.tgz",
105+
"integrity": "sha512-ygHjDdc0h2uCIcBa30Cnd2ciGWFNC0qm2t0w88PYEC/1rmbGCDfqeGtf/8R8THzTVOuw/pOzIDTs6QEhB6aPOg==",
106106
"cpu": [
107107
"arm64"
108108
],
@@ -116,9 +116,9 @@
116116
}
117117
},
118118
"node_modules/@pnpm/win-x64": {
119-
"version": "11.0.0-beta.3",
120-
"resolved": "https://registry.npmjs.org/@pnpm/win-x64/-/win-x64-11.0.0-beta.3.tgz",
121-
"integrity": "sha512-Z/6OpMUaIpggXjCtWEhp6kWjiT/2EImhkJAu8AodOORqeNcWouGEq3sO4XU0em6d+pAHmdV0hWMQ2xCUmPVuiA==",
119+
"version": "11.0.0-beta.4-1",
120+
"resolved": "https://registry.npmjs.org/@pnpm/win-x64/-/win-x64-11.0.0-beta.4-1.tgz",
121+
"integrity": "sha512-//5eHf7Zw4MtgJhlD4VUbemngxMnhwySgZNGu0ngkNBRVjnESE7NoXZZ5kHIdatv6VQpqkCthNZrheaiJedSGw==",
122122
"cpu": [
123123
"x64"
124124
],

src/install-pnpm/bootstrap/pnpm-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"packages": {
66
"": {
77
"dependencies": {
8-
"pnpm": "11.0.0-beta.3"
8+
"pnpm": "11.0.0-beta.4-1"
99
}
1010
},
1111
"node_modules/pnpm": {
12-
"version": "11.0.0-beta.3",
13-
"resolved": "https://registry.npmjs.org/pnpm/-/pnpm-11.0.0-beta.3.tgz",
14-
"integrity": "sha512-6PrfRjycZV4vRX6ttG9oR6pOgbI2/OcF2QLOzHm35UcRuvtqP4zf3wQfAAPwEbeu1uAbpSg/Q5cL8h32tumy6Q==",
12+
"version": "11.0.0-beta.4-1",
13+
"resolved": "https://registry.npmjs.org/pnpm/-/pnpm-11.0.0-beta.4-1.tgz",
14+
"integrity": "sha512-zkZWSclaXz4NI43dkF0uYx8bGXjoy7T1KNPKjaGt1pQcJVD6foShIVum5dO47t5hpTvDNfPUGUGxXcM/RXRZRQ==",
1515
"license": "MIT",
1616
"bin": {
1717
"pn": "bin/pnpm.mjs",

0 commit comments

Comments
 (0)