@@ -12,23 +12,28 @@ import { getLatestMtime, prettyPath } from "../path-utils";
1212const HOST_PACKAGE_ROOT = path . resolve ( __dirname , "../../.." ) ;
1313const HERMES_GIT_URL = "https://github.com/kraenhansen/hermes.git" ;
1414const 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
1916export 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