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

Fix for #338 - Handle unpublished packages on github package registry #469

Merged
merged 4 commits into from
Nov 23, 2020

Conversation

camdub
Copy link
Contributor

@camdub camdub commented Oct 9, 2020

Seeing the issue referenced in #338.

When running npm info pkgName --json NPM returns the 'E404' JSON response the code is expecting. If the registry target is the Github package registry, the same npm info command returns just an empty string.

https://github.com/atlassian/changesets/blob/d570a24740a374a9547dd7d931e6ac854e36a9fb/packages/cli/src/commands/publish/npm-utils.ts#L61

This code errors b/c it tries to parse an empty string. This PR just returns an error object similar to what NPM returns so that the publish command just sees it as an unpublished package.

I'm not super familiar with this repo, but this solution could be improved by checking the registry and only allowing empty responses to count as 404 for github packages. Unsure how to do that here.

@changeset-bot
Copy link

changeset-bot bot commented Oct 9, 2020

🦋 Changeset detected

Latest commit: ac7e8da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@changesets/cli Minor

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

@atlassian-cla-bot
Copy link

atlassian-cla-bot bot commented Oct 9, 2020

Hooray! All contributors have signed the CLA.

@Noviny Noviny merged commit c6d38b5 into changesets:master Nov 23, 2020
@Noviny
Copy link
Collaborator

Noviny commented Nov 23, 2020

Thanks for this!

@github-actions github-actions bot mentioned this pull request Nov 23, 2020
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.

None yet

2 participants