Skip to content

Commit 5dbd120

Browse files
authored
feat: switch to @anolilab/multi-semantic-release (#1450)
Replaces semantic-release-monorepo with @anolilab/multi-semantic-release as srm is abandonware. Also updates semantic release deps and gets rid of forks due to ESM support landing in semantic release upstream.
1 parent b8c8996 commit 5dbd120

File tree

4 files changed

+34
-17
lines changed

4 files changed

+34
-17
lines changed

.aegir.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default {
1717
'playwright-test',
1818
'react-native-test-runner',
1919
'semantic-release',
20-
'semantic-release-monorepo',
20+
'@anolilab/multi-semantic-release',
2121
'source-map-support',
2222
'typedoc-plugin-mdn-links',
2323
'typedoc-plugin-missing-exports',

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,15 @@
222222
"release": "node src/index.js release --no-bundle"
223223
},
224224
"dependencies": {
225+
"@anolilab/multi-semantic-release": "^1.0.3",
225226
"@electron/get": "^3.0.0",
226227
"@polka/send-type": "^0.5.2",
227228
"@semantic-release/changelog": "^6.0.1",
228-
"@semantic-release/commit-analyzer": "^10.0.1",
229+
"@semantic-release/commit-analyzer": "^11.1.0",
229230
"@semantic-release/git": "^10.0.1",
230231
"@semantic-release/github": "^9.0.3",
231-
"@semantic-release/npm": "^10.0.4",
232-
"@semantic-release/release-notes-generator": "^11.0.4",
232+
"@semantic-release/npm": "^11.0.2",
233+
"@semantic-release/release-notes-generator": "^12.1.0",
233234
"@types/chai": "^4.2.16",
234235
"@types/chai-as-promised": "^7.1.3",
235236
"@types/chai-string": "^1.4.2",
@@ -246,7 +247,7 @@
246247
"chai-parentheses": "^0.0.2",
247248
"chai-string": "^1.5.0",
248249
"chai-subset": "^1.6.0",
249-
"conventional-changelog-conventionalcommits": "^6.1.0",
250+
"conventional-changelog-conventionalcommits": "^7.0.2",
250251
"cors": "^2.8.5",
251252
"depcheck": "^1.4.3",
252253
"diff": "^5.1.0",
@@ -297,8 +298,7 @@
297298
"react-native-test-runner": "^5.0.0",
298299
"read-pkg-up": "^11.0.0",
299300
"rimraf": "^5.0.0",
300-
"semantic-release": "https://registry.npmjs.org/@achingbrain/semantic-release/-/semantic-release-21.0.9.tgz",
301-
"semantic-release-monorepo": "https://registry.npmjs.org/@achingbrain/semantic-release-monorepo/-/semantic-release-monorepo-8.0.2.tgz",
301+
"semantic-release": "^23.0.0",
302302
"semver": "^7.3.8",
303303
"source-map-support": "^0.5.20",
304304
"strip-bom": "^5.0.0",

src/release.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { execa } from 'execa'
55
import fs from 'fs-extra'
66
import Listr from 'listr'
77
import { calculateSiblingVersion } from './check-project/utils.js'
8-
import { isMonorepoProject, hasDocs, glob } from './utils.js'
8+
import { isMonorepoProject, isMonorepoRoot, hasDocs, glob } from './utils.js'
99

1010
/**
1111
* @typedef {import("./types").GlobalOptions} GlobalOptions
@@ -29,16 +29,25 @@ const tasks = new Listr([
2929
* @param {GlobalOptions} ctx
3030
*/
3131
task: async (ctx) => {
32-
let args = ctx['--'] ?? []
33-
34-
if (isMonorepoProject()) {
35-
args = ['-e', 'semantic-release-monorepo', ...args]
32+
const args = ctx['--'] ?? []
33+
34+
if (isMonorepoRoot()) {
35+
await execa('multi-semantic-release', [
36+
// eslint-disable-next-line no-template-curly-in-string
37+
'--tag-format', '${name}-${version}',
38+
'--deps.bump', 'satisfy',
39+
'--deps.release', 'minor',
40+
...args
41+
], {
42+
preferLocal: true,
43+
stdio: 'inherit'
44+
})
45+
} else {
46+
await execa('semantic-release', args, {
47+
preferLocal: true,
48+
stdio: 'inherit'
49+
})
3650
}
37-
38-
await execa('semantic-release', args, {
39-
preferLocal: true,
40-
stdio: 'inherit'
41-
})
4251
}
4352
},
4453
{

src/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,14 @@ export const isMonorepoProject = (dir = process.cwd()) => {
280280
return manifest?.packageJson.workspaces != null
281281
}
282282

283+
export const isMonorepoRoot = (dir = process.cwd()) => {
284+
const manifest = readPackageUpSync({
285+
cwd: dir
286+
})
287+
288+
return manifest?.packageJson.workspaces != null
289+
}
290+
283291
export const usesReleasePlease = (dir = process.cwd()) => {
284292
try {
285293
const mainYmlPath = path.resolve(dir, '.github', 'workflows', 'main.yml')

0 commit comments

Comments
 (0)