Skip to content

umuieme/flutter_rn_cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Cleanup Script for Flutter & React Native Projects

Overview

This script recursively scans a given directory for Flutter and React Native projects and cleans them by removing unnecessary build artifacts and dependencies.

Features

  • Detects Flutter projects by checking for pubspec.yaml and main*.dart inside the lib folder.
  • Detects React Native projects by checking for package.json along with android or ios directories.
  • Cleans Flutter projects using flutter clean.
  • Cleans React Native projects by removing node_modules, ios/Pods, and build directories.
  • Skips cleaning if the project is already clean.
  • Recursively scans subdirectories if a project type is not detected at the current level.

Prerequisites

Make sure you have the necessary tools installed:

  • Flutter installed and available in PATH.
  • Node.js and npm for React Native projects.

Usage

1. Make the script executable

Before running the script, you need to give it execute permissions:

chmod +x cleanup.sh

How It Works

The script starts at the provided root directory.

It checks each folder:

  • If it's a Flutter project, it runs flutter clean.
  • If it's a React Native project, it removes node_modules, ios/Pods, and build folders.
  • If neither, it recursively checks subdirectories.

The process continues until all subdirectories are checked.

A message confirms the cleanup completion.

Cleaning Conditions

Before cleaning, the script checks if the project is already clean:

  • A Flutter project is clean if it has no build/ or .dart_tool/ directories.
  • A React Native project is clean if it has no node_modules/, ios/Pods/, or build directories.

If the project is already clean, the script skips it to save time.

Example

./cleanup.sh ~/Projects

This command will clean all Flutter and React Native projects inside the ~/Projects directory and its subdirectories.

Notes

  • The script does not reinstall dependencies (flutter pub get or npm install). You may need to do this manually after cleaning.
  • Ensure you have backup copies of important files before running the script.

License

This script is open-source and can be modified as needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages