Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kccheung/8c36649edf61dfd65138fa13892a5a39 to your computer and use it in GitHub Desktop.
Save kccheung/8c36649edf61dfd65138fa13892a5a39 to your computer and use it in GitHub Desktop.
replace_node_modules_buildToolsVersion.sh
#!/usr/bin/env bash
targetVersion="$1"
if [ "$1" == "" ]; then
echo "Usage: $0 <buildToolsVersion>";
else
find \
node_modules \
-type f \
-iname 'build.gradle' \
-exec sed -i '' 's/buildToolsVersion ["'\''][0-9][0-9]\.[0-9]\.[0-9]["'\'']/buildToolsVersion "'${targetVersion}'"/g' "{}" +;
find \
node_modules \
-type f \
-iname 'build.gradle' \
-exec sed -i '' 's/compileSdkVersion [0-9][0-9]/compileSdkVersion 25/g' "{}" +;
find \
node_modules \
-type f \
-iname 'build.gradle' \
-exec sed -i '' 's/targetSdkVersion [0-9][0-9]/targetSdkVersion 25/g' "{}" +;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment