Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Source Directory #34

Open
JesterXL opened this issue Mar 9, 2022 · 8 comments
Open

Custom Source Directory #34

JesterXL opened this issue Mar 9, 2022 · 8 comments

Comments

@JesterXL
Copy link

JesterXL commented Mar 9, 2022

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.

@robinheghan
Copy link
Owner

How do you propose this path get's specified?

@phenax
Copy link

phenax commented Jun 20, 2022

+1. Allowing source-directories key for type package in elm.json, should be the way to go, right?

@robinheghan
Copy link
Owner

The Elm compiler doesn't support source-directories in elm.json for packages.

@phenax
Copy link

phenax commented Jun 22, 2022

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.

@robinheghan
Copy link
Owner

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.

@phenax
Copy link

phenax commented Jun 22, 2022

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?

@robinheghan
Copy link
Owner

Sorry for the delay on this. I'll try to articulate my concerns this weekend.

@robinheghan
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants