den icon indicating copy to clipboard operation
den copied to clipboard

Consider renaming pull to upgrade

Open sethladd opened this issue 9 years ago • 5 comments

It took me a while to understand that pull means upgrade. Also, the --help text of Update any outdated dependencies is misleading... it made me think that it tries to update any out of date dependency across my project.

I wanted to find out which command will upgrade a single dependency.

maybe add an example to the --help text, like you have in the README?

sethladd avatar May 13 '15 02:05 sethladd

Did you figure out what den pull does?

zoechi avatar May 13 '15 06:05 zoechi

I think so, yes. It upgrades a dependency's version in your pubspec.yaml

sethladd avatar May 13 '15 06:05 sethladd

So, when the constraint of a dependency in pubspec.yaml excludes newer available versions den pull widens the constraint to include the most recent version? Does it run pub upgrade to fetch it as well?

zoechi avatar May 13 '15 10:05 zoechi

Here's the help text:

$ den help pull

Description:

  Update any outdated dependencies

Usage:

  den pull [options] [<package name>...]

    <package name>    Name of dependency to pull.  If omitted, then pulls all dependencies in the pubspec.

Options:

      --[no-]caret
  -h, --help          Print this usage information.

Here's what e.g. den pull path test actually does:

  • check that path and test exist as dependencies in your pubspec, else exit with an error message.
  • call the pub.dartlang.org/packages API to retrieve the latest stable versions for each specified dependency.
  • check if the pubspec's existing dependency constraints for the specified dependencies allow the latest stable versions. If not, the dependency is considered "outdated".
  • If "outdated", then let's assume the latest stable is 1.2.3. The dependency constraint in the pubspec is "updated" to ^1.2.3 if your pubspec's sdk constraint is a subset of >=1.8.0 (SDK versions which allow ^ constraints), else uses the expanded form: >=1.2.3 < 2.0.0. (T
  • saves changes to the file system.
  • logs a message about which dependencies were updated, and their new and old versions.
  • does NOT run pub get or pub upgrade since a lot of folks will have a file watcher which does that automatically for them once den pull ... saves the changes to the pubspec. This was the case with the Dart Editor, but does Webstorm support that?

den pull (without arguments) acts as if you passed all existing dependencies from your pubspec.

den fetch ... acts exactly the same as above, except it just tells you about outdated dependencies (by "fetch"ing the the latest stable versions), doesn't actually update them.

Probably don't want that much detail in the help output, but should probably be more explicit about what "outdated" and "update" mean. Some of the info is in the README, but it probably needs to be fleshed out in both places.

I also have considered adding a --keep-min flag which will cause the existing dependency constraints to be widened, such that the min of the constraint stays the same, and only the max is updated to allow everything up to the next breaking change after the latest stable version. That would probably be useful as well.

Naming

den fetch and den pull is an analogy with the same-named git commands. fetch gets the latest changes (versions) and tells you about them. pull does the same, but additionally "merges" those changes (versions) into your pubspec. It's not a perfect analogy, but not bad either IMO. Another pair of names I considered was den latest and den update. Would that be an improvement? Personally, I thought update makes it sound like it does something similar to pub upgrade, especially considering it used to called pub update, and a lot of folks are familiar with npm update. And obviously den upgrade would have the same issue.

Would be happy to get any suggestions for improvements!

seaneagan avatar May 13 '15 14:05 seaneagan

Great! Now I can start using it :)

I would prefer den latest or den upgrade (for check) and den latest -w (for check and write) to not have to memorize two command names for almost the same thing

I would like --keep-min (with a shortcut -m). Widen the constraints for newer versions shouldn't automatically narrow them for older ones. I want use pub downgrade, pub run test to check if everything still works with older versions and increase only if there is a conflict.

zoechi avatar May 13 '15 15:05 zoechi