From ea5ccfee4be58849f77cf8fa631b1cf53c068cfa Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 24 Feb 2026 10:36:36 +0100 Subject: [PATCH] fix: remove bin fields from exe artifact packages --- pnpm/artifacts/exe/setup.js | 26 +++++++++++-------------- pnpm/artifacts/linux-arm64/package.json | 3 --- pnpm/artifacts/linux-x64/package.json | 3 --- pnpm/artifacts/macos-arm64/package.json | 3 --- pnpm/artifacts/macos-x64/package.json | 3 --- pnpm/artifacts/win-arm64/package.json | 3 --- pnpm/artifacts/win-x64/package.json | 3 --- 7 files changed, 11 insertions(+), 33 deletions(-) diff --git a/pnpm/artifacts/exe/setup.js b/pnpm/artifacts/exe/setup.js index e04c21fa6a..3beafe33bb 100644 --- a/pnpm/artifacts/exe/setup.js +++ b/pnpm/artifacts/exe/setup.js @@ -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) { diff --git a/pnpm/artifacts/linux-arm64/package.json b/pnpm/artifacts/linux-arm64/package.json index c3f3f6e06f..08f07d2c0b 100644 --- a/pnpm/artifacts/linux-arm64/package.json +++ b/pnpm/artifacts/linux-arm64/package.json @@ -23,9 +23,6 @@ "@pnpm/linux-arm64": "workspace:*" }, "publishConfig": { - "bin": { - "pnpm": "pnpm" - }, "os": [ "linux" ], diff --git a/pnpm/artifacts/linux-x64/package.json b/pnpm/artifacts/linux-x64/package.json index ad174473fd..620fb1a373 100644 --- a/pnpm/artifacts/linux-x64/package.json +++ b/pnpm/artifacts/linux-x64/package.json @@ -23,9 +23,6 @@ "@pnpm/linux-x64": "workspace:*" }, "publishConfig": { - "bin": { - "pnpm": "pnpm" - }, "os": [ "linux" ], diff --git a/pnpm/artifacts/macos-arm64/package.json b/pnpm/artifacts/macos-arm64/package.json index a05675a458..6bdfd4f2b9 100644 --- a/pnpm/artifacts/macos-arm64/package.json +++ b/pnpm/artifacts/macos-arm64/package.json @@ -23,9 +23,6 @@ "@pnpm/macos-arm64": "workspace:*" }, "publishConfig": { - "bin": { - "pnpm": "pnpm" - }, "os": [ "darwin" ], diff --git a/pnpm/artifacts/macos-x64/package.json b/pnpm/artifacts/macos-x64/package.json index cf9e6d4417..ca413c11ee 100644 --- a/pnpm/artifacts/macos-x64/package.json +++ b/pnpm/artifacts/macos-x64/package.json @@ -23,9 +23,6 @@ "@pnpm/macos-x64": "workspace:*" }, "publishConfig": { - "bin": { - "pnpm": "pnpm" - }, "os": [ "darwin" ], diff --git a/pnpm/artifacts/win-arm64/package.json b/pnpm/artifacts/win-arm64/package.json index d629ffdf6e..7b1361dfc8 100644 --- a/pnpm/artifacts/win-arm64/package.json +++ b/pnpm/artifacts/win-arm64/package.json @@ -23,9 +23,6 @@ "@pnpm/win-arm64": "workspace:*" }, "publishConfig": { - "bin": { - "pnpm": "pnpm.exe" - }, "os": [ "win32" ], diff --git a/pnpm/artifacts/win-x64/package.json b/pnpm/artifacts/win-x64/package.json index 274b8573ab..00051bb33e 100644 --- a/pnpm/artifacts/win-x64/package.json +++ b/pnpm/artifacts/win-x64/package.json @@ -23,9 +23,6 @@ "@pnpm/win-x64": "workspace:*" }, "publishConfig": { - "bin": { - "pnpm": "pnpm.exe" - }, "os": [ "win32" ],