Skip to content

Commit d761a2b

Browse files
committed
Make the use of app root conditional
1 parent f9a3ea6 commit d761a2b

File tree

1 file changed

+13
-8
lines changed
  • packages/react-native-node-api-modules/src/node/cli

1 file changed

+13
-8
lines changed

packages/react-native-node-api-modules/src/node/cli/hermes.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,28 @@ import { getLatestMtime, prettyPath } from "../path-utils";
1212
const HOST_PACKAGE_ROOT = path.resolve(__dirname, "../../..");
1313
const HERMES_GIT_URL = "https://github.com/kraenhansen/hermes.git";
1414
const HERMES_GIT_TAG = "node-api-for-react-native-0.79.0";
15-
const REACT_NATIVE_DIR = path.dirname(
16-
require.resolve("react-native/package.json")
17-
);
1815

1916
export const command = new Command("vendor-hermes")
20-
.argument("[from]", "Path to a file inside the package", process.cwd())
17+
.argument("[from]", "Path to a file inside the app package", process.cwd())
2118
.option("--silent", "Don't print anything except the final path", false)
2219
.option(
2320
"--force",
2421
"Don't check timestamps of input files to skip unnecessary rebuilds",
2522
false
2623
)
27-
.action(async (from, { force, silent }) => {
24+
.option(
25+
"--use-app-root",
26+
"Clone Hermes into the app root instead of the host package root",
27+
false
28+
)
29+
.action(async (from, { force, silent, useAppRoot }) => {
2830
try {
29-
const packageRoot = packageDirectorySync({ cwd: from });
30-
assert(packageRoot, "Failed to find package root");
31-
const hermesPath = path.join(packageRoot, "hermes");
31+
const appPackageRoot = packageDirectorySync({ cwd: from });
32+
assert(appPackageRoot, "Failed to find package root");
33+
const hermesPath = path.join(
34+
useAppRoot ? appPackageRoot : HOST_PACKAGE_ROOT,
35+
"hermes"
36+
);
3237
if (force && fs.existsSync(hermesPath)) {
3338
await oraPromise(
3439
fs.promises.rm(hermesPath, { recursive: true, force: true }),

0 commit comments

Comments
 (0)