elm-lang / elm-package

Command line tool to share Elm libraries
BSD 3-Clause "New" or "Revised" License
213 stars 66 forks source link

Exclude folders / files when publishing or installing a package #248

Closed sporto closed 7 years ago

sporto commented 7 years ago

I often put example folders in my packages. I find it very useful to have this in the same repo because when working on a new version of a lib I can change the lib and the example at the same time to make sure everything works fine.

However when users download the package, they get the examples with it. This has caused some issues for some users apparently https://github.com/sporto/hop/issues/40.

It would be nice if we could set something in elm-package to exclude files or folders when the user install the package. e.g. http://doc.crates.io/manifest.html#the-exclude-and-include-fields-optional

process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

lydell commented 7 years ago

Something that has worked great for me in the npm world, is to use the files field of package.json. (Go follow that link! It’s very short and tells exactly how files work.) If elm-package.json had a similar field, it looks like "files": ["src"] would do it for hop’s case.

evancz commented 7 years ago

@sporto, longer term, I would like to only distribute the files that are absolutely necessary.

Many package managers force you to list all the files that are needed. Haskell does this. I think this is pointless because the compiler can figure it out faster and never make mistakes.

So in the long run, we will have a more elaborate publication process that verifies builds, tests, licenses, etc. and it will be able to strip out anything unnecessary. In the meantime, I recommend keeping stuff in your repository. Unless you have some sort of insane artifacts, it should not be a huge size difference.