Skip to content

Commit d70ad5e

Browse files
committed
build: migrate from lerna back to semantic-release with manual monorepo publishing configuration
1 parent aa84584 commit d70ad5e

File tree

3 files changed

+94
-19
lines changed

3 files changed

+94
-19
lines changed

.releaserc.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
module.exports = {
2+
plugins: [
3+
'@semantic-release/commit-analyzer',
4+
'@semantic-release/release-notes-generator',
5+
[
6+
// Update versions in sub-packages dependencies
7+
"@google/semantic-release-replace-plugin",
8+
{
9+
"replacements": [
10+
{
11+
"files": ["packages/*/package.json"],
12+
"from": "\"mongodb-memory-server\": \".*\"",
13+
"to": "\"mongodb-memory-server\": \"${nextRelease.version}\"",
14+
},
15+
{
16+
"files": ["packages/*/package.json"],
17+
"from": "\"mongodb-memory-server-core\": \".*\"",
18+
"to": "\"mongodb-memory-server-core\": \"${nextRelease.version}\"",
19+
}
20+
]
21+
}
22+
],
23+
"@semantic-release/changelog",
24+
["@semantic-release/git", {
25+
"assets": ["packages/*/package.json}", "CHANGELOG.md"],
26+
"message": "v${nextRelease.version}\n\n[skip ci]"
27+
}],
28+
[
29+
'@semantic-release/npm',
30+
{
31+
npmPublish: true,
32+
pkgRoot: './packages/mongodb-memory-server-core',
33+
},
34+
],
35+
[
36+
'@semantic-release/npm',
37+
{
38+
npmPublish: true,
39+
pkgRoot: './packages/mongodb-memory-server',
40+
},
41+
],
42+
[
43+
'@semantic-release/npm',
44+
{
45+
npmPublish: true,
46+
pkgRoot: './packages/mongodb-memory-server-global',
47+
},
48+
],
49+
[
50+
'@semantic-release/npm',
51+
{
52+
npmPublish: true,
53+
pkgRoot: './packages/mongodb-memory-server-global-3.4',
54+
},
55+
],
56+
[
57+
'@semantic-release/npm',
58+
{
59+
npmPublish: true,
60+
pkgRoot: './packages/mongodb-memory-server-global-3.6',
61+
},
62+
],
63+
[
64+
'@semantic-release/npm',
65+
{
66+
npmPublish: true,
67+
pkgRoot: './packages/mongodb-memory-server-global-4.0',
68+
},
69+
],
70+
[
71+
'@semantic-release/npm',
72+
{
73+
npmPublish: true,
74+
pkgRoot: './packages/mongodb-memory-server-global-4.2',
75+
},
76+
],
77+
[
78+
'@semantic-release/npm',
79+
{
80+
npmPublish: true,
81+
pkgRoot: './packages/mongodb-memory-server-global-4.4',
82+
},
83+
]
84+
],
85+
};

lerna.json

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11
{
22
"version": "6.6.9",
3-
"command": {
4-
"publish": {
5-
"allowBranch": [
6-
"master",
7-
"fix-lerna"
8-
],
9-
"exact": true,
10-
"conventionalCommits": true,
11-
"ignoreChanges": [
12-
"**/__fixtures__/**",
13-
"**/__tests__/**",
14-
"**/*.md"
15-
]
16-
},
17-
"version": {
18-
"createRelease": "github"
19-
}
20-
}
3+
"command": {}
214
}

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
"description": "In-memory MongoDB Server. Designed with testing in mind, the server will allow you to connect your favourite ODM or client library to the MongoDB Server and run integration tests isolated from each other.",
66
"repository": "https://github.com/nodkz/mongodb-memory-server",
77
"devDependencies": {
8+
"@google/semantic-release-replace-plugin": "^1.0.0",
9+
"@semantic-release/changelog": "^5.0.1",
10+
"@semantic-release/commit-analyzer": "^8.0.1",
11+
"@semantic-release/git": "^9.0.0",
12+
"@semantic-release/npm": "^7.0.6",
13+
"@semantic-release/release-notes-generator": "^9.0.1",
814
"@types/jest": "26.0.13",
915
"@types/mongodb": "3.5.27",
1016
"@types/node": "14.6.4",
@@ -18,6 +24,7 @@
1824
"lerna": "3.22.1",
1925
"mongodb": "3.6.1",
2026
"prettier": "2.1.1",
27+
"semantic-release": "^17.1.1",
2128
"ts-jest": "26.3.0",
2229
"typescript": "4.0.2"
2330
},
@@ -32,7 +39,7 @@
3239
"watch": "jest --env node --watch",
3340
"jest": "jest --env node",
3441
"build": "tsc --build tsconfig.build.json",
35-
"release": "lerna publish --conventional-commits",
42+
"semantic-release": "semantic-release",
3643
"readme:toc": "npx doctoc ./README.md",
3744
"postinstall": "yarn build"
3845
}

0 commit comments

Comments
 (0)