meilisearch-js icon indicating copy to clipboard operation
meilisearch-js copied to clipboard

Publish to JSR alongside NPM

Open flevi29 opened this issue 10 months ago • 4 comments

Pull Request

Let's try and publish to JSR as well.

  • add script that creates jsr.json from package.json
  • add necessary entries to publish.yaml workflow according to https://jsr.io/docs/publishing-packages#publishing-from-github-actions

To do for @curquiza:

  • create a JSR account, then scope (@meilisearch) and package (meilisearch) according to https://jsr.io/docs/publishing-packages#creating-a-scope-and-package
  • link package to GitHub repository from package settings in JSR, detailed here: https://jsr.io/docs/publishing-packages#publishing-from-github-actions

And that should be it. If any issues arise we can discuss it, or maybe I could get some access to this JSR scope and package, see what else we can properly set up there.

Related issue

Fixes #1792

PR checklist

Please check if your PR fulfills the following requirements:

  • [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • [x] Have you read the contributing guidelines?
  • [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

  • New Features

    • Added support for publishing packages to JSR in addition to npm.
  • Chores

    • Updated workflow and scripts to streamline the publishing process and permissions.
    • Adjusted .gitignore to exclude JSR configuration files.

flevi29 avatar Jan 28 '25 09:01 flevi29

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.01%. Comparing base (d8d2abe) to head (4137323).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1841   +/-   ##
=======================================
  Coverage   99.01%   99.01%           
=======================================
  Files          18       18           
  Lines        1418     1418           
  Branches      299      299           
=======================================
  Hits         1404     1404           
  Misses         14       14           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jan 28 '25 09:01 codecov[bot]

Walkthrough

The changes introduce support for publishing the package to JSR in addition to npm. This includes workflow adjustments for permissions and commands, a new npm script for JSR publishing, a script to generate jsr.json, and an update to .gitignore to exclude the generated config file.

Changes

File(s) Change Summary
.github/workflows/publish.yml Updated workflow: renamed, adjusted permissions, simplified install, added JSR publish step, and tweaked npm publish commands.
package.json Added a publish:jsr script to generate jsr.json and run jsr publish via npx.
scripts/make-jsr-json.js New script to generate jsr.json from package.json with transformed exports and included files.
.gitignore Added jsr.json to ignored files.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub Actions
    participant npm Registry
    participant JSR Registry

    Developer->>GitHub Actions: Push release
    GitHub Actions->>GitHub Actions: Install dependencies
    GitHub Actions->>npm Registry: Publish package (npm publish)
    GitHub Actions->>GitHub Actions: Run publish:jsr script
    GitHub Actions->>GitHub Actions: Generate jsr.json
    GitHub Actions->>JSR Registry: Publish package (jsr publish)

Assessment against linked issues

Objective Addressed Explanation
Add support for publishing to JSR alongside npm (#1792)
Generate and ignore JSR-specific config files (#1792)

Poem

A hop and a skip, we publish anew,
Now npm and JSR both get their due!
With scripts and configs, the work is all done,
Our package can shine for everyone.
The burrow is tidy, .gitignore in place—
On multiple registries, we’ve set the pace!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f850fa69989fcfd2e246a06e45f913b9e5088de and 41373238d66cfa5a2d220d603d5d85d8099890cb.

📒 Files selected for processing (1)
  • package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: integration-tests (Node.js 22)
  • GitHub Check: integration-tests (Node.js 20)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 19 '25 10:05 coderabbitai[bot]

@coderabbitai review

flevi29 avatar May 19 '25 17:05 flevi29

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot] avatar May 19 '25 17:05 coderabbitai[bot]