@taiga-ui/auto-changelog-config 0.490.0 → 0.492.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/package.json +1 -1
- package/release-template.hbs +29 -0
- package/setup.js +78 -19
- package/template.hbs +12 -16
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{{! prettier-ignore }}
|
|
2
|
+
{{#each releases}}
|
|
3
|
+
{{#if tag}}
|
|
4
|
+
##{{#unless major}}#{{/unless}} [{{#replaceTitle}}{{title}}{{/replaceTitle}}]({{href}}) ({{isoDate}})
|
|
5
|
+
{{/if}}
|
|
6
|
+
|
|
7
|
+
{{#commit-parser merges commits}}
|
|
8
|
+
|
|
9
|
+
{{#commit-list this heading='### ⚠️ BREAKING CHANGES' message='^(feat|fix|perf)(\([^)]*\))!:' }}
|
|
10
|
+
- {{#replaceCommit}}{{subject}}{{/replaceCommit}}{{#if pullRequest}} ([#{{pullRequest.id}}]({{pullRequest.href}})){{/if}} [({{shorthash}})]({{href}})
|
|
11
|
+
{{/commit-list}}
|
|
12
|
+
|
|
13
|
+
{{#commit-list this heading='### 🚀 Features' message='^feat:|^feat\(' exclude='^(feat|fix|perf)(\([^)]*\))!:'}}
|
|
14
|
+
- {{#replaceCommit}}{{subject}}{{/replaceCommit}}{{#if pullRequest}} ([#{{pullRequest.id}}]({{pullRequest.href}})){{/if}} [({{shorthash}})]({{href}})
|
|
15
|
+
{{/commit-list}}
|
|
16
|
+
|
|
17
|
+
{{#commit-list this heading='### 🐞 Bug Fixes' message='^fix:|^fix\(' exclude='^(feat|fix|perf)(\([^)]*\))!:'}}
|
|
18
|
+
- {{#replaceCommit}}{{subject}}{{/replaceCommit}}{{#if pullRequest}} ([#{{pullRequest.id}}]({{pullRequest.href}})){{/if}} [({{shorthash}})]({{href}})
|
|
19
|
+
{{/commit-list}}
|
|
20
|
+
|
|
21
|
+
{{/commit-parser}}
|
|
22
|
+
|
|
23
|
+
{{#contributors commits merges}}
|
|
24
|
+
### Contributors
|
|
25
|
+
|
|
26
|
+
{{text}}
|
|
27
|
+
{{/contributors}}
|
|
28
|
+
|
|
29
|
+
{{/each}}
|
package/setup.js
CHANGED
|
@@ -1,34 +1,93 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-invalid-this */
|
|
2
|
-
module.exports = function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
module.exports = function (Handlebars) {
|
|
3
|
+
const getCommitAuthor = (commit) =>
|
|
4
|
+
commit.pullRequest?.author?.login ??
|
|
5
|
+
commit.pullRequest?.author ??
|
|
6
|
+
commit.author ??
|
|
7
|
+
'';
|
|
8
|
+
|
|
9
|
+
const normalizeContributor = (author) => {
|
|
10
|
+
const name = String(author).trim().replace(/^@/, '') ?? '';
|
|
11
|
+
|
|
12
|
+
const isBot =
|
|
13
|
+
name.endsWith('bot') ||
|
|
14
|
+
name.endsWith('[bot]') ||
|
|
15
|
+
name === 'github-actions' ||
|
|
16
|
+
name === 'renovate';
|
|
17
|
+
|
|
18
|
+
if (!name || isBot) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return `@${name}`;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const formatContributors = (contributors) => {
|
|
26
|
+
if (contributors.length === 1) {
|
|
27
|
+
return contributors[0];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (contributors.length === 2) {
|
|
31
|
+
return `${contributors[0]} and ${contributors[1]}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return `${contributors.slice(0, -1).join(', ')} and ${
|
|
35
|
+
contributors[contributors.length - 1]
|
|
36
|
+
}`;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
Handlebars.registerHelper('commit-parser', function (...args) {
|
|
40
|
+
const options = args.pop();
|
|
41
|
+
|
|
42
|
+
const commits = args.flat().filter(Boolean);
|
|
43
|
+
|
|
44
|
+
const unique = [
|
|
45
|
+
...new Map(
|
|
46
|
+
commits.map((commit) => [
|
|
47
|
+
commit.hash ?? commit.shorthash ?? commit.href ?? commit.subject,
|
|
48
|
+
commit,
|
|
49
|
+
]),
|
|
50
|
+
).values(),
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
return options.fn(unique);
|
|
54
|
+
});
|
|
55
|
+
|
|
6
56
|
Handlebars.registerHelper('replaceCommit', function (context) {
|
|
7
57
|
const commit =
|
|
8
|
-
/^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)\s?(
|
|
58
|
+
/^(?:build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)\s?(?:\((?<scope>[^)]*)\))?!?: (?<title>.*)$/;
|
|
9
59
|
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const [, , , scope = '', title = ''] = parsed;
|
|
14
|
-
const result = scope ? `**${scope.toLocaleLowerCase()}**: ${title}` : title;
|
|
60
|
+
const string = String(context.fn(this));
|
|
61
|
+
const {scope = '', title = ''} = commit.exec(string)?.groups ?? {};
|
|
62
|
+
const result = scope ? `**${scope.toLowerCase()}**: ${title}` : title;
|
|
15
63
|
|
|
16
64
|
return result || 'empty commit name';
|
|
17
65
|
});
|
|
18
66
|
|
|
19
67
|
Handlebars.registerHelper('replaceTitle', function (context) {
|
|
20
|
-
|
|
21
|
-
const string = context.fn(this);
|
|
68
|
+
const string = String(context.fn(this));
|
|
22
69
|
|
|
23
|
-
return string.replace(
|
|
70
|
+
return string.replace(/^v/, '');
|
|
24
71
|
});
|
|
25
72
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
73
|
+
Handlebars.registerHelper('contributors', function (...args) {
|
|
74
|
+
const options = args.pop();
|
|
75
|
+
|
|
76
|
+
const commits = args.flat().filter(Boolean);
|
|
77
|
+
|
|
78
|
+
const contributors = [
|
|
79
|
+
...new Set(
|
|
80
|
+
commits.map(getCommitAuthor).map(normalizeContributor).filter(Boolean),
|
|
81
|
+
),
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
if (!contributors.length) {
|
|
85
|
+
return '';
|
|
86
|
+
}
|
|
31
87
|
|
|
32
|
-
return options.fn(
|
|
88
|
+
return options.fn({
|
|
89
|
+
contributors,
|
|
90
|
+
text: `Thanks ${formatContributors(contributors)}!`,
|
|
91
|
+
});
|
|
33
92
|
});
|
|
34
93
|
};
|
package/template.hbs
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
{{! prettier-ignore }}
|
|
2
2
|
{{#each releases}}
|
|
3
3
|
{{#if tag}}
|
|
4
|
-
|
|
4
|
+
##{{#unless major}}#{{/unless}} [{{#replaceTitle}}{{title}}{{/replaceTitle}}]({{href}}) ({{isoDate}})
|
|
5
5
|
{{/if}}
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
{{#commit-parser merges commits}}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
{{#commit-list this heading='### ⚠️ BREAKING CHANGES' message='^(feat|fix|perf)(\([^)]*\))!:' }}
|
|
10
|
+
- {{#replaceCommit}}{{subject}}{{/replaceCommit}}{{#if pullRequest}} ([#{{pullRequest.id}}]({{pullRequest.href}})){{/if}} [({{shorthash}})]({{href}})
|
|
11
|
+
{{/commit-list}}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
{{#commit-list this heading='### 🚀 Features' message='^feat:|^feat\(' exclude='^(feat|fix|perf)(\([^)]*\))!:'}}
|
|
14
|
+
- {{#replaceCommit}}{{subject}}{{/replaceCommit}}{{#if pullRequest}} ([#{{pullRequest.id}}]({{pullRequest.href}})){{/if}} [({{shorthash}})]({{href}})
|
|
15
|
+
{{/commit-list}}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
{{#commit-list this heading='### 🐞 Bug Fixes' message='^fix:|^fix\(' exclude='^(feat|fix|perf)(\([^)]*\))!:'}}
|
|
18
|
+
- {{#replaceCommit}}{{subject}}{{/replaceCommit}}{{#if pullRequest}} ([#{{pullRequest.id}}]({{pullRequest.href}})){{/if}} [({{shorthash}})]({{href}})
|
|
19
|
+
{{/commit-list}}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
- {{#replaceCommit}}{{subject}}{{/replaceCommit}} [({{shorthash}})]({{href}})
|
|
23
|
-
{{/commit-list}}
|
|
24
|
-
|
|
25
|
-
{{/commit-parser}}
|
|
21
|
+
{{/commit-parser}}
|
|
26
22
|
|
|
27
23
|
{{/each}}
|