Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit 6e4910d

Browse files
authored
chore: automatic changelog generation (#82)
1 parent 14aa75d commit 6e4910d

File tree

4 files changed

+1118
-4
lines changed

4 files changed

+1118
-4
lines changed

.versionrc.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* eslint-disable */
2+
3+
const { readdirSync, statSync } = require('fs');
4+
const { join } = require('path');
5+
6+
const files = [];
7+
function read(dir, depth = 0) {
8+
const paths = readdirSync(dir);
9+
10+
for (const path of paths) {
11+
const full = join(dir, path);
12+
13+
if (statSync(full).isDirectory() && depth <= 1) {
14+
read(full, depth + 1);
15+
} else {
16+
files.push(full);
17+
}
18+
}
19+
}
20+
21+
read(join(__dirname, 'libs'));
22+
read(join(__dirname, 'services'));
23+
24+
module.exports = {
25+
bumpFiles: files
26+
.filter(f => f.endsWith('package.json'))
27+
.map(filename => ({
28+
filename,
29+
type: 'json'
30+
}))
31+
};

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

package.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"test:ci": "jest --ci --no-stack-trace --verbose",
1313
"release:npm": "pnpm recursive publish --access public --filter @cordis/* --filter=!./services",
1414
"release:docker": "docker build -t cordislib/gateway -f ./services/gateway/Dockerfile . && docker push cordislib/gateway",
15-
"release": "pnpm run lint && pnpm run test:ci && rimraf \"*/*/?(dist|types)/**\" && pnpm run build && pnpm run release:npm && pnpm run release:docker"
15+
"release": "pnpm run lint && pnpm run test:ci && rimraf \"*/*/?(dist|types)/**\" && pnpm run build && pnpm run release:npm && pnpm run release:docker",
16+
"changelog": "standard-version"
1617
},
1718
"repository": {
1819
"type": "git",
@@ -32,6 +33,8 @@
3233
"@babel/generator": "^7.14.1",
3334
"@babel/preset-env": "^7.14.1",
3435
"@babel/preset-typescript": "^7.13.0",
36+
"@commitlint/cli": "^12.1.4",
37+
"@commitlint/config-conventional": "^12.1.4",
3538
"@strictsoftware/typedoc-plugin-monorepo": "^0.3.1",
3639
"@types/jest": "^26.0.23",
3740
"@typescript-eslint/eslint-plugin": "^4.23.0",
@@ -45,6 +48,7 @@
4548
"jest": "^26.6.3",
4649
"lint-staged": "^10.5.4",
4750
"rimraf": "^3.0.2",
51+
"standard-version": "^9.3.0",
4852
"typedoc": "^0.19.2",
4953
"typedoc-plugin-as-member-of": "^1.0.2",
5054
"typedoc-plugin-markdown": "^3.8.0",
@@ -54,12 +58,25 @@
5458
},
5559
"husky": {
5660
"hooks": {
57-
"pre-commit": "lint-staged"
61+
"pre-commit": "lint-staged",
62+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
5863
}
5964
},
6065
"lint-staged": {
6166
"*.ts": [
6267
"eslint --fix"
6368
]
69+
},
70+
"commitlint": {
71+
"extends": [
72+
"@commitlint/config-conventional"
73+
],
74+
"rules": {
75+
"scope-case": [
76+
2,
77+
"always",
78+
"pascal-case"
79+
]
80+
}
6481
}
6582
}

0 commit comments

Comments
 (0)