Libraries like https://github.com/danielsz/system offer a way to share reusable components/namespaces. The downside is that it is impossible to customize (without weird hacks or code). Often it is easier to copy-paste the code in your repo.
What if we could automate the copy-pasting in these cases? I would like to propose an idea for a (leiningen) plugin to share code without the pains of normal dependencies. No (Leftpad)[http://www.haneycodes.net/npm-left-pad-have-we-forgotten-how-to-program/] issues.
- No external dependencies (no risk of losing a remote dependency e.g. read about left-pad issues [1])
- Less work than copy-pasting
- No conflicts between dependencies
- Allow customizability
- Create a Leiningen plugin that can scan a code base for dependency information
- Dependencies start with a file header, e.g. `::snippet {:uri "https://github.com/danielsz/system/blob/master/src/system/components/elasticsearch.clj"}
- When running the tool this will be replaced with the appropriate headers.
- We can re-run this command to check for updates. The tool can show us the diff and can ask us to appy it. And if we want commit the changes too.
- When we made local changes. The tool should be able to show us, the difference
- With the right credentials, we can also do this for private repositories.
- Maybe we can also do it for more than one file if we added a bit of extra meta-information to the source repository (or we should make smart use of namespaces)
References: [1] Leftpad http://www.haneycodes.net/npm-left-pad-have-we-forgotten-how-to-program/ [2] Semantic versioning critics http://blog.scottlogic.com/2016/12/15/semantic-versioning-is-not-enough.html
How would the local changes work? Say I import some component
foo
, at version 1, make some changes, and then importfoo
again, which now has version 2, and the changes betweenfoo
1 and 2 are incompatible with my changes?