flusgen 1.0.8
flusgen: ^1.0.8 copied to clipboard
A CLI tool for generating folder structures for Flutter projects
FlusGen #
flusgen
is a tool that helps you automatically generate folder and file structures for Flutter projects using the MVVM (Model-View-ViewModel) architecture pattern or Other. With this tool, you can quickly create predefined folders and files, as well as perform operations such as creating custom folders/files, renaming them, and deleting them.
Screenshoot Flusgen #
Demo Test Flusgen #
https://github.com/user-attachments/assets/c958ade2-50fc-4c3e-8df6-9b73591b4a86
📌 Project Description #
This project is designed to simplify the setup of folder and file structures in Flutter projects. Using this tool, you can generate consistent folder and file structures following a specific architecture pattern (such as MVVM or Other). Additionally, you can customize the existing structure by adding, renaming, or deleting folders and files.
✨ Key Features #
- ✅ Generate Structure: Automatically create a default folder and file structure based on predefined templates.
- ✅ Generate from File: Create a custom folder and file structure based on a
.json
file. - ✅ Create Custom Folder: Add custom folders after generating the default structure.
- ✅ Rename Folder: Rename existing folders within the project structure.
- ✅ Delete Folder: Remove folders from the project structure.
- ✅ Create Custom File: Add custom files within the project structure.
- ✅ Rename File: Rename existing files within the project structure.
- ✅ Delete File: Remove files from the project structure.
🚀 Installation #
1️⃣ Install FlusGen #
Run the following command in Command Prompt (CMD) to activate the package:
dart pub global activate flusgen
2️⃣ Configure PATH #
To run commands globally, add the following directory to your PATH
environment variable:
C:\Users\myaasiinh\AppData\Local\Pub\Cache\bin
Steps to Add PATH on Windows
-
Open Environment Variables:
- Press
Win + S
and search for "Environment Variables". - Click Edit the system environment variables.
- In the System Properties window, click Environment Variables.
- Press
-
Add PATH:
- Under System Variables, find the variable named
Path
and click Edit. - Click New, then enter:
C:\Users\myaasiinh\AppData\Local\Pub\Cache\bin
- Click OK to save changes.
- Under System Variables, find the variable named
-
Restart Terminal or IDE:
- Close the terminal (Command Prompt, PowerShell, or VS Code terminal) and reopen it to apply the configuration.
🛠 Available Commands #
🔹 1. Generate Default Structure #
Generates the default folder and file structure:
flusgen generate-structure
🔹 2. Create Custom Folder #
Creates a custom folder after the default structure (Replace <folderPath>
with the desired folder path):
flusgen create-custom-folder <folderPath>
📌 Example:
flusgen create-custom-folder lib/features/authentication
🔹 3. Rename Folder #
Renames an existing folder:
flusgen rename-folder <oldPath> <newPath>
📌 Example:
flusgen rename-folder lib/features/authentication lib/features/login
🔹 4. Delete Folder #
Removes a folder from the project structure:
flusgen delete-folder <folderPath>
📌 Example:
flusgen delete-folder lib/features/login
🔹 5. Create Custom File #
Creates a custom file inside a specific folder:
flusgen create-custom-file <filePath> [content]
📌 Example:
flusgen create-custom-file lib/features/authentication/auth_service.dart
🔹 6. Rename File #
Renames a file within the project structure:
flusgen rename-file <oldPath> <newPath>
📌 Example:
flusgen rename-file lib/features/authentication/auth_service.dart lib/features/authentication/login_service.dart
🔹 7. Delete File #
Deletes a file from the project structure:
flusgen delete-file <filePath>
📌 Example:
flusgen delete-file lib/features/authentication/auth_service.dart
🔹 8. Generate Structure from a File #
Generates a folder and file structure based on a .json
file, allowing for customization without relying on built-in templates.
flusgen generate-structure-from-json <filePath>
📌 Example:
flusgen generate-structure-from-json structure.json lib
📄 File Format (.json
)
{
"lib": {
"core": {
"config": ["main_app.dart"],
"global_component": ["global_widget.dart"],
"constants": ["string.dart", "color.dart", "images.dart"],
"utils": ["route_utils.dart"]
},
"data": {
"data1": {
"requests_model": ["data1_requests_model.dart"],
"responses_model": ["data1_responses_model.dart"],
"datasource": ["data1_data_source.dart"],
"repository": ["data1_repository.dart"],
"viewdatamodel": ["data1_view_datamodel.dart"]
}
},
"features": {
"features1": {
"": ["features_screen.dart"],
"widget": ["features1_widget.dart"],
"controller": ["features_controller.dart"]
}
}
}
}
🎯 Use Cases #
✅ 1. Generate Default Structure #
Create a default folder and file structure:
flusgen generate-structure
✅ 2. Create Custom Folder #
Add a custom folder to the generated structure:
flusgen create-custom-folder lib/features/authentication
✅ 3. Rename Folder #
Rename the authentication
folder to login
:
flusgen rename-folder lib/features/authentication lib/features/login
✅ 4. Delete Folder #
Remove an unnecessary folder:
flusgen delete-folder lib/features/login
✅ 5. Create Custom File #
Add a custom file to the project structure:
flusgen create-custom-file lib/features/authentication/auth_service.dart
✅ 6. Rename File #
Rename auth_service.dart
to login_service.dart
:
flusgen rename-file lib/features/authentication/auth_service.dart lib/features/authentication/login_service.dart
✅ 7. Delete File #
Remove an unused file:
flusgen delete-file lib/features/authentication/auth_service.dart
✅ 8. Generate Structure from a File #
Generate a custom folder and file structure from a .json
file:
flusgen generate-structure-from-json structure.json lib
🤝 Contributing #
If you would like to contribute to this project, feel free to submit a pull request. Follow these steps:
- Fork this repository.
- Create a new branch for your changes.
- Make your changes and ensure your code runs properly.
- Submit a pull request to merge your changes.
📜 License #
This project is licensed under the MIT License.
🎉 Enjoy using flusgen
! If you have any questions, feel free to ask! 🚀