@@ -18,6 +18,12 @@ gradle.projectsEvaluated {
1818 def buildTypes = android. buildTypes. collect { type -> type. name }
1919 def productFlavors = android. productFlavors. collect { flavor -> flavor. name }
2020 if (! productFlavors) productFlavors. add(' ' )
21+ def nodeModulesPath;
22+ if (project. hasProperty(' nodeModulesPath' )) {
23+ nodeModulesPath = project. nodeModulesPath
24+ } else {
25+ nodeModulesPath = " ../../node_modules" ;
26+ }
2127
2228 productFlavors. each { productFlavorName ->
2329 buildTypes. each { buildTypeName ->
@@ -40,9 +46,9 @@ gradle.projectsEvaluated {
4046 def recordFilesBeforeBundleCommand = tasks. create(
4147 name : " recordFilesBeforeBundleCommand${ targetName} " ,
4248 type : Exec ) {
43- commandLine " node" , " ../../node_modules /react-native-code-push/scripts/recordFilesBeforeBundleCommand.js" , resourcesDir
49+ commandLine " node" , " ${ nodeModulesPath } /react-native-code-push/scripts/recordFilesBeforeBundleCommand.js" , resourcesDir
4450 }
45-
51+
4652 recordFilesBeforeBundleCommand. dependsOn(" merge${ targetName} Resources" )
4753 recordFilesBeforeBundleCommand. dependsOn(" merge${ targetName} Assets" )
4854 runBefore(" bundle${ targetName} JsAndAssets" , recordFilesBeforeBundleCommand)
@@ -51,7 +57,7 @@ gradle.projectsEvaluated {
5157 def generateBundledResourcesHash = tasks. create(
5258 name : " generateBundledResourcesHash${ targetName} " ,
5359 type : Exec ) {
54- commandLine " node" , " ../../node_modules /react-native-code-push/scripts/generateBundledResourcesHash.js" , resourcesDir, " $jsBundleDir /$bundleAssetName " , assetsDir
60+ commandLine " node" , " ${ nodeModulesPath } /react-native-code-push/scripts/generateBundledResourcesHash.js" , resourcesDir, " $jsBundleDir /$bundleAssetName " , assetsDir
5561 }
5662
5763 generateBundledResourcesHash. dependsOn(" bundle${ targetName} JsAndAssets" )
0 commit comments