Skip to content

Commit 2a09f6c

Browse files
authored
fix: downgrade semantic-release (#1344)
To prevent mixed ESM/CJS imports
1 parent 900d7e7 commit 2a09f6c

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
"@semantic-release/commit-analyzer": "^10.0.1",
233233
"@semantic-release/git": "^10.0.1",
234234
"@semantic-release/github": "^9.0.3",
235-
"@semantic-release/npm": "^10.0.4",
235+
"@semantic-release/npm": "^9.0.2",
236236
"@semantic-release/release-notes-generator": "^11.0.4",
237237
"@types/chai": "^4.2.16",
238238
"@types/chai-as-promised": "^7.1.3",
@@ -302,7 +302,7 @@
302302
"react-native-test-runner": "^5.0.0",
303303
"read-pkg-up": "^10.0.0",
304304
"rimraf": "^5.0.0",
305-
"semantic-release": "^21.0.7",
305+
"semantic-release": "^20.1.3",
306306
"semantic-release-monorepo": "^7.0.5",
307307
"semver": "^7.3.8",
308308
"source-map-support": "^0.5.20",

src/release-rc.js

+33-9
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,23 @@ async function releaseMonorepoRcs (commit, ctx) {
7676

7777
await retry(async () => {
7878
console.info(`npm publish --tag ${ctx.tag} --dry-run ${!process.env.CI}`)
79-
await execa('npm', ['publish', '--tag', ctx.tag, '--dry-run', `${!process.env.CI}`], {
80-
stdout: 'inherit',
81-
stderr: 'inherit',
82-
cwd: project.dir
83-
})
79+
80+
try {
81+
await execa('npm', ['publish', '--tag', ctx.tag, '--dry-run', `${!process.env.CI}`], {
82+
stdout: 'inherit',
83+
stderr: 'inherit',
84+
cwd: project.dir,
85+
all: true
86+
})
87+
} catch (/** @type {any} */ err) {
88+
if (err.all?.includes('You cannot publish over the previously published versions')) {
89+
// this appears to be a bug in npm, sometimes you publish successfully but it also
90+
// returns an error
91+
return
92+
}
93+
94+
throw err
95+
}
8496
}, {
8597
retries: ctx.retries
8698
})
@@ -107,10 +119,22 @@ async function releaseRc (commit, ctx) {
107119

108120
await retry(async () => {
109121
console.info(`npm publish --tag ${ctx.tag} --dry-run ${!process.env.CI}`)
110-
await execa('npm', ['publish', '--tag', ctx.tag, '--dry-run', `${!process.env.CI}`], {
111-
stdout: 'inherit',
112-
stderr: 'inherit'
113-
})
122+
123+
try {
124+
await execa('npm', ['publish', '--tag', ctx.tag, '--dry-run', `${!process.env.CI}`], {
125+
stdout: 'inherit',
126+
stderr: 'inherit',
127+
all: true
128+
})
129+
} catch (/** @type {any} */ err) {
130+
if (err.all?.includes('You cannot publish over the previously published versions')) {
131+
// this appears to be a bug in npm, sometimes you publish successfully but it also
132+
// returns an error
133+
return
134+
}
135+
136+
throw err
137+
}
114138
}, {
115139
retries: ctx.retries
116140
})

0 commit comments

Comments
 (0)