Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions patches/@changesets__cli@2.31.0.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
diff --git a/dist/changesets-cli.cjs.js b/dist/changesets-cli.cjs.js
index 9f0bd6c5f96011be225269a71365a878cb822bb7..bdfeb1dee761de629736e750a1d3f16eb1dedadc 100644
index 9f0bd6c5f9..21405ffde2 100644
--- a/dist/changesets-cli.cjs.js
+++ b/dist/changesets-cli.cjs.js
@@ -870,7 +870,7 @@ async function infoAllow404(packageJson) {
@@ -842,9 +842,23 @@ function getPackageInfo(packageJson) {
}
};
}
- return jsonParse(result.stdout.toString());
+ return normalizeNpmInfo(jsonParse(result.stdout.toString()));
});
}
+// npm 12 prints `npm info <pkg> --json` as a one-element array around the
+// packument. Changesets reads `.versions` on that document; an array has
+// none, so every current version looks unpublished.
+function normalizeNpmInfo(parsed) {
+ if (!Array.isArray(parsed)) return parsed;
+ const withVersions = parsed.find(item => item && Array.isArray(item.versions));
+ if (withVersions) return withVersions;
+ if (parsed.length === 1 && parsed[0] && typeof parsed[0] === "object") return parsed[0];
+ return {
+ error: {
+ code: "E404"
+ }
+ };
+}
async function infoAllow404(packageJson) {
var _pkgInfo$error;
let pkgInfo = await getPackageInfo(packageJson);
@@ -870,7 +884,7 @@ async function infoAllow404(packageJson) {
// we check `npm info` before publishing but `npm info` can return stale data at times
// so we need to gracefully handle this situation
function isAlreadyPublishedError(output) {
Expand All @@ -11,12 +36,12 @@ index 9f0bd6c5f96011be225269a71365a878cb822bb7..bdfeb1dee761de629736e750a1d3f16e
}
// we have this so that we can do try a publish again after a publish without
// the call being wrapped in the npm request limit and causing the publishes to potentially never run
@@ -950,7 +950,7 @@ async function internalPublish(packageJson, opts, twoFactorState) {
@@ -954,7 +968,7 @@ async function internalPublish(packageJson, opts, twoFactorState) {
let json = getLastJsonObjectFromString(stderr.toString()) || getLastJsonObjectFromString(stdout.toString());
if (json !== null && json !== void 0 && json.error) {
var _json$error$detail;
- if (json.error.code === "E403" && isAlreadyPublishedError(json.error.summary)) {
+ if (json.error.code === "E403" && [json.error.summary, json.error.detail, json.error.message].some(isAlreadyPublishedError)) {
+ if ((json.error.code === "E403" || json.error.code === "ERR_PNPM_FAILED_TO_PUBLISH") && [json.error.summary, json.error.detail, json.error.message].some(isAlreadyPublishedError)) {
// we don't need to log anything here, it just turned out the version was already published so we gracefully exit the publish process
return {
result: "skipped"
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading