flutter_makefile 1.0.2
flutter_makefile: ^1.0.2 copied to clipboard
A CLI tool for Flutter projects that provides Makefile-style commands for common development tasks like building, testing, and running Flutter applications.
flutter_makefile #
A CLI tool to generate Makefile and package.json for Flutter projects with support for builds, testing, asset generation, and automated releases.
Requirements #
- Dart SDK
make(the CLI will check and provide installation instructions if not found)
Getting Started π #
If the CLI application is available on pub, activate globally via:
dart pub global activate flutter_makefile
Or locally via:
dart pub global activate --source=path <path to this package>
Usage #
# Initialize a new Makefile and package.json in your Flutter project
$ flutter_makefile init
# Initialize with custom app name
$ flutter_makefile init --app-name my_awesome_app
# Initialize with custom output directory
$ flutter_makefile init --output /path/to/project
# Force overwrite existing files
$ flutter_makefile init --force
# Show CLI version
$ flutter_makefile --version
# Show usage help
$ flutter_makefile --help
Init Command #
The init command generates a comprehensive Makefile and package.json for your Flutter project. It also checks if make is installed on your system and provides installation instructions if needed.
Generated Makefile includes:
- β Configurable build flavors and targets
- β Support for Android (APK/AAB) and iOS (IPA) builds
- β Firebase App Distribution integration
- β TestFlight distribution support
- β Package publishing to pub.flutter-io.cn
- β Asset generation (icons, splash screens)
- β Testing and code generation utilities
- β Compatible with or without FVM
Generated package.json includes:
- β Semantic-release configuration
- β Conventional commit support
- β Automated version management
- β Changelog generation
- β GitHub release automation
Options:
--output, -o- Specify output directory (default: current directory)--app-name, -n- App name for package.json (default: "app")--force, -f- Overwrite existing files
Example:
cd my_flutter_project
flutter_makefile init --app-name my_awesome_app
make npm-install
make run
Running Tests with coverage π§ͺ #
To run all unit tests use the following command:
$ dart pub global activate coverage 1.15.0
$ dart test --coverage=coverage
$ dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info
To view the generated coverage report you can use lcov .
# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/
# Open Coverage Report
$ open coverage/index.html
Available Makefile Commands π #
Setup & Dependencies #
make clean- Clean build artifactsmake get- Get Flutter dependenciesmake pod-install- Install iOS podsmake upgrade- Upgrade Flutter dependencies
Running #
make run- Run app (optionally with FLAVOR and TARGET)
Code Generation #
make build-runner- Run build_runner to generate codemake build-runner-watch- Watch mode for build_runnermake gen-assets- Generate assets using FlutterGen
Testing #
make test- Run all testsmake test-coverage- Generate test coverage report
Asset Generation #
make icon-launcher- Generate launcher iconsmake splash-screen- Generate splash screen
Localization #
make intl-utils- Generate localization filesmake purge-unused-l10n- Remove unused localization keys
Release Management #
make npm-install- Install npm dependenciesmake release- Create a new releasemake release-dry- Dry run of release
Builds #
make build-aab- Build Android App Bundlemake build-apk- Build Android APKmake build-ipa- Build iOS IPA
Distribution #
make upload-apk-to-appdistrib- Upload APK to Firebase App Distributionmake upload-aab-to-appdistrib- Upload AAB to Firebase App Distributionmake upload-aab-to-playstore- Upload AAB to Play Storemake upload-ipa-to-appdistrib- Upload IPA to Firebase App Distributionmake upload-ipa-to-testflight- Upload IPA to TestFlight
Package Publishing #
make deploy-dry-run- Validate package before publishingmake deploy- Publish package to pub.flutter-io.cn