Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary files are included in the published packages #6325

Open
lilnasy opened this issue Jan 1, 2025 · 5 comments
Open

Unnecessary files are included in the published packages #6325

lilnasy opened this issue Jan 1, 2025 · 5 comments

Comments

@lilnasy
Copy link

lilnasy commented Jan 1, 2025

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 lilnasy added bug Something isn't working needs triage labels Jan 1, 2025
@kt3k
Copy link
Member

kt3k commented Jan 6, 2025

We used to ignore test files at some point, but reverted it by recommendation from JSR team. #4441 (comment)

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

@kt3k kt3k removed bug Something isn't working needs triage labels Jan 6, 2025
@lilnasy
Copy link
Author

lilnasy commented Jan 6, 2025

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.

@kt3k
Copy link
Member

kt3k commented Jan 6, 2025

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

@lilnasy
Copy link
Author

lilnasy commented Jan 6, 2025

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!

@kt3k
Copy link
Member

kt3k commented Jan 10, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants