deno_std icon indicating copy to clipboard operation
deno_std copied to clipboard

Unnecessary files are included in the published packages

Open lilnasy opened this issue 11 months ago • 5 comments

Describe the bug Most (none?) packages don't distinguish between files that are necessary for end-projects and development-related files that happen to be inside the same folder.

Steps to Reproduce For example, in the package for @std/msgpack, the test spec modules, and test data files are also included.

Expected behavior The packages implement filters described in https://jsr.io/docs/publishing-packages#filtering-files

Environment Not applicable

lilnasy avatar Jan 01 '25 18:01 lilnasy

We used to ignore test files at some point, but reverted it by recommendation from JSR team. https://github.com/denoland/std/pull/4441#issuecomment-1983362882

Can you elaborate on why test files should be excluded from published packages?

kt3k avatar Jan 06 '25 04:01 kt3k

As a library author, my thinking is that @std packages are foundations to build other libraries upon. As such, they would ideally be as lean as possible.

I don't want users reviewing their node_modules folder (to determine space-hogging libraries, for example), only to find there are a bunch of test data files being indirectly included by one of my libraries.

lilnasy avatar Jan 06 '25 04:01 lilnasy

I don't want users reviewing their node_modules folder (to determine space-hogging libraries, for example), only to find there are a bunch of test data files being indirectly included by one of my libraries.

Is your package published to npm, or jsr? If you publish your package to npm and let it depends on @std, then your argument make sense to me.

(BTW if you publish your package to JSR and it targets Deno runtime, then test files are not downloaded to the users as Deno only downloads the necessary files.)

kt3k avatar Jan 06 '25 06:01 kt3k

Is your package published to npm, or jsr?

It is going to be to both. I currently have the necessary files from std vendored directly into my project.

(BTW if you publish your package to JSR and it targets Deno runtime, then test files are not downloaded to the users as Deno only downloads the necessary files.)

Thanks, that's nice to know!

lilnasy avatar Jan 06 '25 06:01 lilnasy

@lucacasonato (cc @crowlKats) What do you think about the best practice here?

Should we exclude test scripts and fixtures to make npm tarballs smaller? Or should we do something else?

kt3k avatar Jan 10 '25 07:01 kt3k