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

Publish package to JSR in addition to npm. #174

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

theengineear
Copy link
Collaborator

@theengineear theengineear commented Feb 29, 2024

This reworks our publish flow to publish both to npm and JSR with the same version (what we want). Note that care is take to wrap the npm version command so that we still use this first-class command as our anchor for bumping our version.

- run: npm ci
# Can we get this to use “deno publish”?
# - run: deno publish
- run: npx jsr publish
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using npx because it exists without need for additional install. I think using deno in the future would be neat though.

# Bump version in package.json using npm version itself. This ensures that we
# stay anchored to first-class tooling. We pass “--git-tag-version=false” to
# prevent the command from (1) committing changes and (2) creating a tag.
prefixed_version="$(npm version --git-tag-version=false "${1}")"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is critical – note that we are 100% passing exactly the value to the real npm version command here. This means that running npm version patch (or some such) will just work. It also means that if you try to provide the same version or something, it’ll fail with a human-readable error message.

@theengineear theengineear merged commit 497a396 into main Feb 29, 2024
1 check passed
@theengineear theengineear deleted the publish-to-jsr branch February 29, 2024 20:30
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

Successfully merging this pull request may close these issues.

1 participant