Better handling of flutter workspace by adding new config parameters#168
Open
paulanatoleclaudot-betclic wants to merge 2 commits intoWorkiva:masterfrom
Open
Conversation
Author
|
Up :) |
…d exclude workspace packages)
e474d3c to
14c613f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This PR addresses #167 by adding support for workspace-level configuration in
dart_dependency_validator.yamlfiles.When working with Dart pub workspaces (monorepos), users often need to apply the same configuration across multiple packages. For example, certain packages like
camera_androidmight need to be ignored across all workspace sub-packages, or pinned dependencies might need to be allowed workspace-wide.Previously, there was no way to configure these settings globally from the workspace root - each sub-package required its own configuration file with duplicated settings. This PR introduces workspace-aware configuration parameters that allow for:
ignoreandallow_pinssettings from the workspace root unless they have their own local configuration fileThis makes it much easier to manage dependency validation in large monorepos while maintaining flexibility for packages that need custom configuration.
Changes
Configuration (
lib/src/pubspec_config.dart)workspaceGlobalIgnorefield - list of packages to ignore in all workspace sub-packagesworkspacePackageIgnorefield - list of workspace packages to skip during validationpubspec_config.g.dartto serialize/deserialize new fieldsValidation Logic (
lib/src/dependency_validator.dart)checkPackage()to acceptinheritedWorkspaceGlobalIgnoreandinheritedAllowedPinsparametershasLocalFileConfig)workspaceGlobalIgnoreandallowPinsfrom workspace rootworkspacePackageIgnoreduring workspace traversalDocumentation
Tests (
test/workspace_test.dart)workspace_global_ignorefunctionality (3 tests)workspace_package_ignorefunctionality (1 test)allow_pinsinheritance (2 tests)Testing/QA Instructions
The changes are well-covered by automated tests. The passing CI test suite suffices.
To manually verify the new functionality:
dart_dependency_validator.yaml:dart run dependency_validatorfrom the workspace rootcamera_androidis ignored in all sub-packagesexperimental_packagevalidation is skippedallow_pinssetting