Skip to content

Commit b63be4b

Browse files
committed
fix(expo/ios): use dynamic lookup to find path to migration script
Changed the `PRISMA_MIGRATIONS` variable to use the Node binary set by Expo for looking up where `@prisma/react-native` is installed. This allows using `@prisma/react-native` in a monorepo where the `node_modules/` folder may be hoisted to the top level of the workspace. The commit also cleans up extraneous leading whitespace from the commands added by the Expo config plugin.
1 parent a2f22b1 commit b63be4b

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

plugin/src/withPrismaIOS.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@ export function modifyExistingXcodeBuildScript(script: BuildPhase): void {
2626
}
2727

2828
export function addPrismMigrationScriptCopy(script: string): string {
29-
return (
30-
script +
31-
`
32-
33-
PRISMA_MIGRATIONS="../node_modules/@prisma/react-native/copy-migrations.sh"
34-
chmod a+x ../node_modules/@prisma/react-native/copy-migrations.sh
35-
36-
/bin/sh -c "$PRISMA_MIGRATIONS"`
37-
);
29+
return [
30+
script,
31+
`PRISMA_MIGRATIONS=\`"$NODE_BINARY" --print "require('path').dirname(require.resolve('@prisma/react-native/package.json')) + '/copy-migrations.sh'"\``,
32+
'chmod a+x "$PRISMA_MIGRATIONS"',
33+
'/bin/sh -c "$PRISMA_MIGRATIONS"',
34+
].join('\n');
3835
}

0 commit comments

Comments
 (0)