Skip to content

Commit 2caef9d

Browse files
committed
fix: use Node.js script for cross-platform node_modules cleanup
- Replace shell commands with Node.js fs.rmSync for platform compatibility - Works on Windows, Linux, and macOS without shell differences - Removes node_modules directory reliably across all GitHub Actions runners
1 parent 2d5999d commit 2caef9d

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,7 @@ jobs:
3333
with:
3434
node-version: 20
3535
- name: Clean up
36-
run: |
37-
if [ "$RUNNER_OS" == "Windows" ]; then
38-
Remove-Item -Recurse -Force node_modules -ErrorAction SilentlyContinue
39-
else
40-
rm -rf node_modules || true
41-
fi
42-
npm cache clean --force || true
43-
shell: bash
36+
run: node -e "const fs = require('fs'); const path = require('path'); const nodeModules = path.join(process.cwd(), 'node_modules'); try { if (fs.existsSync(nodeModules)) { fs.rmSync(nodeModules, { recursive: true, force: true }); console.log('Removed node_modules'); } else { console.log('node_modules not found'); } } catch (e) { console.log('Error removing node_modules:', e.message); }"
4437
- run: npm ci
4538
- name: add macos cert
4639
if: contains(matrix.os.name, 'macos')

0 commit comments

Comments
 (0)