Thank you for your interest in contributing to Flutter Bunny CLI! This guide will help you get started with contributing to the project.
Getting Started
Prerequisites
- Dart SDK (latest stable version)
- Flutter SDK (latest stable version)
- Git
Setting Up the Development Environment
-
Fork the repository on GitHub
-
Clone your forked repository
git clone https://github.com/demola234/flutter_bunny_cli.git
-
Navigate to the project directory
cd flutter_bunny_cli
-
Install dependencies
dart pub get
Project Structure
The Flutter Bunny CLI project is structured as follows:
flutter_bunny/
├── bin/
│ └── flutter_bunny.dart # Entry point
├── lib/
│ ├── src/
│ │ ├── cli/ # CLI runners and process management
│ │ ├── commands/ # Command implementations
│ │ ├── common/ # Shared utilities and models
│ │ ├── templates/ # Templates for code generation
│ │ └── version.dart # Version information
│ └── flutter_bunny.dart # Library entry point
├── test/ # Test directory
├── pubspec.yaml # Package information
└── README.md # Project documentation
Development Workflow
Creating a New Feature
-
Create a new branch from
main
git checkout -b feature/your-feature-name
-
Implement your feature or fix a bug
-
Write tests for your changes
-
Run tests to ensure everything works
dart test
-
Format your code
dart format .
-
Run the analyzer
dart analyze
-
Commit your changes
git commit -m "Add your descriptive commit message"
-
Push to your fork
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
Implementing a New Command
To implement a new command for Flutter Bunny:
- Create a new file in
lib/src/commands/
for your command - Extend the
Command<int>
class fromargs
package - Implement the required methods
- Register your command in
lib/src/commands/flutter_bunny_runner.dart
Example command implementation:
import 'package:args/command_runner.dart';
import 'package:mason_logger/mason_logger.dart';
class MyNewCommand extends Command<int> {
MyNewCommand({
required Logger logger,
}) : _logger = logger {
// Define arguments and flags
argParser
..addOption(
'option-name',
help: 'Description of the option',
defaultsTo: 'default-value',
)
..addFlag(
'flag-name',
help: 'Description of the flag',
negatable: false,
);
}
final Logger _logger;
@override
String get description => 'Description of your command';
@override
String get name => 'command-name';
@override
Future<int> run() async {
// Implement your command logic
final optionValue = argResults?['option-name'] as String;
final flagValue = argResults?['flag-name'] as bool;
_logger.info('Running command with option: $optionValue and flag: $flagValue');
// Do something...
return ExitCode.success.code;
}
}
Adding Templates
To add new templates:
- Create template files in
lib/src/templates/
- Use variables with double curly braces:
{{variable_name}}
- Register the template in the appropriate generator
Testing
We use the test
package for testing. Please ensure all new features or bug fixes have corresponding tests.
To run tests:
dart test
To run a specific test:
dart test test/commands/create_command_test.dart
Code Style
Please follow the Dart style guide and use the Dart formatter:
dart format .
Pull Request Process
- Ensure your code is properly formatted and passes all tests
- Update documentation if needed
- Update the CHANGELOG.md file with your changes
- Create a Pull Request with a clear title and description
- Link any related issues in the Pull Request description
Reporting Issues
When reporting issues, please include:
- A clear and descriptive title
- Steps to reproduce the issue
- Expected behavior
- Actual behavior
- Flutter and Dart version information
- Flutter Bunny CLI version information
Feature Requests
Feature requests are welcome! Please provide:
- A clear and descriptive title
- A detailed description of the proposed feature
- Any relevant examples or use cases
- If possible, a sketch or mockup of how the feature might work
Code of Conduct
Please note that this project adheres to a Code of Conduct (opens in a new tab). By participating, you are expected to uphold this code.
License
By contributing to Flutter Bunny CLI, you agree that your contributions will be licensed under the project's MIT License (opens in a new tab).
Contact
If you have questions or need help, you can:
- Open an issue (opens in a new tab)
- Reach out to the maintainers via email
Thank you for contributing to Flutter Bunny CLI!