Open jakemac53 opened 1 year ago
One similar piece of prior art is the test_only
attribute for build rules in bazel
. This prevents non-test code from depending on test_only
dependencies, so test code does not leak into applications.
Related: https://github.com/dart-lang/pub-dev/issues/6400
I think we want an attribute in pubspec.yaml with the intended use (globally activated tool, dev dependency,...) you should probably be allowed to be in more than one category...
dart pub add
could also use this to default the section it adds a dependency to.
CC: @jonasfj
Yes that sounds like it would fit, this could essentially be a list of "tags"? We could either restrict those tags to the ones known by pub (at least with a warning) or we could leave it open ended so other tools could have their own tags they support.
We could possibly support searching by tag or surfacing the tags on pub.dev as well.
Yes that sounds like it would fit, this could essentially be a list of "tags"?
We are actively working on "topics" that is more free-form categories/tags you can add to the pubspec and browse on pub.dev.
I would prefer that for the feature discussed in this issue we have a predefined set of values with specific semantics, especially when we start basing hints and cli behavior on it.
I would prefer that for the feature discussed in this issue we have a predefined set of values with specific semantics, especially when we start basing hints and cli behavior on it.
Ok, that makes sense if we have slightly different plans already in progress.
Should these values be negatable as well? In other words, should we let packages opt out of being "globally activate-able" etc?
Should these values be negatable as well? In other words, should we let packages opt out of being "globally activate-able" etc?
Good question - my intuition says no. Perhaps by including the list you by default negate anything not included.
But we don't have a fully specified proposal yet, just some ideas kicking around.
Perhaps we should write a proposal, this wouldn't be a huge feature after all
DO put development dependencies in dev_dependencies
Description
If a package specifies that it is a development only dependency, then you should only include it in the
dev_dependencies
section of your pubspec.yaml, and not the regulardependencies
section.The one exception to this rule is if your package is also listed as a development only dependency.
Details
Some packages, like
lints
,test
, andbuild_runner
should only be depended on asdev_dependencies
by most users. Adding them to the regulardependencies
section is not only unnecessary but creates real issues around version lock in the ecosystem, as those dependencies release breaking versions.As an example, no two packages should fail to version solve together just because they are on a different major version of the
lints
package - those lints only apply for local development of the package.New pubspec opt in
This would require the ability to specify a package as "development only". We can bikeshed on what that should be called, but it should probably just be a new top level field in the package, something like:
Kind
This guards the ecosystem against version lock and bloated downloads for packages.
Bad Examples
Good Examples
Discussion
cc @sigurdm @jonasfj for thoughts on adding something to the pubspec. This may not have to be something official either.
Discussion checklist