Description
This PR introduces a new feature to automatically sort dependencies within pubspec.yaml alphabetically. This helps keep the project configuration clean and organized, similar to how Dart imports are sorted.
Key Changes
- New Logic: Added
lib/pubspec_sort.dart which handles the parsing and sorting of the yaml file.
- Dependency: Added
yaml_edit package to safely modify pubspec.yaml while preserving existing comments and whitespace.
- Integration: Updated
bin/import_sorter.dart to execute the pubspec sorting after the import sorting process.
- Scope: The tool now sorts the following sections if they exist:
dependencies
dev_dependencies
dependency_overrides
Testing
- Added unit tests in
test/pubspec_test.dart to verify that dependencies are correctly reordered alphabetically.
- Verified manually that the tool runs successfully via
dart run import_sorter.
Type of Change
Description
This PR introduces a new feature to automatically sort dependencies within
pubspec.yamlalphabetically. This helps keep the project configuration clean and organized, similar to how Dart imports are sorted.Key Changes
lib/pubspec_sort.dartwhich handles the parsing and sorting of the yaml file.yaml_editpackage to safely modifypubspec.yamlwhile preserving existing comments and whitespace.bin/import_sorter.dartto execute the pubspec sorting after the import sorting process.dependenciesdev_dependenciesdependency_overridesTesting
test/pubspec_test.dartto verify that dependencies are correctly reordered alphabetically.dart run import_sorter.Type of Change