Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get list of packages including dependencies? #2853

Closed
rclai opened this issue Oct 18, 2014 · 11 comments
Closed

How to get list of packages including dependencies? #2853

rclai opened this issue Oct 18, 2014 · 11 comments

Comments

@rclai
Copy link

rclai commented Oct 18, 2014

meteor list shows the list of packages that were manually installed using meteor add, is there a way to show the dependencies too like the way npm list does?

@rclai rclai changed the title How to meteor list of packages including dependencies? How to get list of packages including dependencies? Oct 18, 2014
@glasser
Copy link
Contributor

glasser commented Oct 21, 2014

"How can I do this?" questions are best posed on StackOverflow or the meteor-talk mailing list, not our bug tracker. Good luck!

(You can look in the .meteor/versions file.)

@glasser glasser closed this as completed Oct 21, 2014
@steph643
Copy link

For people landing here, this has been asked on StackOverflow six months ago but not answered:
http://stackoverflow.com/questions/26153603/how-to-show-all-package-dependency-tree

@rclai
Copy link
Author

rclai commented Apr 19, 2015

This is more of a feature request.

@trusktr
Copy link
Contributor

trusktr commented May 14, 2015

I'm working on a package that will have such a function to get the dependencies of a given package. When done, I'll split this function (and other useful functions) out into a separate utility package.

@apendua
Copy link
Contributor

apendua commented Nov 1, 2016

@trusktr Did you eventually succeeded in creating such a utility? I've looked into the problem and from my perspective the biggest blocker is that meteor show does not properly extract dependencies from a local package.

@ferborva
Copy link

Aside from the dependency tree listing, which would be very interesting to have as part of the meteor list tool, I'm missing a license tag on the command. With this I mean it would be very nice to do something like:
meteor list -l

and get:

  random@1.0.10 - (License Used)
  retry@1.0.9 - ....
  tracker@1.1.1 - ....
  underscore@1.0.10 - ...
  webapp@1.3.12 - ....

There is a npm module that does something similar for node dependencies (nlf).

@MichaelJCole
Copy link
Contributor

From the SO question:

for p in `meteor list | grep '^[a-z]' | awk '{ print $1"@"$2 }'`; do echo "$p"; meteor show "$p" | grep -E '^  [a-z]'; echo; done

@abernix
Copy link
Contributor

abernix commented Mar 1, 2017

While helpful, that command is painfully slow, and on top of it, it fails if the package has any updates available for it or if it's a local package because Meteor appends * or + to the version number as an indicator. This results in a lot of these errors:

reactive-var@1.0.10*
reactive-var@1.0.10*: not found

Here's a slight modification to the awk which fixes that:

for p in `meteor list | grep '^[a-z]' | awk '{sub(/[+*]$/, "", $2); print $1"@"$2 }'`; do echo "$p"; meteor show "$p" | grep -E '^  [a-z]'; echo; done

With that said, .meteor/versions is a reasonable list of ALL packages, and running meteor show <package-name> is probably much more effective than running that command for every dependency in your entire project.

Also, I don't think the addition of a --tree argument to meteor list would be a terribly hard contribution. This seems much more reasonable (and appreciated by the community) than making a third-party package which will take considerable work to ensure the constraints are respected in the same way that Meteor does. The code is likely somewhere in here and more information is likely available via getConstraints in project-context.js and packageMapFile – though my specific pointers may be a bit off. Anyone want to make an issue/PR for that?

@aedm
Copy link

aedm commented Mar 20, 2017

I wrote a script that displays dependency relations between Meteor packages, like so:

blaze@2.3.1
  depends on:
   - check
   - htmljs
   - jquery
   - observe-sequence
   - ordered-dict
   - reactive-var
   - tracker
   - underscore
  depended by:
   - accounts-base (weak)
   - spacebars
   - ui

Here it is: https://gist.github.com/aedm/979cf82ecaedc9bffa3d9872fc75d1b9

Be aware, it's insanely slow.

@abernix
Copy link
Contributor

abernix commented Mar 21, 2017

Thanks for offering that script, though I'd really suggest that the next person who wants to have this functionality help us build it into Meteor as opposed to building an external script (which is destined to be slow by the very fact that it is external to Meteor) by submitting a pull request. I've made beginners suggestions above! 😬

The existing feature request for this seems to be at #4387. I've marked it pull-requests-encouraged.

@jindrichbartek
Copy link

Done meteor/meteor-feature-requests#143 (comment).
meteor list --tree

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

No branches or pull requests

10 participants