fix: remove bin fields from exe artifact packages

This commit is contained in:
Zoltan Kochan
2026-02-24 10:36:36 +01:00
parent debff6504f
commit ea5ccfee4b
7 changed files with 11 additions and 33 deletions

View File

@@ -11,24 +11,20 @@ const arch = platform === 'win' && process.arch === 'ia32' ? 'x86' : process.arc
const pkgName = `@pnpm/${platform}-${arch}`
const pkgJson = fileURLToPath(import.meta.resolve(`${pkgName}/package.json`))
const subpkg = JSON.parse(fs.readFileSync(pkgJson, 'utf8'))
const executable = platform === 'win' ? 'pnpm.exe' : 'pnpm'
const platformDir = path.dirname(pkgJson)
const bin = path.resolve(platformDir, executable)
if (subpkg.bin != null) {
const executable = subpkg.bin.pnpm
const platformDir = path.dirname(pkgJson)
const bin = path.resolve(platformDir, executable)
const ownDir = import.meta.dirname
const ownDir = import.meta.dirname
linkSync(bin, path.resolve(ownDir, executable))
linkSync(bin, path.resolve(ownDir, executable))
if (platform === 'win') {
const pkgJsonPath = path.resolve(ownDir, 'package.json')
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))
fs.writeFileSync(path.resolve(ownDir, 'pnpm'), 'This file intentionally left blank')
pkg.bin.pnpm = 'pnpm.exe'
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2))
}
if (platform === 'win') {
const pkgJsonPath = path.resolve(ownDir, 'package.json')
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))
fs.writeFileSync(path.resolve(ownDir, 'pnpm'), 'This file intentionally left blank')
pkg.bin.pnpm = 'pnpm.exe'
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2))
}
function linkSync(src, dest) {

View File

@@ -23,9 +23,6 @@
"@pnpm/linux-arm64": "workspace:*"
},
"publishConfig": {
"bin": {
"pnpm": "pnpm"
},
"os": [
"linux"
],

View File

@@ -23,9 +23,6 @@
"@pnpm/linux-x64": "workspace:*"
},
"publishConfig": {
"bin": {
"pnpm": "pnpm"
},
"os": [
"linux"
],

View File

@@ -23,9 +23,6 @@
"@pnpm/macos-arm64": "workspace:*"
},
"publishConfig": {
"bin": {
"pnpm": "pnpm"
},
"os": [
"darwin"
],

View File

@@ -23,9 +23,6 @@
"@pnpm/macos-x64": "workspace:*"
},
"publishConfig": {
"bin": {
"pnpm": "pnpm"
},
"os": [
"darwin"
],

View File

@@ -23,9 +23,6 @@
"@pnpm/win-arm64": "workspace:*"
},
"publishConfig": {
"bin": {
"pnpm": "pnpm.exe"
},
"os": [
"win32"
],

View File

@@ -23,9 +23,6 @@
"@pnpm/win-x64": "workspace:*"
},
"publishConfig": {
"bin": {
"pnpm": "pnpm.exe"
},
"os": [
"win32"
],