Skip to content

Commit d1da913

Browse files
committed
chore: fix pod install breaking when symlinked
Regressed with #445.
1 parent 71a02d2 commit d1da913

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,6 @@ SPEC CHECKSUMS:
481481
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
482482
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
483483

484-
PODFILE CHECKSUM: 8c25858b89fe1d79499ef9a7350b4dc1cf0e8913
484+
PODFILE CHECKSUM: 192c89b7b9691a138c7ae651924b80cf83bccf1e
485485

486-
COCOAPODS: 1.10.1
486+
COCOAPODS: 1.10.2

example/macos/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,4 +389,4 @@ SPEC CHECKSUMS:
389389

390390
PODFILE CHECKSUM: 3c90d49455189425443ac97fd0ecb40d4f3b6b78
391391

392-
COCOAPODS: 1.10.1
392+
COCOAPODS: 1.10.2

scripts/configure.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//
88
// @ts-check
99

10+
require("./link")(module);
11+
1012
const chalk = require("chalk");
1113
const fs = require("fs");
1214
const path = require("path");

scripts/link.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @ts-check
2+
3+
const path = require("path");
4+
5+
const localNodeModulesPath = path.join(process.cwd(), "node_modules");
6+
7+
/** @type {(module: NodeJS.Module) => void} */
8+
module.exports = (module) => {
9+
if (!module.paths.includes(localNodeModulesPath)) {
10+
// Add the `node_modules` path whence the script was invoked. Without it,
11+
// this script will fail to resolve any packages when
12+
// `react-native-test-app` was linked using npm or yarn link.
13+
module.paths.push(localNodeModulesPath);
14+
}
15+
};

windows/test-app.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,7 @@ function generateSolution(destPath, { autolink, useHermes, useNuGet }) {
547547
}
548548

549549
if (require.main === module) {
550-
const localNodeModulesPath = path.join(process.cwd(), "node_modules");
551-
if (!module.paths.includes(localNodeModulesPath)) {
552-
// Add the `node_modules` path whence the script was invoked. Without it,
553-
// this script will fail to resolve any packages when
554-
// `react-native-test-app` was linked using npm or yarn link.
555-
module.paths.push(localNodeModulesPath);
556-
}
550+
require("../scripts/link")(module);
557551

558552
require("yargs").usage(
559553
"$0 [options]",

0 commit comments

Comments
 (0)