@w5s/conventional-changelog 1.0.7 → 1.0.9
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/writer-opts.d.ts +2 -0
- package/lib/writer-opts.js +6 -2
- package/package.json +4 -4
- package/src/data.ts +19 -1
- 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/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.9",
|
|
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",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/conventional-changelog-writer": "4.0.2",
|
|
56
56
|
"@types/conventional-commits-parser": "3.0.3",
|
|
57
|
-
"vite": "4.
|
|
58
|
-
"vitest": "0.
|
|
57
|
+
"vite": "4.3.5",
|
|
58
|
+
"vitest": "0.31.0"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=16.0.0"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "9f31748b4b649e8fdcd479141b0d65321d9d4556"
|
|
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/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'],
|