-
Notifications
You must be signed in to change notification settings - Fork 1
/
release.config.js
87 lines (82 loc) · 1.98 KB
/
release.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
const fs = require("fs");
const czrc = JSON.parse(fs.readFileSync("./.czrc", "utf8"));
const generateTypes = () =>
czrc.config["cz-emoji"].types.map(t => {
const opts = {
type: t.name.toLowerCase(),
hidden: !t.changelog || !t.changelog.section ? true : false,
};
if (t.changelog && t.changelog.section) {
opts.section = t.changelog.section;
}
return opts;
});
const generateReleaseRules = () =>
czrc.config["cz-emoji"].types
.map(t => {
if (!t.release) {
return false;
}
if (typeof t.release === "string") {
return {
type: t.name,
release: t.release,
};
}
// lots of options
let opts = {};
opts.type = t.name;
if (t.release.scope) {
opts.scope = t.release.scope;
opts.release = t.release.release;
}
return opts;
})
.filter(Boolean);
const ccOptions = {
releaseRules: generateReleaseRules(),
parserOpts: {
headerPattern: /^.+?\s+(\w+)(?:\((.+)\))?!?: (.+)$/, // emoji friendly
headerCorrespondence: ["type", "scope", "subject"],
},
linkReferences: true,
presetConfig: {
header: "Changelog",
types: generateTypes(),
releaseCommitMessageFormat:
"🧹 Chore: Adds changelog for {{currentTag}} [skip ci]",
},
};
module.exports = {
plugins: [
[
"@semantic-release/commit-analyzer",
{
preset: "conventionalcommits",
...ccOptions,
},
],
[
"@semantic-release/release-notes-generator",
{
preset: "conventionalcommits",
...ccOptions,
},
],
[
"@semantic-release/changelog",
{
changelogFile: "CHANGELOG.md",
},
],
"@semantic-release/npm",
[
"@semantic-release/git",
{
assets: ["package.json", "dist/**/*", "examples/**/*", "CHANGELOG.md"],
message:
"🧹 Chore: Releases ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
},
],
],
};