crystal-lang / shards

Dependency manager for the Crystal language
Other
765 stars 102 forks source link

Adding the requirer to shard.lock #433

Open jwoertink opened 4 years ago

jwoertink commented 4 years ago

I thought this issue existed already, but I didn't see it. It would be nice if we looked in the shard.lock file to see which shard required the shards. I'm mainly talking about the sub dependencies.

If I have this shard.yml

dependencies:
  teeplate:
    github: luckyframework/teeplate
    version: ~> 0.8.2

development_dependencies:
  ameba:
    github: crystal-ameba/ameba
    version: ~> 0.13

And my shard.lock looks like

shards:
  ameba:
    git: https://github.com/crystal-ameba/ameba.git
    version: 0.13.2

  future:
    git: https://github.com/crystal-community/future.cr.git
    version: 0.1.0

  teeplate:
    git: https://github.com/luckyframework/teeplate.git
    version: 0.8.2

I never required future, so which shard did? Now, I know that it could either be teeplate, or ameba, but it could also be both. So maybe it looks like:

shards:
  ameba:
    git: https://github.com/crystal-ameba/ameba.git
    version: 0.13.2

  future:
    git: https://github.com/crystal-community/future.cr.git
    version: 0.1.0
    dependency_of:
      - ameba
      - teeplate

  teeplate:
    git: https://github.com/luckyframework/teeplate.git
    version: 0.8.2

In my case, I have a specific shard that is having some issues in Lucky stopping it from running a shards install, but I don't know where it's coming from without going through each of the dependencies to see what's requiring it.

bcardiff commented 4 years ago

That information could be nice for humans in the shard.lock, yes. But since molinillo didn't need we avoid adding it. In a Gemfile lock you can see some of that information at the end IIRC.

You can use $ shards list --tree to get the information you want today 🎉

jwoertink commented 4 years ago

oh yeah! I totally forgot about shards list --tree. That actually does help. hmm... In that case, an easy fix could be a comment in the shard.lock that maybe points to something like crystal-lang.org/reference/shards (or whatever). I think there's already another issue to add a comment mentioning that the lock file is auto generated, so that could be included.

# This lock file is autogenerated...
# For more information on this file see https://crystal-lang.org/reference/shards
version: 2.0
...

Then that could be a great reference to all the neat things you can do. Or we can close this out since I have a way to get the info I was looking for. Thanks!

straight-shoota commented 4 years ago

/cc #195