You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- 👋 Hi, thanks for sending a PR to tidelift-me-up! 💖.
Please fill out all fields below and make sure each item is true and [x]
checked.
Otherwise we may not be able to review your PR. -->
## PR Checklist
- [x] Addresses an existing open issue: fixes#649
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/tidelift-me-up/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/tidelift-me-up/blob/main/.github/CONTRIBUTING.md)
were taken
## Overview
<!-- Description of what is changed and how the code change does that.
-->
This PR adds a user validity check if the API response from the npm
registry API returns zero packages to differentiate between invalid npm
users and valid users with zero packages.
### How It Works
1. The npm registry API is queried with the npm username input.
2. If the response contains one or more packages, result is returned as
usual. (This is the "happy" case.)
3. If the response contains 0 packages, check if npm username exists
using the [npm-user wrapper](https://github.com/sindresorhus/npm-user).
4. If npm username doesn't exist, return an `Invalid npm username.`
error.
6. If npm username does exist but user has zero packages, return a `No
packages found for npm username: ${username}.` error.
### Testing
I updated the unit tests that were affected by these changes and then I
ran the unit tests using `pnpm run test`.
🤖
0 commit comments