wasm-pack icon indicating copy to clipboard operation
wasm-pack copied to clipboard

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

Open fitzgen opened this issue 6 years ago • 5 comments
trafficstars

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.

fitzgen avatar Feb 27 '19 18:02 fitzgen

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.

Redrield avatar Jul 04 '19 19:07 Redrield

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.

ashleygwilliams avatar Jul 23 '19 15:07 ashleygwilliams

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

ibaryshnikov avatar Oct 20 '19 10:10 ibaryshnikov

Any progress here?

sh-tiye avatar Dec 21 '21 10:12 sh-tiye

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!

benma avatar Sep 19 '23 14:09 benma