dart-lang / pub

The pub command line tool
https://dart.dev/tools/pub/cmd
BSD 3-Clause "New" or "Revised" License
1.05k stars 230 forks source link

Symbolic link to test pub packages locally before deploying them #4402

Closed michaelnjuguna closed 1 month ago

michaelnjuguna commented 1 month ago

A symbolic link similar to npm link in npm that developers can use to test their packages locally before deploying them

sigurdm commented 1 month ago

What is the use case?

Does https://dart.dev/tools/pub/dependencies#dependency-overrides solve the problem? It allows to use a local dependency instead of a hosted one.

We also are launching pub workspaces. It also provides ways to test sets of related packages together before publishing. See preliminary documentation at https://github.com/dart-lang/site-www/pull/6117

michaelnjuguna commented 1 month ago

It's use case is that after creating a pub package, the developer can then link the package locally and test it in another project

sigurdm commented 1 month ago

Does https://dart.dev/tools/pub/dependencies#dependency-overrides solve the problem? It allows to use a local dependency instead of a hosted one.

michaelnjuguna commented 1 month ago

It wouldn't hurt to have a CLI option

sigurdm commented 1 month ago

Generally we try to avoid having implicit configuration.

Having overrides explicit in the local project is IMO preferable as it makes it more clear what is going (harder to forget to turn it off).

If you want to have an override that is not seen by git status you can use the file pubspec_overrides.yaml to make the override.

To do it from the cli:

$ echo 'dependency_overrides: {foo: {path: path/to/foo}}' > pubspec_overrides.yaml
sigurdm commented 1 month ago

Perhaps we should have a command

$ dart pub override <pkg>:<descriptor>

For updating the overrides from the command line...