Skip to content

Commit 81e0eb5

Browse files
authored
chore: lerna changelog conventional commits (#56)
* feat: add lerna version script in package.json * docs: update README & CONTRIBUTING * ci: remove BREAKING CHANGE from regex as it is only relevant in commit footer * fix: regex in title checker workflow * ci: add labeling for each package
1 parent 7af2268 commit 81e0eb5

5 files changed

Lines changed: 23 additions & 16 deletions

File tree

.github/labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
"no examples 📝":
22
- all: ["packages/eslint-plugin/**/*", "!example-app/**/*"]
3+
4+
"📏 eslint-plugin"
5+
- all: ["packages/eslint-plugin/**/*","!packages/typescript-config/**/*"]
6+
7+
"typescript-config"
8+
- all: ["packages/typescript-config/**/*","!packages/eslint-plugin/**/*"]

.github/pr-conventional-title-checker-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "no-conventional-pr-name"
44
},
55
"CHECKS": {
6-
"regexp": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|BREAKING CHANGE){1}(([w-.]+))?(:) ([w ])+([sS]*)$",
6+
"regexp": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(\\!)?\\: ([\\w ])+([\\s\\S]*)",
77
"ignoreLabels": ["WIP"]
88
},
99
"MESSAGES": {

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ Each package has its own specifications for contribution. Please refer to the `C
66

77
## Conventional commits
88

9-
We use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to automate the release process.
10-
Later on, we will add a `CHANGELOG.md` file to each package, which will be automatically updated on each release.
9+
We use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to automate the release process. Please follow the commit message format described in the link above. Lerna will automatically generate the changelog for each package based on the commit messages since the last version. (see [README.md](README.md#publishing-a-new-version-of-a-package))

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,21 @@ All you have to do is the versioning of the packages you want to publish.
3737

3838
> You need to be on the main branch and have the repo write access to publish a new version.
3939
40-
Run `yarn lerna version` to start the process. It will ask you which packages you want to publish and which version you want to publish them under.
40+
Run `yarn publish` to start the process. It will run the command `yarn lerna version --conventional-commits` which will prompt you to select the packages you want to publish and the version bump for each of them.
41+
42+
Lerna will prompt you to select the version bump for each package. It will also generate the changelog for each package based on the commit messages since the last version.
43+
44+
> Versioning and changelogs generation using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
45+
46+
Here's an example of the output:
4147

4248
```bash
43-
? Select a new version (currently 1.0.0) (Use arrow keys)
44-
❯ Patch (1.0.1) # bug fixes
45-
Minor (1.1.0) # new features
46-
Major (2.0.0) # breaking changes
47-
Prepatch (1.0.1-alpha.0)
48-
Preminor (1.1.0-alpha.0)
49-
Premajor (2.0.0-alpha.0)
50-
Custom Prerelease
51-
Custom Version
52-
```
49+
lerna info Looking for changed packages since @bam.tech/eslint-plugin@1.0.0
50+
lerna info getChangelogConfig Successfully resolved preset "conventional-changelog-angular"
5351

54-
After you have selected the packages and the versions, Lerna will push a new tagged commit with the version bumps in `package.json` files.
55-
The pushed tag will trigger the Github Workflow which will publish the packages to NPM.
52+
Changes:
53+
- @bam.tech/eslint-plugin: 1.0.0 => 1.1.0
54+
```
5655

5756
## Running commands
5857

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"name": "root",
33
"private": true,
4+
"scripts": {
5+
"publish": "lerna version --conventional-commits --no-private"
6+
},
47
"workspaces": [
58
"packages/*",
69
"example-app"

0 commit comments

Comments
 (0)