@w5s/conventional-changelog 1.0.8 → 1.0.10
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/lib/data.d.ts +2 -0
- package/lib/data.js +17 -1
- package/lib/gitmoji.js +4 -4
- package/lib/parser-opts.js +7 -2
- package/lib/writer-opts.d.ts +2 -0
- package/lib/writer-opts.js +6 -2
- package/package.json +2 -2
- package/src/data.ts +19 -1
- package/src/gitmoji.ts +4 -4
- package/src/parser-opts.ts +9 -2
- package/src/writer-opts.ts +6 -1
package/lib/data.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const CommitConventionalType: {
|
|
|
8
8
|
getData: (commitType: CommitConventionalType) => CommitConventionalTypeData;
|
|
9
9
|
values: () => readonly CommitConventionalType[];
|
|
10
10
|
parse: (anyValue: string) => CommitConventionalType | undefined;
|
|
11
|
+
findWhere: (predicate: (data: CommitConventionalTypeData) => boolean) => CommitConventionalType[];
|
|
11
12
|
Build: "build";
|
|
12
13
|
CI: "ci";
|
|
13
14
|
Docs: "docs";
|
|
@@ -24,4 +25,5 @@ export declare const CommitConventionalType: {
|
|
|
24
25
|
export interface CommitConventionalTypeData {
|
|
25
26
|
emoji: string;
|
|
26
27
|
'en-US': string;
|
|
28
|
+
changelog: boolean;
|
|
27
29
|
}
|
package/lib/data.js
CHANGED
|
@@ -22,50 +22,62 @@ exports.CommitConventionalType = (() => {
|
|
|
22
22
|
feat: {
|
|
23
23
|
emoji: '✨',
|
|
24
24
|
'en-US': 'Features',
|
|
25
|
+
changelog: true,
|
|
25
26
|
},
|
|
26
27
|
fix: {
|
|
27
28
|
emoji: '🐛',
|
|
28
29
|
'en-US': 'Bug Fixes',
|
|
30
|
+
changelog: true,
|
|
29
31
|
},
|
|
30
32
|
build: {
|
|
31
33
|
emoji: '👷',
|
|
32
34
|
'en-US': 'Build System',
|
|
35
|
+
changelog: false,
|
|
33
36
|
},
|
|
34
37
|
chore: {
|
|
35
38
|
emoji: '🎫',
|
|
36
39
|
'en-US': 'Chores',
|
|
40
|
+
changelog: false,
|
|
37
41
|
},
|
|
38
42
|
ci: {
|
|
39
43
|
emoji: '🔧',
|
|
40
44
|
'en-US': 'Continuous Integration',
|
|
45
|
+
changelog: false,
|
|
41
46
|
},
|
|
42
47
|
docs: {
|
|
43
48
|
emoji: '📝',
|
|
44
49
|
'en-US': 'Documentation',
|
|
50
|
+
changelog: false,
|
|
45
51
|
},
|
|
46
52
|
test: {
|
|
47
53
|
emoji: '✅',
|
|
48
54
|
'en-US': 'Tests',
|
|
55
|
+
changelog: false,
|
|
49
56
|
},
|
|
50
57
|
perf: {
|
|
51
58
|
emoji: '⚡',
|
|
52
59
|
'en-US': 'Performance Improvements',
|
|
60
|
+
changelog: true,
|
|
53
61
|
},
|
|
54
62
|
refactor: {
|
|
55
63
|
emoji: '♻',
|
|
56
64
|
'en-US': 'Code Refactoring',
|
|
65
|
+
changelog: false,
|
|
57
66
|
},
|
|
58
67
|
revert: {
|
|
59
68
|
emoji: '⏪',
|
|
60
69
|
'en-US': 'Reverts',
|
|
70
|
+
changelog: true,
|
|
61
71
|
},
|
|
62
72
|
style: {
|
|
63
73
|
emoji: '💄',
|
|
64
74
|
'en-US': 'Styles',
|
|
75
|
+
changelog: false,
|
|
65
76
|
},
|
|
66
77
|
wip: {
|
|
67
78
|
emoji: '🚧',
|
|
68
79
|
'en-US': 'Work in progress',
|
|
80
|
+
changelog: false,
|
|
69
81
|
},
|
|
70
82
|
};
|
|
71
83
|
function hasInstance(anyValue) {
|
|
@@ -80,5 +92,9 @@ exports.CommitConventionalType = (() => {
|
|
|
80
92
|
function values() {
|
|
81
93
|
return enumValues;
|
|
82
94
|
}
|
|
83
|
-
|
|
95
|
+
function findWhere(predicate) {
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
97
|
+
return enumValues.filter((enumValue) => predicate(getData(enumValue)));
|
|
98
|
+
}
|
|
99
|
+
return { ...enumObject, hasInstance, getData, values, parse, findWhere };
|
|
84
100
|
})();
|
package/lib/gitmoji.js
CHANGED
|
@@ -9,16 +9,16 @@ const gitmojis_1 = require("gitmojis");
|
|
|
9
9
|
var Emoji;
|
|
10
10
|
(function (Emoji) {
|
|
11
11
|
Emoji.reEmojiUnicode = (0, emoji_regex_1.default)();
|
|
12
|
-
Emoji.reEmojiText =
|
|
13
|
-
const reMatchOnly = (input) => new RegExp(`^${input.source}$`,
|
|
12
|
+
Emoji.reEmojiText = /:\w*:/;
|
|
13
|
+
const reMatchOnly = (input) => new RegExp(`^${input.source}$`, '');
|
|
14
14
|
const _reEmojiUnicode = reMatchOnly(Emoji.reEmojiUnicode);
|
|
15
15
|
const _reEmojiText = reMatchOnly(Emoji.reEmojiText);
|
|
16
16
|
function isUnicode(anyValue) {
|
|
17
|
-
return
|
|
17
|
+
return _reEmojiUnicode.test(anyValue);
|
|
18
18
|
}
|
|
19
19
|
Emoji.isUnicode = isUnicode;
|
|
20
20
|
function isText(anyValue) {
|
|
21
|
-
return
|
|
21
|
+
return _reEmojiText.test(anyValue);
|
|
22
22
|
}
|
|
23
23
|
Emoji.isText = isText;
|
|
24
24
|
function hasInstance(anyValue) {
|
package/lib/parser-opts.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parserOpts = void 0;
|
|
4
|
-
const gitmoji_1 = require("./gitmoji");
|
|
5
4
|
exports.parserOpts = {
|
|
6
|
-
headerPattern: new RegExp(
|
|
5
|
+
headerPattern: new RegExp(
|
|
6
|
+
// Type
|
|
7
|
+
`^(?<type>\\S*)? ` +
|
|
8
|
+
// Scope
|
|
9
|
+
`(?:\\((?<scope>.*)\\):? )?` +
|
|
10
|
+
// Subject
|
|
11
|
+
`(?<subject>.*)$`, 'u'),
|
|
7
12
|
headerCorrespondence: ['type', 'scope', 'subject'],
|
|
8
13
|
revertPattern: /^(?:revert|revert:)\s"?([\S\s]+?)"?\s*this reverts commit (\w*)\./i,
|
|
9
14
|
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],
|
package/lib/writer-opts.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Options } from 'conventional-changelog-writer';
|
|
2
|
+
import { CommitConventionalType } from './data.js';
|
|
2
3
|
export interface WriterOptions extends Options {
|
|
3
4
|
}
|
|
5
|
+
export declare const defaultDisplayTypes: CommitConventionalType[];
|
|
4
6
|
export declare const writerOpts: WriterOptions;
|
package/lib/writer-opts.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writerOpts = void 0;
|
|
3
|
+
exports.writerOpts = exports.defaultDisplayTypes = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const transform_js_1 = require("./transform.js");
|
|
7
|
+
const data_js_1 = require("./data.js");
|
|
7
8
|
const basePath = (0, node_path_1.resolve)((0, node_path_1.dirname)(__dirname), './template');
|
|
8
9
|
const template = (0, node_fs_1.readFileSync)(`${basePath}/template.hbs`, 'utf8');
|
|
9
10
|
const header = (0, node_fs_1.readFileSync)(`${basePath}/header.hbs`, 'utf8');
|
|
10
11
|
const commit = (0, node_fs_1.readFileSync)(`${basePath}/commit.hbs`, 'utf8');
|
|
11
12
|
const footer = (0, node_fs_1.readFileSync)(`${basePath}/footer.hbs`, 'utf8');
|
|
12
13
|
const author = (0, node_fs_1.readFileSync)(`${basePath}/author.hbs`, 'utf8');
|
|
14
|
+
exports.defaultDisplayTypes = data_js_1.CommitConventionalType.findWhere((_) => _.changelog);
|
|
13
15
|
exports.writerOpts = {
|
|
14
|
-
transform: (0, transform_js_1.createTransform)({
|
|
16
|
+
transform: (0, transform_js_1.createTransform)({
|
|
17
|
+
displayTypes: exports.defaultDisplayTypes,
|
|
18
|
+
}),
|
|
15
19
|
groupBy: 'type',
|
|
16
20
|
commitGroupsSort: 'title',
|
|
17
21
|
commitsSort: ['scope', 'subject'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/conventional-changelog",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Conventional changelog plugin for @w5s",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/w5s/project-config/blob/main/packages/conventional-changelog#readme",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "5913801bce7442cfeb53292901eb5ea3479bb878"
|
|
67
67
|
}
|
package/src/data.ts
CHANGED
|
@@ -40,50 +40,62 @@ export const CommitConventionalType = (() => {
|
|
|
40
40
|
feat: {
|
|
41
41
|
emoji: '✨',
|
|
42
42
|
'en-US': 'Features',
|
|
43
|
+
changelog: true,
|
|
43
44
|
},
|
|
44
45
|
fix: {
|
|
45
46
|
emoji: '🐛',
|
|
46
47
|
'en-US': 'Bug Fixes',
|
|
48
|
+
changelog: true,
|
|
47
49
|
},
|
|
48
50
|
build: {
|
|
49
51
|
emoji: '👷',
|
|
50
52
|
'en-US': 'Build System',
|
|
53
|
+
changelog: false,
|
|
51
54
|
},
|
|
52
55
|
chore: {
|
|
53
56
|
emoji: '🎫',
|
|
54
57
|
'en-US': 'Chores',
|
|
58
|
+
changelog: false,
|
|
55
59
|
},
|
|
56
60
|
ci: {
|
|
57
61
|
emoji: '🔧',
|
|
58
62
|
'en-US': 'Continuous Integration',
|
|
63
|
+
changelog: false,
|
|
59
64
|
},
|
|
60
65
|
docs: {
|
|
61
66
|
emoji: '📝',
|
|
62
67
|
'en-US': 'Documentation',
|
|
68
|
+
changelog: false,
|
|
63
69
|
},
|
|
64
70
|
test: {
|
|
65
71
|
emoji: '✅',
|
|
66
72
|
'en-US': 'Tests',
|
|
73
|
+
changelog: false,
|
|
67
74
|
},
|
|
68
75
|
perf: {
|
|
69
76
|
emoji: '⚡',
|
|
70
77
|
'en-US': 'Performance Improvements',
|
|
78
|
+
changelog: true,
|
|
71
79
|
},
|
|
72
80
|
refactor: {
|
|
73
81
|
emoji: '♻',
|
|
74
82
|
'en-US': 'Code Refactoring',
|
|
83
|
+
changelog: false,
|
|
75
84
|
},
|
|
76
85
|
revert: {
|
|
77
86
|
emoji: '⏪',
|
|
78
87
|
'en-US': 'Reverts',
|
|
88
|
+
changelog: true,
|
|
79
89
|
},
|
|
80
90
|
style: {
|
|
81
91
|
emoji: '💄',
|
|
82
92
|
'en-US': 'Styles',
|
|
93
|
+
changelog: false,
|
|
83
94
|
},
|
|
84
95
|
wip: {
|
|
85
96
|
emoji: '🚧',
|
|
86
97
|
'en-US': 'Work in progress',
|
|
98
|
+
changelog: false,
|
|
87
99
|
},
|
|
88
100
|
};
|
|
89
101
|
|
|
@@ -103,10 +115,16 @@ export const CommitConventionalType = (() => {
|
|
|
103
115
|
return enumValues;
|
|
104
116
|
}
|
|
105
117
|
|
|
106
|
-
|
|
118
|
+
function findWhere(predicate: (data: CommitConventionalTypeData) => boolean): CommitConventionalType[] {
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
120
|
+
return enumValues.filter((enumValue) => predicate(getData(enumValue)!));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return { ...enumObject, hasInstance, getData, values, parse, findWhere };
|
|
107
124
|
})();
|
|
108
125
|
|
|
109
126
|
export interface CommitConventionalTypeData {
|
|
110
127
|
emoji: string;
|
|
111
128
|
'en-US': string;
|
|
129
|
+
changelog: boolean;
|
|
112
130
|
}
|
package/src/gitmoji.ts
CHANGED
|
@@ -6,9 +6,9 @@ export type Emoji = Emoji.Unicode | Emoji.Text;
|
|
|
6
6
|
export namespace Emoji {
|
|
7
7
|
export const reEmojiUnicode = emojiRegexp();
|
|
8
8
|
|
|
9
|
-
export const reEmojiText =
|
|
9
|
+
export const reEmojiText = /:\w*:/;
|
|
10
10
|
|
|
11
|
-
const reMatchOnly = (input: RegExp) => new RegExp(`^${input.source}$`,
|
|
11
|
+
const reMatchOnly = (input: RegExp) => new RegExp(`^${input.source}$`, '');
|
|
12
12
|
const _reEmojiUnicode = reMatchOnly(reEmojiUnicode);
|
|
13
13
|
const _reEmojiText = reMatchOnly(reEmojiText);
|
|
14
14
|
|
|
@@ -16,11 +16,11 @@ export namespace Emoji {
|
|
|
16
16
|
export type Text = string & { '@@EmojiStyle': 'text' };
|
|
17
17
|
|
|
18
18
|
export function isUnicode(anyValue: string): anyValue is Unicode {
|
|
19
|
-
return
|
|
19
|
+
return _reEmojiUnicode.test(anyValue);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function isText(anyValue: string): anyValue is Text {
|
|
23
|
-
return
|
|
23
|
+
return _reEmojiText.test(anyValue);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function hasInstance(anyValue: string): anyValue is Emoji {
|
package/src/parser-opts.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { Options } from 'conventional-commits-parser';
|
|
2
|
-
import { Emoji } from './gitmoji';
|
|
3
2
|
|
|
4
3
|
export interface ParserOptions extends Options {}
|
|
5
4
|
|
|
6
5
|
export const parserOpts: ParserOptions = {
|
|
7
|
-
headerPattern: new RegExp(
|
|
6
|
+
headerPattern: new RegExp(
|
|
7
|
+
// Type
|
|
8
|
+
`^(?<type>\\S*)? ` +
|
|
9
|
+
// Scope
|
|
10
|
+
`(?:\\((?<scope>.*)\\):? )?` +
|
|
11
|
+
// Subject
|
|
12
|
+
`(?<subject>.*)$`,
|
|
13
|
+
'u'
|
|
14
|
+
),
|
|
8
15
|
headerCorrespondence: ['type', 'scope', 'subject'],
|
|
9
16
|
revertPattern: /^(?:revert|revert:)\s"?([\S\s]+?)"?\s*this reverts commit (\w*)\./i,
|
|
10
17
|
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],
|
package/src/writer-opts.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Options } from 'conventional-changelog-writer';
|
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { resolve, dirname } from 'node:path';
|
|
4
4
|
import { createTransform } from './transform.js';
|
|
5
|
+
import { CommitConventionalType } from './data.js';
|
|
5
6
|
|
|
6
7
|
export interface WriterOptions extends Options {}
|
|
7
8
|
|
|
@@ -13,8 +14,12 @@ const commit = readFileSync(`${basePath}/commit.hbs`, 'utf8');
|
|
|
13
14
|
const footer = readFileSync(`${basePath}/footer.hbs`, 'utf8');
|
|
14
15
|
const author = readFileSync(`${basePath}/author.hbs`, 'utf8');
|
|
15
16
|
|
|
17
|
+
export const defaultDisplayTypes = CommitConventionalType.findWhere((_) => _.changelog);
|
|
18
|
+
|
|
16
19
|
export const writerOpts: WriterOptions = {
|
|
17
|
-
transform: createTransform({
|
|
20
|
+
transform: createTransform({
|
|
21
|
+
displayTypes: defaultDisplayTypes,
|
|
22
|
+
}),
|
|
18
23
|
groupBy: 'type',
|
|
19
24
|
commitGroupsSort: 'title',
|
|
20
25
|
commitsSort: ['scope', 'subject'],
|