nit_helper 1.5.5
nit_helper: ^1.5.5 copied to clipboard
A CLI tool for building Flutter and Serverpod projects with fvm support.
nit-helper #
nit-helper is a cross-platform Dart CLI tool designed to automate building Flutter and Serverpod projects, with support for monorepo structures.
The tool automatically detects the necessary directories (*_flutter, *_server) and executes the appropriate commands, with optional fvm support. Additionally, it can manage dependencies across multiple subprojects in large project hierarchies.
โจ Features #
- ๐ฆ Automatic Flutter module building
- ๐ Code generation and migrations for Serverpod
- ๐ Support for
fvm(Flutter Version Management) - ๐ง Smart project structure navigation
- ๐ง Commands unified in a single CLI:
nit-helper - ๐๏ธ Unused files detection and cleanup
- ๐ Get-All command for monorepo dependency management with tree-structured output
๐ Installation #
dart pub global activate nit_helper
Ensure that the Dart global utilities path is added to PATH:
- Linux/macOS:
export PATH="$PATH:$HOME/.pub-cache/bin" - Windows:
Open System Properties โ Advanced โ Environment Variables and add
to the%APPDATA%\Pub\Cache\binPathvariable.
๐งช Usage #
๐จ build #
Builds the Flutter project (searches for a directory ending with _flutter, or works in the current directory if it matches).
nit-helper build
With fvm:
nit-helper build --fvm
Executes commands:
dart run build_runner buildfluttergen
๐ฅ build-server #
Generates Serverpod code and applies migrations. Searches for a directory ending with _server.
nit-helper build-server
Force migration creation:
nit-helper build-server --force
With fvm:
nit-helper build-server --fvm
Executes commands:
serverpod generateserverpod create-migration(or--force)dart run bin/main.dart --role maintenance --apply-migrations
๐ build-full #
Combines build and build-server:
nit-helper build-full
With options:
nit-helper build-full --fvm --force
๐ check #
Analyzes the project for unused Dart files and provides cleanup options.
nit-helper check
With options:
# Scan specific project
nit-helper check --path ./my_project
# Exclude patterns and folders
nit-helper check --exclude-pattern "*.g.dart" --exclude-folder "generated"
# Interactive cleanup mode
nit-helper check --interactive
# Combine options
nit-helper check -p ./project -e "*.test.dart" -f "temp" -i
Features:
- Smart dependency analysis via import/export parsing
- Automatic exclusion of generated files (*.g.dart, *.freezed.dart, etc.)
- Interactive cleanup with confirmation prompts
- Cross-platform support
- Detailed size reporting
๐ get-all #
Recursively finds all subprojects with pubspec.yaml and runs dart pub get in each. Automatically excludes standard Flutter folders to avoid unnecessary scanning.
nit-helper get-all
With custom path:
nit-helper get-all --path ./my_monorepo
With fvm:
nit-helper get-all --path ./packages --fvm
Features:
- Recursive Project Discovery: Automatically finds all Dart/Flutter projects at any depth
- Beautiful Tree Output: Results displayed in a structured tree format with status indicators
- Smart Folder Exclusion: Ignores build directories (build, ios, android, web, windows, macos, linux) and system folders (.git, .vscode, etc.)
- Symlink Loop Detection: Prevents infinite loops from circular symlinks
- Cross-Platform Support: Works on Windows, macOS, and Linux
- Interactive Output: Preserves colored terminal output during dependency installation
- Perfect for Monorepos: Handles complex project structures with nested dependencies
Example output:
๐ Found 4 projects:
๐ GET ALL SUMMARY
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฆ packages/
โโโ โ
shared_models
โโโ โ
ui_components
โโโ ๐ฆ utils/
โโโ โ
string_utils
โ
my_app
Total projects: 4
Successful: 4
All projects processed successfully! ๐
๐งฐ Arguments #
| Argument | Command | Description |
|---|---|---|
--fvm |
build, build-server, build-full, get-all | Execute through fvm exec |
--force |
build-server, build-full | Force create migrations |
--path, -p |
check, get-all | Path to project directory |
--exclude-pattern, -e |
check | File patterns to exclude |
--exclude-folder, -f |
check | Folders to exclude |
--interactive, -i |
check | Enable interactive cleanup |
--details, -d |
check | Show detailed file list |
๐ก Examples #
# Build Flutter with fvm
nit-helper build --fvm
# Build Serverpod with forced migration
nit-helper build-server --force
# Full project build
nit-helper build-full --fvm --force
# Check for unused files
nit-helper check
# Interactive cleanup with exclusions
nit-helper check --exclude-pattern "*.g.dart" --interactive
# Get dependencies for all subprojects in current directory
nit-helper get-all
# Get dependencies for specific monorepo path
nit-helper get-all --path ./packages
# Get dependencies with FVM
nit-helper get-all -p ./my_monorepo --fvm
๐ Project Structure #
project_root/
โโโ my_app_flutter/
โ โโโ pubspec.yaml
โ โโโ main.dart
โโโ my_app_server/
โ โโโ pubspec.yaml
โ โโโ bin/main.dart
โโโ packages/
โ โโโ shared_models/
โ โ โโโ pubspec.yaml
โ โโโ ui_components/
โ โโโ pubspec.yaml
nit-helper will automatically detect where *_flutter and *_server are located and execute the appropriate commands. The get-all command is particularly useful in monorepo structures like the one above, scanning through all nested pubspec.yaml files and installing dependencies for each.
๐ Acknowledgments #
Special thanks to Emad Beltaje for the original dart_unused_files package, which inspired and provided the foundation for the unused files detection functionality in the check command.
๐ License #
MIT License. ยฉ 2025 Maksim Levchenko
๐ซ Feedback #
Report bugs or suggestions: GitHub Issues