react-native-clean-project
Advanced tools
Comparing version 3.4.0 to 3.6.0
{ | ||
"name": "react-native-clean-project", | ||
"version": "3.4.0", | ||
"version": "3.6.0", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=8.9.0" |
@@ -19,4 +19,4 @@ # React Native Clean Project | ||
* `react-native clean-project-auto` - fully automated project state clean: like a freshly-cloned, never-started repo | ||
* `react-native clean-project` - interactive project state clean: choose types of react-native state to clean | ||
- `react-native clean-project-auto` - fully automated project state clean: like a freshly-cloned, never-started repo | ||
- `react-native clean-project` - interactive project state clean: choose types of react-native state to clean | ||
@@ -41,18 +41,20 @@ ### Direct execution | ||
| State Type | Command | In `clean-project-auto`? | Optional? | Default? | Option Flag | | ||
| --------------------- | -------------------------------- | ------------------------ | ---------- | -------- | ---------------------- | | ||
| React-native cache | `rm -rf $TMPDIR/react-*` | Yes | No | true | | | ||
| Metro bundler cache | `rm -rf $TMPDIR/metro-*` | Yes | No | true | | | ||
| Watchman cache | `watchman watch-del-all` | Yes | No | true | | | ||
| NPM modules | `rm -rf node_modules` | Yes | Yes | true | --keep-node_modules | | ||
| Yarn cache | `yarn cache clean` | Yes | Yes | true | --keep-node-modules | | ||
| Yarn packages | `yarn install` | No | Yes | true | --keep-node-modules | | ||
| NPM cache | `npm cache verify` | Yes | Yes | true | --keep-node-modules | | ||
| NPM Install | `npm ci` | Yes | Yes | true | --keep-node-modules | | ||
| iOS build folder | `rm -rf ios/build` | Yes | Yes | false | --remove-iOS-build | | ||
| iOS pods folder | `rm -rf ios/pods` | Yes | Yes | false | --remove-iOS-pods | | ||
| Android build folder | `rm -rf android/build` | Yes | Yes | false | --remove-android-build | | ||
| Android clean project | `(cd android && ./gradlew clean)`| Yes | Yes | false | --clean-android-project| | ||
| Brew package | `brew update && brew upgrade` | No | Yes | true | --keep-brew | | ||
| Pod packages | `pod update` | No | Yes | true | --keep-pods | | ||
| State Type | Command | In `clean-project-auto`? | Optional? | Default? | Option Flag | | ||
| ------------------------- | --------------------------------- | ------------------------ | --------- | -------- | ------------------------------ | | ||
| React-native cache | `rm -rf $TMPDIR/react-*` | Yes | No | true | | | ||
| Metro bundler cache | `rm -rf $TMPDIR/metro-*` | Yes | No | true | | | ||
| Watchman cache | `watchman watch-del-all` | Yes | No | true | | | ||
| NPM modules | `rm -rf node_modules` | Yes | Yes | true | --keep-node_modules | | ||
| Yarn cache | `yarn cache clean` | Yes | Yes | true | --keep-node-modules | | ||
| Yarn packages | `yarn install` | No | Yes | true | --keep-node-modules | | ||
| NPM cache | `npm cache verify` | Yes | Yes | true | --keep-node-modules | | ||
| NPM Install | `npm ci` | Yes | Yes | true | --keep-node-modules | | ||
| iOS build folder | `rm -rf ios/build` | Yes | Yes | false | --remove-iOS-build | | ||
| iOS pods folder | `rm -rf ios/Pods` | Yes | Yes | false | --remove-iOS-pods | | ||
| system iOS pods cache | `pod cache clear --all` | Yes | Yes | false | --remove-system-iOS-pods-cache | | ||
| user iOS pods cache | `rm -rf ~/.cocoapods` | Yes | Yes | false | --remove-user-iOS-pods-cache | | ||
| Android build folder | `rm -rf android/build` | Yes | Yes | false | --remove-android-build | | ||
| Android clean project | `(cd android && ./gradlew clean)` | Yes | Yes | false | --clean-android-project | | ||
| Brew package | `brew update && brew upgrade` | No | Yes | true | --keep-brew | | ||
| Pod packages | `pod update` | No | Yes | true | --keep-pods | | ||
@@ -71,3 +73,3 @@ Example: `./node_modules/.bin/react-native-clean-project --remove-iOS-build` | ||
* **Pedro Madruga** - _Initial work and maintenance_ - [pmadruga](https://github.com/pmadruga) | ||
- **Pedro Madruga** - _Initial work and maintenance_ - [pmadruga](https://github.com/pmadruga) | ||
@@ -74,0 +76,0 @@ See also the list of [contributors](https://github.com/pmadruga/react-native-clean-project/graphs/contributors) who participated in this project. |
@@ -9,2 +9,4 @@ #!/usr/bin/env node | ||
.then(options.askiOSPods) | ||
.then(options.askSystemPodsCache) | ||
.then(options.askUserPodsCache) | ||
.then(options.askUpdatePods) | ||
@@ -23,2 +25,8 @@ .then(options.askAndroid) | ||
} | ||
if (options.getWipeSystemPodsCache()) { | ||
executeTask(tasks.wipeSystemPodsCache); | ||
} | ||
if (options.getWipeUserPodsCache()) { | ||
executeTask(tasks.wipeUserPodsCache); | ||
} | ||
if (options.getWipeAndroidBuild()) { | ||
@@ -25,0 +33,0 @@ executeTask(tasks.wipeAndroidBuildFolder); |
@@ -15,2 +15,4 @@ const { createInterface } = require('readline'); | ||
let wipeiOSPods = false; | ||
let wipeSystemiOSPodsCache = true; | ||
let wipeUseriOSPodsCache = true; | ||
let wipeAndroidBuild = false; | ||
@@ -30,2 +32,8 @@ let wipeNodeModules = true; | ||
}; | ||
const getWipeSystemiOSPodsCache = () => { | ||
return wipeSystemiOSPodsCache; | ||
}; | ||
const getWipeUseriOSPodsCache = () => { | ||
return wipeUseriOSPodsCache; | ||
}; | ||
const getWipeAndroidBuild = () => { | ||
@@ -85,2 +93,28 @@ return wipeAndroidBuild; | ||
const askSystemiOSPodsCache = () => | ||
new Promise(resolve => { | ||
if (args.includes('--remove-system-iOS-pods-cache')) { | ||
wipeSystemiOSPodsCache = true; | ||
return resolve(); | ||
} | ||
return askQuestion('Wipe system iOS Pods cache? (Y/n) ', answer => { | ||
wipeSystemiOSPodsCache = checkAnswer( | ||
answer, | ||
askSystemiOSPodsCache, | ||
resolve | ||
); | ||
}); | ||
}); | ||
const askUseriOSPodsCache = () => | ||
new Promise(resolve => { | ||
if (args.includes('--remove-user-iOS-pods-cache')) { | ||
wipeUseriOSPodsCache = true; | ||
return resolve(); | ||
} | ||
return askQuestion('Wipe user iOS Pods cache? (Y/n) ', answer => { | ||
wipeUseriOSPodsCache = checkAnswer(answer, askUseriOSPodsCache, resolve); | ||
}); | ||
}); | ||
const askAndroidCleanProject = () => | ||
@@ -149,2 +183,4 @@ new Promise(resolve => { | ||
getWipeiOSPods, | ||
getWipeSystemiOSPodsCache, | ||
getWipeUseriOSPodsCache, | ||
getWipeAndroidBuild, | ||
@@ -156,2 +192,4 @@ getWipeNodeModules, | ||
askiOSPods, | ||
askSystemiOSPodsCache, | ||
askUseriOSPodsCache, | ||
askUpdatePods, | ||
@@ -158,0 +196,0 @@ askAndroid, |
@@ -17,2 +17,12 @@ // Implementation of various command-line tasks | ||
}, | ||
wipeSystemiOSPodsCache: { | ||
name: 'wipe system iOS Pods cache', | ||
command: 'pod', | ||
args: ['cache', 'clear', '--all'] | ||
}, | ||
wipeUseriOSPodsCache: { | ||
name: 'wipe user iOS Pods cache', | ||
command: 'rm', | ||
args: ['-rf', '~/.cocoapods'] | ||
}, | ||
updatePods: { | ||
@@ -83,2 +93,4 @@ name: 'update iOS Pods', | ||
tasks.wipeiOSPodsFolder, | ||
tasks.wipeSystemiOSPodsCache, | ||
tasks.wipeUseriOSPodsCache, | ||
tasks.wipeAndroidBuildFolder, | ||
@@ -85,0 +97,0 @@ tasks.watchmanCacheClear, |
@@ -17,3 +17,3 @@ // Set up a mock command executor that records task names so we may verify task execution | ||
const input = Object.keys(tasks).length; | ||
const expected = 14; | ||
const expected = 16; | ||
@@ -28,3 +28,3 @@ expect(input).toEqual(expected); | ||
plugin[0].func(); | ||
expect(tasksExecuted.length).toEqual(9); | ||
expect(tasksExecuted.length).toEqual(11); | ||
autoTasks.forEach(task => { | ||
@@ -31,0 +31,0 @@ expect(tasksExecuted.includes(task.name)).toEqual(true); |
34090
592
78