dependency_validator icon indicating copy to clipboard operation
dependency_validator copied to clipboard

Support for mono repo

Open SAGARSURI opened this issue 1 year ago • 3 comments

Hey, I have a mono-repo setup with around 100+ local packages. Can you provide a solution on how to have a single dart_dependency_validator.yaml across the project?

SAGARSURI avatar May 16 '24 11:05 SAGARSURI

Just being able to pass exclude/ignore on command line instead of via per-package yaml configuration would go a long way.

devilbuddy avatar May 27 '24 06:05 devilbuddy

Configuring options via cli args seems like a good solution to this, but I can't commit to any timeline on when this could be implemented. I'd be happy to review something if you'd like to take a stab at what that would look like

One immediate workaround could be to symlink to a root dart_dependency_validator.yaml file from within each of the nested local packages. That way updates to the root, would automatically be reflected in each of the nested packages

matthewnitschke-wk avatar May 30 '24 02:05 matthewnitschke-wk

I wonder if there is any plan to support dart workspaces

It's still quite early, but I expect this to become the standard for mono-repos very soon. Current Flutter stable already supports dart packages and I expect the next stable to support flutter packages as well.

When creating a workspace you add a pubspec.yaml in the root of a mono repo. In the pubspec.yaml of the package you add resolution: workspace to indicate the dependency resolution should happen on the workspace level instead of the package level. The result is that the package won't have a pubspec.lock file or a separate analyzer context.

When running the dependency_validator in a workspace package you will get the following error:

No .dart_tool/package_config.json file found, please run "pub get" first.

That's because the .dart_tool folder is missing some files image

The workspace_ref.json indicates the root of the workspace.

The dependency_validator should validate how you define dependencies on the workspace level, for example if you allow pinned dependencies, but it should still validate unused/missing and under/over promoted dependencies on the package level.

renefloor avatar Aug 30 '24 13:08 renefloor

This should probably be closed as a duplicate of #137

Levi-Lesches avatar Dec 23 '24 17:12 Levi-Lesches

As per @Levi-Lesches comment, we're consolidating this in #137

matthewnitschke-wk avatar Dec 26 '24 22:12 matthewnitschke-wk