Skip to content

Expose the pub outdated command #2322

Closed

Description

@mit-mit

Dart 2.8 will have a new pub outdated command for viewing the staleness of dependencies.

We'd like to have this exposed in VS Code, perhaps to the right of the current Get Packages command?
Screenshot 2020-03-27 at 14 05 37

Activity

  1. added this to the v3.10.0 milestone on Mar 27, 2020
  2. added
    in commandsRelates to commands (usually invoked from the command Palette)
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Mar 27, 2020
  3. DanTup commented on Mar 27, 2020

    @DanTup
    Member

    Makes sense to me!

    It'd be even cooler if we could run it in a JSON mode that gives us the results including the range in the pubspec for each dependency - then we could show info/warning squiggles under the outdated ones when you have the pubspec open?

  4. mit-mit commented on Mar 27, 2020

    @mit-mit
    ContributorAuthor

    The tool does support JSON! There is on ongoing PR to add the flag for it: https://github.com/dart-lang/pub/pull/2402/files

  5. jonasfj commented on Mar 27, 2020

    @jonasfj

    Hmm, we don't expose the SourceSpan (start/end offset) for the version constraint in pubspec.yaml -- looking at the code I don't think we'll want to trace that logic through pub.

    But, parsing the pubspec.yaml with package:yaml it should be easy to get the SourceSpan for the package name in pubspec.yaml.

    That said, it's worth noting that pub outdated also highlights out-dated transitive dependencies.

    Side note: The command also displays the latest resolable version. That is the version you would get if you removed all version constraints from your pubspec.yaml and ran pub get. We show it this way as upgrading one package often requires other packages to be upgraded too. And looking at the latest version available is often uninteresting because it might be possible to get the latest version (for example: flutter pins a lot of dependencies).

  6. DanTup commented on Mar 27, 2020

    @DanTup
    Member

    The tool does support JSON!

    Ah, great! :-)

    parsing the pubspec.yaml with package:yaml it should be easy

    I can't use that here as the extension is TypeScript/JS (not Dart), however I think we could find the ranges reasonably reliably with some basic parsing or regex so it's not a big deal.

    Side note: The command also displays the latest resolable version.

    Ah, interesting to know! I'll do some testing with it and see how it might make sense to present the data (I may ping you with questions). If we do put something inside the editor, it would be in addition to allowing you to run easily run the command and showing the usual full output.

    Thanks!

  7. DanTup commented on Apr 13, 2020

    @DanTup
    Member

    Am I right in thinking that for Flutter apps we should be using flutter packages outdated, so it uses the correct pub-cache folder when using the zip file?

  8. jonasfj commented on Apr 13, 2020

    @jonasfj
  9. mit-mit commented on Apr 14, 2020

    @mit-mit
    ContributorAuthor

    @DanTup actually, might be good to use pub not packages terminology. We changed that in the flutter tool ~6 months ago:

    $flutter help
    
    Available commands:
      analyze                  Analyze the project's Dart code.
    ...
      pub                      Commands for managing Flutter packages.
    
  10. DanTup commented on Apr 14, 2020

    @DanTup
    Member

    might be good to use pub not packages

    Updated, thanks!

  11. DanTup commented on Apr 15, 2020

    @DanTup
    Member

    @mit-mit any opinions on icons? Previously we had a single icon, and holding down Alt would change it to Update (otherwise it would be Get). It feels weird to have an Outdated icon without also having a specific Update one, so probably we should have all three.

    I'm struggling to find three icons that reasonable mean get/update/outdated though (since they're all fairly similar actions!). They do have tooltips, so you can figure out what each is, but of course it'd be good if they were fairly obvious.

    Here's what I have so far (Get / Update / Outdated) - I changed the original Get one as it didn't seem to fit with the others I could find. These were all taken from https://material.io/resources/icons/?style=baseline.

    Screenshot 2020-04-15 at 08 37 31

  12. mit-mit commented on Apr 15, 2020

    @mit-mit
    ContributorAuthor

    The get one looks fine. But I also like https://material.io/resources/icons/?icon=get_app&style=baseline

    Upgrade looks good.

    I like the Outdated icon you have there. An alternative would be https://material.io/resources/icons/?icon=find_replace&style=baseline.

    Unrelated to icons, not that it's 'Upgrade' not 'Update':

    Available commands:
    ...
      upgrade     Upgrade the current package's dependencies to latest versions.
    
  13. DanTup commented on Apr 15, 2020

    @DanTup
    Member

    Thanks! I've updated Get, though I was less keen on the find_replace one so kept the one from above. Now looks like these:

    Screenshot 2020-04-15 at 09 06 41

    Screenshot 2020-04-15 at 09 08 05

    it's 'Upgrade' not 'Update'

    Looks like we are correctly using "Upgrade" in all the right places - though I misnamed the icon as "update" when I saved it and had that in my head. I've renamed it to match the command name though to avoid future confusion. Thanks!

  14. mit-mit commented on Apr 15, 2020

    @mit-mit
    ContributorAuthor

    LGTM, thanks

  15. DanTup commented on Apr 15, 2020

    @DanTup
    Member

    By the way - is there an easy way to get a project into a state where pub outdated will return some packages? I accidentally ran pub upgrade on the one I was testing with, and I can't figure out how to get it into an outdated state now. I tried lowering versions on pubspec and fetching those, then putting them back, but that didn't seem to trigger it (I guess I need to have older versions of their dependencies?).

  16. DanTup commented on Apr 15, 2020

    @DanTup
    Member

    Oh nm, I figured I can just change the versions in pubspec.lock!

  17. mit-mit commented on Apr 16, 2020

    @mit-mit
    ContributorAuthor

    Hi @DanTup, what's the ETA for this going out in a release?

  18. DanTup commented on Apr 16, 2020

    @DanTup
    Member

    It's merged into master so is planned to go into the next release (around end of month). I can make a beta version if you want to try it out in advance.

  19. mit-mit commented on Apr 16, 2020

    @mit-mit
    ContributorAuthor

    That sounds great, thanks

  20. DanTup commented on Apr 20, 2020

    @DanTup
    Member

    There's a beta version here if you want to try it:

    https://github.com/Dart-Code/Dart-Code/releases/tag/v3.10.0-beta.1

    (note: the commands won't show up unless your SDK is > v2.8.0-a)

  21. DanTup commented on Apr 27, 2020

    @DanTup
    Member

    @mit-mit I've pushed a new beta here (no changes to this, but has some other things merged in):

    https://github.com/Dart-Code/Dart-Code/releases/tag/v3.10.0-beta.3

    This command is called out in the release notes here:

    https://dartcode.org/releases/v3-10/

    Ping me if you'd like anything tweaking!

  22. mit-mit commented on Apr 27, 2020

    @mit-mit
    ContributorAuthor

    Works well, no comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in commandsRelates to commands (usually invoked from the command Palette)is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions