4
4
deletedFeaturesFilesInJavaScript=(" Surveys" " FeatureRequests" " Survey" )
5
5
for feature in " ${deletedFeaturesFilesInJavaScript[@]} " ; do
6
6
echo " $feature "
7
+
7
8
rm -f src/modules/" $feature " .ts
8
9
rm -f test/mocks/mock" $feature " .ts
9
- sed -i " s/import..*$feature ';//g" src/index.ts
10
- sed -i " s/$feature ,//g" src/index.ts
10
+
11
+ node scripts/replace.js --pattern " import.+$feature ';" " " src/index.ts
12
+ node scripts/replace.js --pattern " $feature ," " " src/index.ts
11
13
done
12
14
13
15
npx eslint src/index.ts --fix
@@ -19,7 +21,7 @@ for feature in "${deletedFeaturesFilesInAndroidApp[@]}"; do
19
21
20
22
rm -f android/src/main/java/com/instabug/reactlibrary/" $feature " .java
21
23
rm -f android/src/test/java/com/instabug/reactlibrary/" $feature " Test.java
22
- sed -i " s/ modules.add(new $feature (reactContext));//g " android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java
24
+ node scripts/replace.js " modules.add(new $feature (reactContext));" " " android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java
23
25
done
24
26
25
27
# remove survey and featureRequest features in IOS files
@@ -30,13 +32,15 @@ for feature in "${deletedFeaturesFilesInIosApp[@]}"; do
30
32
rm -f ios/RNInstabug/" $feature " .m
31
33
done
32
34
33
- sed -i " s/\ #import <Instabug\ /IBGSurveys.h>//g " ios/RNInstabug/InstabugReactBridge.m
34
- sed -i " s/\ #import <Instabug\ /IBGSurveys.h>//g " ios/RNInstabug/InstabugReactBridge.h
35
+ node scripts/replace.js " #import <Instabug/IBGSurveys.h>" " " ios/RNInstabug/InstabugReactBridge.m
36
+ node scripts/replace.js " #import <Instabug/IBGSurveys.h>" " " ios/RNInstabug/InstabugReactBridge.h
35
37
36
- # remove all locales except English locale
37
- sed -i -E ' /english/!s/.*constants.locale.*//g' src/utils/Enums.ts
38
+ # Remove all locales except for English
39
+ # This ugly regular expression matches all lines not containing "english" and containing "constants.locale"
40
+ node scripts/replace.js --pattern " ^(?!.*english).+constants\.locale.*" " " src/utils/Enums.ts
38
41
npx eslint src/index.ts --fix src/utils/Enums.ts
39
42
40
- sed -i " s/ return (major == 7 && minor >= 3) || major >= 8/ return false/g " android/build.gradle
43
+ node scripts/replace.js " return (major == 7 && minor >= 3) || major >= 8" " return false" android/build.gradle
41
44
42
- sed -i " s/static boolean supportsNamespace() {/static boolean supportsNamespace() { \n return false/g" android/build.gradle
45
+ # Note: printf is used here as the string contains a newline character which would be escaped otherwise.
46
+ node scripts/replace.js " static boolean supportsNamespace() {" " $( printf " static boolean supportsNamespace() {\n return false" ) " android/build.gradle
0 commit comments