elm-git-install
elm-git-install copied to clipboard
Custom Source Directory
I've managed to get elm-git-install to install a component library from Gitlab. However, it expects it to be in root/src. The idea was this Elm UI component library we're building would live in a monorepo with other tech stacks like React, documentation, etc. so it'd be in a sub-directory. I've briefly glanced at the elm-git-install source code, and it appears y'all were thinking along the same lines:
const depSources = ['src']; // Can packages have source directories?
If you look at how it installs it, it puts your repo + "/src" at the end. Before I go attempting to make a PR, I just want to make sure I have the right idea here. It appears I'd need to modify populateSources
to look at opts
to see if there are any custom options, and instead of hardcoding /src
it'd be like opts.path + '/src'
or something like that.
How do you propose this path get's specified?
+1. Allowing source-directories
key for type package in elm.json, should be the way to go, right?
The Elm compiler doesn't support source-directories
in elm.json
for packages.
The Elm compiler doesn't support source-directories in elm.json for packages.
But with elm-git-install, the package's elm.json is never read by the compiler. In which case, elm would never get a chance to complain. Although, I guess using elm-git.json at package level with the source-directories key could work as well and it'll be less hacky.
the package's elm.json is never read by the compiler
elm-git-install
only downloads the relevant code. The code is still compiled by the elm compiler. Also, any time the elm compiler performs modifications (like adding a package) it strips away unsupported properties.
Right. It'll make working on the package more difficult.
using elm-git.json at package level with the source-directories key could work as well
What about this?
Sorry for the delay on this. I'll try to articulate my concerns this weekend.
In think the way this would have to be implemented, is that elm-git.json
is altered so that instead of just being an object of gitUrl -> version
, it also works with gitUrl -> { path: customPath, version: version }
.
This is not an ideal situation, though, as you'd have to specify it per project, but I think that's the best we can do.