@alanscodelog/semantic-release-config 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/package.json +5 -4
- package/release.config.js +21 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@alanscodelog/semantic-release-config)
|
|
2
2
|
|
|
3
|
-
My preferred semantic release config.
|
|
3
|
+
My preferred semantic release config, with support for 0.0.0 versioned releases and showing the full commit body in the release notes.
|
|
4
4
|
|
|
5
5
|
# Install
|
|
6
6
|
|
|
@@ -26,7 +26,6 @@ yarn add -D @alanscodelog/semantic-release-config
|
|
|
26
26
|
|
|
27
27
|
## Shown in Changelog
|
|
28
28
|
|
|
29
|
-
|
|
30
29
|
`feat` :star: New Features (minor)
|
|
31
30
|
|
|
32
31
|
`fix` :bug: Fixes (patch)
|
|
@@ -39,6 +38,8 @@ yarn add -D @alanscodelog/semantic-release-config
|
|
|
39
38
|
|
|
40
39
|
`perf` :rocket: Performance Improvements (patch)
|
|
41
40
|
|
|
41
|
+
The commit body is shown by default, this can be disabled by setting the `SEMANTIC_RELEASE_HIDE_COMMIT_BODY` environment variable to `TRUE`, or per commit by adding `<!--skip-release-notes-->` to the commit body.
|
|
42
|
+
|
|
42
43
|
### 0.0.0 Versioned Releases
|
|
43
44
|
|
|
44
45
|
Workaround for semantic-release's lack of 0.0.0 versioning ([see](https://github.com/semantic-release/semantic-release/issues/1507)).
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alanscodelog/semantic-release-config",
|
|
3
3
|
"description": "My preferred semantic release config.",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.1.0",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "release.config.js",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"lint:commits": "commitlint --from $(git rev-list --max-parents=0 HEAD) --to HEAD --verbose",
|
|
8
9
|
"prepare": "husky"
|
|
9
10
|
},
|
|
10
11
|
"dependencies": {
|
|
11
|
-
"@alanscodelog/commitlint-config": "
|
|
12
|
-
"@alanscodelog/semantic-release-config": "^
|
|
12
|
+
"@alanscodelog/commitlint-config": "^3.0.1",
|
|
13
|
+
"@alanscodelog/semantic-release-config": "^4.0.0",
|
|
13
14
|
"@semantic-release/changelog": "^6.0.3",
|
|
14
15
|
"@semantic-release/commit-analyzer": "^12.0.0",
|
|
15
16
|
"@semantic-release/github": "^10.0.5",
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
"semantic-release": "^23.1.1"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
|
-
"commitlint": "^19.3.0",
|
|
23
|
+
"@commitlint/cli": "^19.3.0",
|
|
23
24
|
"husky": "^9.0.11"
|
|
24
25
|
},
|
|
25
26
|
"author": "Alan <alanscodelog@gmail.com>",
|
package/release.config.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import fs from "fs"
|
|
2
|
+
const __dirname = import.meta.dirname;
|
|
3
|
+
const commitPartial = fs.readFileSync(`${__dirname}/template.hbs`).toString()
|
|
4
|
+
|
|
5
|
+
const showCommitBody = process.env.SEMANTIC_RELEASE_HIDE_COMMIT_BODY !== 'TRUE'
|
|
1
6
|
|
|
2
7
|
// feat, fix, revert, docs(readme), perf, tests, chore, deps, ci, build, style, refactor, [any type](no-release)
|
|
3
8
|
const hidden = true
|
|
@@ -31,8 +36,8 @@ const types = [
|
|
|
31
36
|
{ scope: "no-release", release: false },
|
|
32
37
|
]
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
const releaseRules = types.filter(_ => _.release !== undefined).map(_ => {
|
|
40
|
+
const clone = {}
|
|
36
41
|
for (let key of Object.keys(_)) {
|
|
37
42
|
if (["scope", "type", "breaking", "release"].includes(key)) {
|
|
38
43
|
if (_[key] !== undefined) clone[key] = _[key]
|
|
@@ -41,9 +46,9 @@ let releaseRules = types.filter(_ => _.release !== undefined).map(_ => {
|
|
|
41
46
|
return clone
|
|
42
47
|
})
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
const presetConfig_types = types.filter(_ => _.section !== undefined).map(_ => ({ type: _.type, section: _.section, hidden: _.hidden }))
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
export default{
|
|
47
52
|
__types: types,
|
|
48
53
|
plugins: [
|
|
49
54
|
[ "@semantic-release/commit-analyzer", {
|
|
@@ -72,6 +77,18 @@ module.exports = {
|
|
|
72
77
|
let title_compare = types_a_index - types_b_index
|
|
73
78
|
return title_compare
|
|
74
79
|
},
|
|
80
|
+
...(showCommitBody ? {
|
|
81
|
+
commitPartial,
|
|
82
|
+
finalizeContext: (context) => {
|
|
83
|
+
for (const commitGroup of context.commitGroups) {
|
|
84
|
+
for (const commit of commitGroup.commits) {
|
|
85
|
+
if (commit.body?.includes("<!--skip-release-notes-->")) continue
|
|
86
|
+
commit.commitBody = commit.body//?.split('\n')
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return context
|
|
90
|
+
}
|
|
91
|
+
} :{}),
|
|
75
92
|
},
|
|
76
93
|
presetConfig: {
|
|
77
94
|
types: presetConfig_types
|