zwilias / elm-json

Install, upgrade and uninstall Elm dependencies
MIT License
183 stars 9 forks source link

Feature proposition: `elm-json merge` when vendoring elm packages #36

Open j-maas opened 3 years ago

j-maas commented 3 years ago

I was just debugging a library and vendored it into my app to test the changes I made. For that I downloaded the library's source code and referenced it in my elm.json's src-directories. But I had to manually figure out which dependencies I needed to add to my app's elm.json.

With that use case in mind, I would propose an elm-json merge command which takes two elm.json and figures out which dependencies of the first need to be installed in the second. Usage could look like elm-json merge --from ../library/elm.json --into ./elm.json.

Is this a feature that would fit this utility?

j-maas commented 3 years ago

I just noticed that it's enough to get a list of the package names and feed that into elm-json install. It will install everything just fine.

So the only tedious part is getting the list of package names to feed into that, for which I currently use regexr.com with the regex "(.+?)": and then its list tool with the pattern $1 to output them.