mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-25 15:07:06 -04:00
feat(setup): stop creating windows scripts on posix (#8418)
This commit is contained in:
6
.changeset/four-clocks-cry.md
Normal file
6
.changeset/four-clocks-cry.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-setup": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
`pnpm setup` no longer creates Batch/Powershell scripts on Linux and macOS.
|
||||
@@ -72,20 +72,23 @@ function createPnpxScripts (targetDir: string): void {
|
||||
|
||||
fs.mkdirSync(targetDir, { recursive: true })
|
||||
|
||||
// windows can also use shell script via mingw or cygwin so no filter
|
||||
const shellScript = [
|
||||
'#!/bin/sh',
|
||||
'exec pnpm dlx "$@"',
|
||||
].join('\n')
|
||||
fs.writeFileSync(path.join(targetDir, 'pnpx'), shellScript, { mode: 0o755 })
|
||||
|
||||
const batchScript = [
|
||||
'@echo off',
|
||||
'pnpm dlx %*',
|
||||
].join('\n')
|
||||
fs.writeFileSync(path.join(targetDir, 'pnpx.cmd'), batchScript)
|
||||
if (process.platform === 'win32') {
|
||||
const batchScript = [
|
||||
'@echo off',
|
||||
'pnpm dlx %*',
|
||||
].join('\n')
|
||||
fs.writeFileSync(path.join(targetDir, 'pnpx.cmd'), batchScript)
|
||||
|
||||
const powershellScript = 'pnpm dlx $args'
|
||||
fs.writeFileSync(path.join(targetDir, 'pnpx.ps1'), powershellScript)
|
||||
const powershellScript = 'pnpm dlx $args'
|
||||
fs.writeFileSync(path.join(targetDir, 'pnpx.ps1'), powershellScript)
|
||||
}
|
||||
}
|
||||
|
||||
export async function handler (
|
||||
|
||||
Reference in New Issue
Block a user