Search code examples
gitcrystal-lang

What to gitignore with shards packages and crystal


What do I ignore inside of a .gitignore file with Crystal shards? I'm coming from a Node.js background where I would ignore the infamous node_modules. I recently ran shards install and got a few new files and directories. For now, I'm ignoring lib/ and .shards/ and saving shard.lock to VCS.

Are there any conventions around this I should know?


Solution

  • You can have a first clue with www.gitignore.io/api/crystal

    # Created by https://www.gitignore.io/api/crystal
    
    ### Crystal ###
    /docs/
    /lib/
    /bin/
    /.shards/
    
    # Libraries don't need dependency lock
    # Dependencies will be locked in application that uses them
    #/shard.lock
    
    
    # End of https://www.gitignore.io/api/crystal
    

    Johannes Müller adds in the comments:

    Tip: crystal init sets up a project structure for you, including a .gitignore file and other useful defaults.