rustwasm / wasm-pack

📦✨ your favorite rust -> wasm workflow tool!
https://rustwasm.github.io/wasm-pack/
Apache License 2.0
6.31k stars 409 forks source link

Consider not using the "files" key in package.json #557

Open fitzgen opened 5 years ago

fitzgen commented 5 years ago

From https://github.com/rustwasm/wasm-pack/pull/556

Larger picture / for the future: rather than writing code to try and include all of our files, which can be buggy as we've seen multiple times now, it would easier to implicitly include everything in the pkg folder by not specifying the "files" key in package.json, since we don't put anything in there that we don't want included in the package anyways.

Redrield commented 5 years ago

Wen I was experimenting with the generated package.json to try to find a workaround to #663, I found that the .gitignore that is generated is also interpreted by npm as an implicit file exclusion list. Removing the "files" key entirely results in the archive only containing the README and license files.

ashleygwilliams commented 5 years ago

after discussion in the the rustwasm meeting last week, we've opted to continue using the files key but to populate it with the set of the files found in pkg/ at time of calling wasm-pack publish.

ibaryshnikov commented 5 years ago

Any progress here? It looks important becase it prevents inline snippets (which is a very cool feature itself) from being published by default. The workaround is to rm pkg/.gitignore pkg/package.json and to provide your own package.json

sh-tiye commented 2 years ago

Any progress here?

benma commented 1 year ago

I am using this workaround to add additional files to be published, after wasm-pack build:

jq '.files += ["somefile.js"]' pkg/package.json > tmp.json && mv tmp.json pkg/package.json

Built-in support for adding custom files would be great!