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

Only include necessary files for JSR #973

Merged
merged 5 commits into from
Dec 26, 2024

Conversation

neoncitylights
Copy link
Contributor

@neoncitylights neoncitylights commented Dec 11, 2024

This will publish jsr.json, LICENSE.md, README.md, and everything under src/ directory. To locally verify this:

jsr publish --dry-run

Fixes #972

To locally verify only the necessary files are included, you can run:
```sh
jsr publish --dry-run --allow-dirty
```

Fixes #972
@fabian-hiller
Copy link
Owner

fabian-hiller commented Dec 11, 2024

Thank you for creating this PR. Why do you think it is better to publish only selected files? Is this approach recommended by the JSR team? Are package.json, LICENSE.md and other files not necessary?

@fabian-hiller fabian-hiller self-assigned this Dec 11, 2024
@fabian-hiller fabian-hiller added the question Further information is requested label Dec 11, 2024
@neoncitylights
Copy link
Contributor Author

neoncitylights commented Dec 11, 2024

No problem :) And thanks for the question, I should have been more explicit in the PR.

There's no official recommendation from the JSR team on that; the reason for this is more just to reduce disk size when users install the library via JSR's compat layer with npm or the sorts (any that uses node_modules).

Regarding files:

  • LICENSE.md isn't explicitly in the include array, but is specially whitelisted by JSR to be included no matter what.
  • JSR packages only need either a jsr.json, deno.json, or package.json when published. It's still fine to have a mix of jsr.json/deno.json (one of these two) and package.json, but the JSR package would still be usable with just jsr.json.
  • The root mod.ts file is currently ignored since you tell jsr.json to only export from src/index.ts. Like in a lot of the official @std/ packages, it does make sense to include mod.ts if when you're writing a package where you don't have a src/ directory, the code is in the root, but you still want to export everything under a single entrypoint; however, that doesn't apply here. (I didn't initially delete mod.ts file since I had accidentally not noticed that, sorry for the confusion)

Hope that clarifies things! Likewise I understand this is a bit of an opinionated PR (and not an official JSR team recc), so up to you, feel free to close it.

@fabian-hiller
Copy link
Owner

Sorry for my late reply. I was focused on my studies. I will review this PR in the next weeks.

@fabian-hiller fabian-hiller added enhancement New feature or request and removed question Further information is requested labels Dec 19, 2024
@fabian-hiller
Copy link
Owner

Thank you for this PR. I added library/mod.ts back because we need it for deno.land/x/valibot.

@fabian-hiller fabian-hiller merged commit cf13890 into fabian-hiller:main Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSR-published package contains unnecessary files
2 participants