Fix postinstall patches for partial workspace installs

This commit is contained in:
Mohamed Boudra
2026-02-04 23:46:54 +07:00
parent 8384b5facf
commit 0de8609e6a
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
"dev:server": "NODE_ENV=development tsx packages/server/scripts/dev-runner.ts",
"dev:app": "npm run start --workspace=@paseo/app",
"dev:website": "npm run dev --workspace=@paseo/website",
"postinstall": "patch-package",
"postinstall": "node scripts/postinstall-patches.mjs",
"build": "npm run build --workspaces --if-present",
"typecheck": "npm run typecheck --workspaces --if-present",
"test": "npm run test --workspaces --if-present",
+14
View File
@@ -0,0 +1,14 @@
import { existsSync } from "node:fs";
import { spawnSync } from "node:child_process";
// In CI we often install a single workspace (e.g. server/relay/website). Only apply patches
// when the patched dependency is actually present.
const hasDraggableFlatlist = existsSync("node_modules/react-native-draggable-flatlist");
if (!hasDraggableFlatlist) {
process.exit(0);
}
const cmd = process.platform === "win32" ? "patch-package.cmd" : "patch-package";
const result = spawnSync(cmd, { stdio: "inherit" });
process.exit(result.status ?? 1);