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

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);