Skip to content

Commit

Permalink
Merge pull request #10 from trabian/make-brew-optional
Browse files Browse the repository at this point in the history
Make homebrew update optional
  • Loading branch information
pmadruga committed Feb 11, 2019
2 parents cd3a332 + 24de13a commit 239d77e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ This is a combination of the commands suggested in the React Native documentatio
3. `watchman watch-del-all`
4. `rm -rf $TMPDIR/react-*`
5. `rm -rf $TMPDIR/metro-*`
6. `brew update`
7. `brew upgrade`
6. `brew update` (optional)
7. `brew upgrade` (optional)
8. `rm -rf node_modules` (optional)
9. `yarn cache clean`
10. `yarn install`
Expand All @@ -43,6 +43,7 @@ Command line arguments available for CI's:
* `--remove-iOS-build`
* `--remove-android-build`
* `--keep-node-modules`
* `--keep-brew`

Example: `./node_modules/.bin/react-native-clean-project --remove-iOS-build`

Expand Down
15 changes: 14 additions & 1 deletion source/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const args = process.argv.slice(2);
let wipeiOSBuild = false;
let wipeAndroidBuild = false;
let wipeNodeModules = true;
let updateBrew = true;

const askQuestion = (question, callback) => {
rlInterface.question(question, answer => {
Expand Down Expand Up @@ -156,16 +157,28 @@ const askNodeModules = () =>
});
});

const askBrew = () =>
new Promise(resolve => {
if (args.includes('--keep-brew')) {
updateBrew = false;
return resolve();
}
return askQuestion('Update brew? (Y/n) ', answer => {
updateBrew = checkAnswer(answer, askBrew, resolve);
});
});

askiOS()
.then(askAndroid)
.then(askNodeModules)
.then(askBrew)
.then(() => {
rlInterface.close();
if (wipeiOSBuild) executeTask(tasksList.wipeiOSBuildFolder);
if (wipeAndroidBuild) executeTask(tasksList.wipeAndroidBuildFolder);
executeTask(tasksList.watchmanCacheClear);
executeTask(tasksList.wipeTempCaches);
executeTask(tasksList.brewUpdate)
if (updateBrew) executeTask(tasksList.brewUpdate)
.then(code => {
if (code === 0) {
executeTask(tasksList.brewUpgrade);
Expand Down

0 comments on commit 239d77e

Please sign in to comment.