-
Notifications
You must be signed in to change notification settings - Fork 736
Fix prerelease detection by fetching packument #1745
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
base: main
Are you sure you want to change the base?
Conversation
Replaced npm-registry-fetch with pacote and @npmcli/config to properly fetch package metadata including prerelease versions with authentication. The previous implementation using npm-registry-fetch failed to authenticate because it doesn't automatically read .npmrc files. The new implementation: - Uses @npmcli/config to load npm configuration from .npmrc files - Passes flatOptions (including auth tokens) to pacote - Converts pacote's versions object to an array for compatibility This mirrors how npm CLI's `view` command works internally, ensuring proper authentication and access to all versions including prereleases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 6a6ab1f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1745 +/- ##
==========================================
+ Coverage 80.69% 81.67% +0.98%
==========================================
Files 54 54
Lines 2264 2276 +12
Branches 684 687 +3
==========================================
+ Hits 1827 1859 +32
+ Misses 432 412 -20
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add @types/pacote and @types/npmcli__config as devDependencies - Create local type declaration for @npmcli/config/lib/definitions internal path - Add explicit return type to infoAllow404 for better type inference Fixes tsc, lint, and coverage checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Apply Prettier formatting to npm-utils.ts and npmcli-config-definitions.d.ts to pass format checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add test cases for: - Error handling with error codes (E500, etc.) - Error handling without error codes (network errors) - Mock @npmcli/config to avoid actual config loading in tests Improves npm-utils.ts coverage from 25.74% to 28.71% and branch coverage from 15.91% to 26.14%. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
I can't repro the problem. It indicates that Changesets was able to determine that those prerelease versions exist just fine and didn't try to republish them. |
benmccann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds almost 200 dependencies. It would be nice to do as much as possible without so many dependencies. E.g. using the built-in fetch where possible
56 dependencies: https://npmgraph.js.org/?q=@npmcli/config
124 dependencies: https://npmgraph.js.org/?q=pacote
Fix fetching of prerelease packages so that
changeset publishdoes not try to overwrite existing package.Previously,
changeset publishwould fetch the package usingnpm info(akanpm view) and then if the package did not exist, do thenpm publish.However, when fetching prereleased packages,
npm infofilters out any published prerelease package since it callssemver.satisfieswithout the{includePrerelease: true}option (view.js).Example reproduction:
The second publish log contained:
Disclosure: the code is all generated by claude code (sonnet 4.5) except the first commit which was gpt-5-codex-medium. Take it with a grain of salt.