halohalospecial / atom-elmjutsu

A bag of tricks for developing with Elm. (Atom package)
https://atom.io/packages/elmjutsu
MIT License
192 stars 24 forks source link

Check that at least one of the src paths in `elm-package.json` matches (or is a child of) the current project #77

Open halohalospecial opened 7 years ago

halohalospecial commented 7 years ago

From https://github.com/halohalospecial/atom-elmjutsu/issues/76, as suggested by @Positive07:

Also it must be noted that Elmjutsu traverses the path up until it finds an elm-package.json which may not actually belong to the current project. In addition to searching for the elm-package.json elmjutsu should check that at least one of the src paths matches (or is a child of) the current project otherwise there is no need to compile the elm files

pablomayobre commented 7 years ago

As an example:

I have a project made in elm which has it's elm-package.json, this files is for the project itself, so the src path is set to the elm folder where I have all the .elm files or at least the main entry point. In this project folder I have a subfolder called old where I keep old .elm files which are not part of my project.

If I open the old folder with Atom, Elmjutsu searches for the elm-package.json if not found it goes up a directory and finds the elm-package.json of the project, and compiles all the .elm files in the elm folder, which have no relationship with the files in the old folder.

This could be avoided by checking that old is part of the src paths