Skip to content

Commit

Permalink
fix: spawn npm with shell: true on Windows (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Apr 17, 2024
1 parent a21c20e commit 65db8fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
Expand All @@ -55,10 +55,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
Expand Down Expand Up @@ -90,14 +90,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
npm publish
- name: Create Github Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
4 changes: 4 additions & 0 deletions src/lib/package-managers/npm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,15 @@ export class Npm extends PackageManager {
args: string[],
options: execa.Options<string> = {},
): Promise<CommandResult> {
const isWindows = process.platform === "win32";
const promise = execa("npm", args, {
...options,
cwd: this.cwd,
reject: false,
all: true,
// Windows needs shell to be true to execute npm
// https://github.com/nodejs/node/releases/tag/v18.20.2
shell: isWindows,
});

// Pipe command outputs if desired
Expand Down

0 comments on commit 65db8fe

Please sign in to comment.