Search code examples
crystal-lang

Central repository for Crystal Shards?


Is there anything like NPM or pip for Crystal?

Are there plans or a roadmap to achieve this?

I have gotten tired of copying and pasting github repositories into my shards file.


Solution

  • The dependency manager for Crystal is shards. However, different from npm or pip, there is no centralized repository for registering shards. This has some benefits, among them avoiding a critical point of failure.

    For the process of configuring your shard dependencies, this makes no significant difference. It's just that instead of adding a registered name, you put in the address of a repository.

    Currently, there is no option to add a shard to your shards file directly from the command line (but there is an issue for that) so you have to edit shards.yml and add it manually.

    Honestly, I don't think this is much of a disturbance. I can't remember using a command line tool to add a local dependency even if many dependency managers support that. If you're adding a dependency, you'll also have to add code to use it. So you'll need to work in an editor anyway and can easily edit the dependency file there.