Skip to content

Commit

Permalink
Fix for #338 - Handle unpublished packages on github package registry (
Browse files Browse the repository at this point in the history
…#469)

* handle non-existant packages on github pkg registry

* add changeset

* resolve prettier issues

Co-authored-by: Ben Conolly <ben@thinkmill.com.au>
  • Loading branch information
camdub and Noviny committed Nov 23, 2020
1 parent 3ab2adc commit c6d38b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-snails-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/cli": minor
---

Handle JSON errors for unpublished packages on the github package registry
9 changes: 9 additions & 0 deletions packages/cli/src/commands/publish/npm-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ export function getPackageInfo(pkgName: string) {
env: Object.assign({}, process.env, envOverride)
});

// Github package registry returns empty string when calling npm info
// for a non-existant package instead of a E404
if (result.stdout.toString() === "") {
return {
error: {
code: "E404"
}
};
}
return jsonParse(result.stdout.toString());
});
}
Expand Down

0 comments on commit c6d38b5

Please sign in to comment.