├── .npmignore ├── .gitignore ├── img └── cleaner.gif ├── src ├── cache.js ├── npm.js ├── ios.js └── android.js ├── utils └── utils.js ├── cli.js ├── package.json ├── LICENSE └── README.md /.npmignore: -------------------------------------------------------------------------------- 1 | /img -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules -------------------------------------------------------------------------------- /img/cleaner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/automizer/mobile-app-cleaner/HEAD/img/cleaner.gif -------------------------------------------------------------------------------- /src/cache.js: -------------------------------------------------------------------------------- 1 | const { run } = require('../utils/utils'); 2 | const ora = require('ora'); 3 | 4 | const clean = async () => { 5 | const spinner = ora('Clean Cache').start(); 6 | 7 | run(`rm -rf $TMPDIR/react-*`); 8 | run(`rm -rf $TMPDIR/metro-*`); 9 | run(`watchman watch-del-all`); 10 | 11 | spinner.succeed(); 12 | }; 13 | 14 | module.exports = { clean }; 15 | -------------------------------------------------------------------------------- /src/npm.js: -------------------------------------------------------------------------------- 1 | const { run } = require('../utils/utils'); 2 | const ora = require('ora'); 3 | 4 | const clean = async () => { 5 | const spinner = ora('Verify NPM Cache').start(); 6 | run('npm cache verify'); 7 | spinner.succeed(); 8 | 9 | const spinner2 = ora('Install NPM Dependencies').start(); 10 | run('npm ci'); 11 | spinner2.succeed(); 12 | }; 13 | 14 | module.exports = { clean }; 15 | -------------------------------------------------------------------------------- /src/ios.js: -------------------------------------------------------------------------------- 1 | const { run } = require('../utils/utils'); 2 | const ora = require('ora'); 3 | 4 | const clean = async () => { 5 | const cwd = process.cwd(); 6 | 7 | const spinner = ora('Clean iOS Folders').start(); 8 | run(`rm -rf ${cwd}/ios/build ${cwd}/ios/Pods`); 9 | spinner.succeed(); 10 | 11 | const spinner2 = ora('Install iOS Pod').start(); 12 | run(`cd ${cwd}/ios && pod install && cd ${cwd}`); 13 | spinner2.succeed(); 14 | }; 15 | 16 | module.exports = { clean }; 17 | -------------------------------------------------------------------------------- /src/android.js: -------------------------------------------------------------------------------- 1 | const { run } = require('../utils/utils'); 2 | const ora = require('ora'); 3 | 4 | const clean = async () => { 5 | const cwd = process.cwd(); 6 | 7 | const spinner = ora('Clean Android Folder').start(); 8 | run(`rm -rf ${cwd}/android/build`); 9 | spinner.succeed(); 10 | 11 | const spinner2 = ora('Clean Android Gradlew').start(); 12 | run(`cd ${cwd}/android && ./gradlew clean && cd ${cwd}`); 13 | spinner2.succeed(); 14 | }; 15 | 16 | module.exports = { clean }; 17 | -------------------------------------------------------------------------------- /utils/utils.js: -------------------------------------------------------------------------------- 1 | const { execSync } = require('child_process'); 2 | 3 | const hasParam = (param) => process.argv.includes(param); 4 | const greetings = () => { 5 | console.log(`\x1b[36m 6 | mobile app __ 7 | _____/ /__ ____ ____ ___ _____ 8 | / ___/ / _ \\/ __ '/ __ \\/ _ \\/ ___/ 9 | / /__/ / __/ /_/ / / / / __/ / 10 | \\___/_/\\___/\\__,_/_/ /_/\\___/_/\n\n\x1b[0m`); 11 | }; 12 | const run = (command) => { 13 | execSync(command, { stdio: hasParam('--verbose') ? 'inherit' : 'ignore' }); 14 | }; 15 | 16 | module.exports = { hasParam, greetings, run }; 17 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const { greetings, hasParam } = require('./utils/utils'); 3 | const cache = require('./src/cache'); 4 | const npm = require('./src/npm'); 5 | const ios = require('./src/ios'); 6 | const android = require('./src/android'); 7 | 8 | const cli = async () => { 9 | await cache.clean(); 10 | await npm.clean(); 11 | 12 | hasParam('--ios') && await ios.clean(); 13 | hasParam('--android') && await android.clean(); 14 | 15 | if (!hasParam('--ios') && !hasParam('--android')) { 16 | await ios.clean(); 17 | await android.clean(); 18 | } 19 | }; 20 | 21 | greetings(); 22 | cli(); 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mobile-app-cleaner", 3 | "version": "0.0.1", 4 | "description": "You can use this CLI Tool to clean your iOS and Android projects and keep them updated.", 5 | "main": "cli.js", 6 | "bin": { 7 | "mobile-app-cleaner": "cli.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/automizer/mobile-app-cleaner.git" 12 | }, 13 | "keywords": [ 14 | "mobile", 15 | "app", 16 | "cleaner", 17 | "cli", 18 | "ios", 19 | "android", 20 | "react-native", 21 | "flutter", 22 | "ionic" 23 | ], 24 | "author": "Sercan Eraslan", 25 | "license": "MIT", 26 | "bugs": { 27 | "url": "https://github.com/automizer/mobile-app-cleaner/issues" 28 | }, 29 | "homepage": "https://github.com/automizer/mobile-app-cleaner#readme", 30 | "dependencies": { 31 | "ora": "5.4.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Automizer Open Source 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mobile App Cleaner 2 | 3 | ![Mobile App Cleaner Demo](img/cleaner.gif) 4 | 5 | You can use this CLI Tool to clean your iOS and Android projects and keep them updated. This tool automatizes these items below; 6 | 7 | - Clean iOS Folders 8 | - Install iOS Pod 9 | 10 | - Clean Android Folder 11 | - Clean Android Gradlew 12 | 13 | - Verify NPM Cache 14 | - Install NPM Dependencies 15 | 16 | - Clean Cache (React Native Cache, Metro Bundler Cache, Watchman Cache etc.) 17 | 18 | ## Installation 19 | 20 | You need to install [Node.js](https://nodejs.org/en/download/) first, then install the tool globally using this command: 21 | 22 | ```bash 23 | npm install -g mobile-app-cleaner 24 | ``` 25 | 26 | ## How to use 27 | 28 | You can start cleaning process for iOS and Android projects with this one line command below. 29 | 30 | ```bash 31 | mobile-app-cleaner 32 | ``` 33 | 34 | If you want to start this tool just for iOS: 35 | 36 | ```bash 37 | mobile-app-cleaner --ios 38 | ``` 39 | 40 | If you want to start this tool just for Android: 41 | 42 | ```bash 43 | mobile-app-cleaner --android 44 | ``` 45 | 46 | ## Verbose 47 | 48 | If you want to see what this tool is doing in the background, you can give --verbose parameter. 49 | 50 | ```bash 51 | mobile-app-cleaner --verbose 52 | ``` 53 | 54 | ## Support 55 | 56 | If you have an issue with this CLI tool, please open an [issue](https://github.com/automizer/mobile-app-cleaner/issues). 57 | 58 | ## Contributing 59 | 60 | Pull requests are welcome. 61 | 62 | ## License 63 | 64 | This project is licensed under the MIT License --------------------------------------------------------------------------------