Skip to content

Commit 563c948

Browse files
committed
Fix Windows build commands
1 parent a2df3bd commit 563c948

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ jobs:
4141
node-version: 20
4242

4343
- name: 🧹 Clean up environment
44-
shell: bash
44+
shell: pwsh
4545
run: |
46-
rm -rf node_modules
47-
rm -f package-lock.json
46+
if (Test-Path node_modules) { Remove-Item -Recurse -Force node_modules }
47+
if (Test-Path package-lock.json) { Remove-Item -Force package-lock.json }
4848
npm cache clean --force
4949
5050
- name: 📦 Install dependencies

src/ipc/handlers/app_handlers.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ export function getShellEnv(): NodeJS.ProcessEnv {
111111
import killPort from "kill-port";
112112
import util from "util";
113113
import log from "electron-log";
114+
115+
// Helper function to get cross-platform remove command
116+
function getCrossPlatformRemoveCommand(path: string): string {
117+
if (process.platform === "win32") {
118+
return `Remove-Item -Recurse -Force "${path}"`;
119+
} else {
120+
return `rm -rf "${path}"`;
121+
}
122+
}
114123
import {
115124
deploySupabaseFunctions,
116125
getSupabaseProjectName,
@@ -611,12 +620,12 @@ async function executeAppLocalNode({
611620
cwd: frontendPath
612621
},
613622
{
614-
command: "rm -rf node_modules package-lock.json && npm install --legacy-peer-deps",
623+
command: `${getCrossPlatformRemoveCommand("node_modules").replace(/"/g, '')} && rm -f package-lock.json && npm install --legacy-peer-deps`,
615624
description: "clean install with legacy peer deps",
616625
cwd: frontendPath
617626
},
618627
{
619-
command: "rm -rf node_modules && npm install",
628+
command: `${getCrossPlatformRemoveCommand("node_modules").replace(/"/g, '')} && npm install`,
620629
description: "clean standard install",
621630
cwd: frontendPath
622631
}
@@ -3138,7 +3147,7 @@ async function installNodejsDependenciesRobust(projectPath: string, componentTyp
31383147
try {
31393148
// Clean up and retry with legacy peer deps
31403149
const cleanupCommands = [
3141-
"rm -rf node_modules",
3150+
getCrossPlatformRemoveCommand("node_modules"),
31423151
"rm -f package-lock.json",
31433152
"npm install --legacy-peer-deps"
31443153
];

src/ipc/processors/executeAddDependency.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ import { promisify } from "node:util";
77

88
export const execPromise = promisify(exec);
99

10+
// Helper function to get cross-platform remove command
11+
function getCrossPlatformRemoveCommand(path: string): string {
12+
if (process.platform === "win32") {
13+
return `Remove-Item -Recurse -Force "${path}"`;
14+
} else {
15+
return `rm -rf "${path}"`;
16+
}
17+
}
18+
1019
export async function executeAddDependency({
1120
packages,
1221
message,
@@ -33,7 +42,7 @@ export async function executeAddDependency({
3342

3443
try {
3544
// Clean up potential corrupted files and temporary directories
36-
await execPromise(`rm -rf node_modules/.tmp-* node_modules/*_tmp_* node_modules/.pnpm-debug.log* node_modules/.*-* node_modules/*-*`, {
45+
await execPromise(`${getCrossPlatformRemoveCommand("node_modules/.tmp-*").replace(/"/g, '')} ${getCrossPlatformRemoveCommand("node_modules/*_tmp_*").replace(/"/g, '')} ${getCrossPlatformRemoveCommand("node_modules/.pnpm-debug.log*").replace(/"/g, '')} ${getCrossPlatformRemoveCommand("node_modules/.*-*").replace(/"/g, '')} ${getCrossPlatformRemoveCommand("node_modules/*-*").replace(/"/g, '')}`, {
3746
cwd: appPath,
3847
});
3948

0 commit comments

Comments
 (0)