elm-lang / elm-package

Command line tool to share Elm libraries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exclude folders / files when publishing or installing a package

sporto opened this issue · comments

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 sporto/hop#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

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.

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.

@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.