Overall, I don’t really see the benefit over just caching ~/.elm.
If you really want to use git as a cache, you can set the ELM_HOME variable to move the ~/.elm directory whever you like. So you can run commands like
ELM_HOME=/whatever/you/want/ elm make
Then you can commit the resulting directory however you like. Maybe within the project you have a little bash script that sets ELM_HOME before calling elm. Then the contents of that directory will be specific to the project.
Seems like an easy way to get all the benefits you want, but without any changes except in your own workflow.
Aside: Package Facts
-
If the compiler cannot reach the package website, it will try to build with the contents of
~/.elmso that people can begin new projects offline, as long as they have used the packages they want once before. -
I believe the package website can build any project for any past version. I recall looking at the logs to assess this, and I believe there are even some 0.16 projects out there still. But people can just save
elm-stuff/or~/.elmas needed for their particular version. -
The best way to reduce load on the servers is to cache
~/.elmon CI. That will also make your CI faster and more reliable. Lots of things can go wrong if your builds need to go out to the internet. Dreamhost DNS went down recently. GitHub goes down sometimes. Etc. Whether you cache with git commits or some other way, the best protection is to not need to make HTTP requests outside of your own system!