feat: Add automatic sorting for pubspec.yaml dependencies#88
feat: Add automatic sorting for pubspec.yaml dependencies#88Franklyn-R-Silva wants to merge 5 commits intofluttercommunity:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds functionality to automatically sort dependencies in pubspec.yaml files alphabetically, helping maintain cleaner and more consistent project configurations. When running the import_sorter tool, it now automatically processes and sorts the dependencies, dev_dependencies, and dependency_overrides sections.
Key Changes:
- Created new
lib/pubspec_sort.dartwith sorting logic using the yaml_edit package - Integrated pubspec sorting into the main execution flow in
bin/import_sorter.dart - Added unit tests in
test/pubspec_test.dartto verify sorting behavior
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/pubspec_sort.dart | New file implementing the core sorting logic for pubspec.yaml dependencies using yaml_edit package |
| test/pubspec_test.dart | New test file with unit tests covering dependencies, dev_dependencies sorting, and no-change scenarios |
| bin/import_sorter.dart | Integrated pubspec sorting into main execution flow with console output |
| lib/sort.dart | Improved comments and documentation for existing import sorting logic (cosmetic changes) |
| pubspec.yaml | Added yaml_edit dependency required for the new functionality |
| README.md | Added documentation section explaining the new pubspec sorting feature and updated pre-commit hook example |
| example/example_app/ios/Flutter/ephemeral/* | Generated iOS Flutter files (no review needed) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Franklyn-R-Silva
left a comment
There was a problem hiding this comment.
Adjustment to organize dependencies in pubspec.yaml
Description
This PR adds functionality to automatically sort dependencies in
pubspec.yamlalphabetically.It processes the following sections:
dependenciesdev_dependenciesdependency_overridesImplementation Details
yaml_editpackage to safely modify the yaml file while preserving comments and structure.lib/pubspec_sort.dart.bin/import_sorter.dart.test/pubspec_test.dartto verify the sorting logic.Type of Change