mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-29 20:41:47 -04:00
fix: remove bin fields from exe artifact packages
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
"@pnpm/linux-arm64": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"bin": {
|
||||
"pnpm": "pnpm"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
"@pnpm/linux-x64": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"bin": {
|
||||
"pnpm": "pnpm"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
"@pnpm/macos-arm64": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"bin": {
|
||||
"pnpm": "pnpm"
|
||||
},
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
"@pnpm/macos-x64": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"bin": {
|
||||
"pnpm": "pnpm"
|
||||
},
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
"@pnpm/win-arm64": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"bin": {
|
||||
"pnpm": "pnpm.exe"
|
||||
},
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
"@pnpm/win-x64": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"bin": {
|
||||
"pnpm": "pnpm.exe"
|
||||
},
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user