@@ -18,6 +18,12 @@ gradle.projectsEvaluated {
18
18
def buildTypes = android. buildTypes. collect { type -> type. name }
19
19
def productFlavors = android. productFlavors. collect { flavor -> flavor. name }
20
20
if (! productFlavors) productFlavors. add(' ' )
21
+ def nodeModulesPath;
22
+ if (project. hasProperty(' nodeModulesPath' )) {
23
+ nodeModulesPath = project. nodeModulesPath
24
+ } else {
25
+ nodeModulesPath = " ../../node_modules" ;
26
+ }
21
27
22
28
productFlavors. each { productFlavorName ->
23
29
buildTypes. each { buildTypeName ->
@@ -40,9 +46,9 @@ gradle.projectsEvaluated {
40
46
def recordFilesBeforeBundleCommand = tasks. create(
41
47
name : " recordFilesBeforeBundleCommand${ targetName} " ,
42
48
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
44
50
}
45
-
51
+
46
52
recordFilesBeforeBundleCommand. dependsOn(" merge${ targetName} Resources" )
47
53
recordFilesBeforeBundleCommand. dependsOn(" merge${ targetName} Assets" )
48
54
runBefore(" bundle${ targetName} JsAndAssets" , recordFilesBeforeBundleCommand)
@@ -51,7 +57,7 @@ gradle.projectsEvaluated {
51
57
def generateBundledResourcesHash = tasks. create(
52
58
name : " generateBundledResourcesHash${ targetName} " ,
53
59
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
55
61
}
56
62
57
63
generateBundledResourcesHash. dependsOn(" bundle${ targetName} JsAndAssets" )
0 commit comments