Fix postinstall patches for partial workspace installs
This commit is contained in:
+1
-1
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user