@w5s/commitlint-config 1.0.3 → 1.0.5
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 +8 -8
- package/lib/conventional-changelog/data.d.ts +28 -0
- package/lib/conventional-changelog/data.d.ts.map +1 -0
- package/lib/conventional-changelog/data.js +85 -0
- package/lib/conventional-changelog/data.js.map +1 -0
- package/lib/conventional-changelog/gitmoji.d.ts +13 -0
- package/lib/conventional-changelog/gitmoji.d.ts.map +1 -0
- package/lib/conventional-changelog/gitmoji.js +63 -0
- package/lib/conventional-changelog/gitmoji.js.map +1 -0
- package/lib/conventional-changelog/index.d.ts +5 -0
- package/lib/conventional-changelog/index.d.ts.map +1 -0
- package/lib/conventional-changelog/index.js +10 -0
- package/lib/conventional-changelog/index.js.map +1 -0
- package/lib/conventional-changelog/parser-opts.d.ts +4 -0
- package/lib/conventional-changelog/parser-opts.d.ts.map +1 -0
- package/lib/conventional-changelog/parser-opts.js +13 -0
- package/lib/conventional-changelog/parser-opts.js.map +1 -0
- package/lib/conventional-changelog/transform.d.ts +21 -0
- package/lib/conventional-changelog/transform.d.ts.map +1 -0
- package/lib/conventional-changelog/transform.js +91 -0
- package/lib/conventional-changelog/transform.js.map +1 -0
- package/lib/conventional-changelog/writer-opts.d.ts +4 -0
- package/lib/conventional-changelog/writer-opts.d.ts.map +1 -0
- package/lib/conventional-changelog/writer-opts.js +24 -0
- package/lib/conventional-changelog/writer-opts.js.map +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +14 -14
- package/lib/index.js.map +1 -1
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +10 -18
- package/lib/plugin.js.map +1 -1
- package/package.json +13 -4
- package/src/conventional-changelog/data.ts +113 -0
- package/src/conventional-changelog/gitmoji.ts +74 -0
- package/src/conventional-changelog/index.ts +5 -0
- package/src/conventional-changelog/parser-opts.ts +12 -0
- package/src/conventional-changelog/transform.ts +122 -0
- package/src/conventional-changelog/writer-opts.ts +26 -0
- package/src/index.ts +3 -6
- package/src/plugin.ts +5 -4
- package/lib/gitmoji.d.ts +0 -14
- package/lib/gitmoji.d.ts.map +0 -1
- package/lib/gitmoji.js +0 -27
- package/lib/gitmoji.js.map +0 -1
- package/src/gitmoji.ts +0 -27
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
1
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=# W5s Commitlint configuration _(${name})_) -->
|
|
2
2
|
# W5s Commitlint configuration _(@w5s/commitlint-config)_
|
|
3
3
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
4
4
|
|
|
5
5
|
[![NPM Version][package-version-svg]][package-url]
|
|
6
6
|
[![License][license-image]][license-url]
|
|
7
7
|
|
|
8
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
8
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=> ${description}&unknownTxt= ) -->
|
|
9
9
|
> Commitlint configuration presets
|
|
10
10
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
14
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=```console\nnpm install --save-dev ${name} @commitlint/cli\n```) -->
|
|
15
15
|
```console
|
|
16
16
|
npm install --save-dev @w5s/commitlint-config @commitlint/cli
|
|
17
17
|
```
|
|
@@ -21,7 +21,7 @@ npm install --save-dev @w5s/commitlint-config @commitlint/cli
|
|
|
21
21
|
|
|
22
22
|
In the `package.json` of your project
|
|
23
23
|
|
|
24
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
24
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=```json\n{\n "commitlint": {\n "extends": ["${name}"]\n }\n}\n```) -->
|
|
25
25
|
```json
|
|
26
26
|
{
|
|
27
27
|
"commitlint": {
|
|
@@ -55,19 +55,19 @@ npm exec --no -- commitlint --edit $1
|
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
## License
|
|
58
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
58
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[${license}][license-url] © ${author}) -->
|
|
59
59
|
[MIT][license-url] © Julien Polo <julien.polo@gmail.com>
|
|
60
60
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
61
61
|
|
|
62
62
|
<!-- VARIABLES -->
|
|
63
63
|
|
|
64
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
64
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square) -->
|
|
65
65
|
[package-version-svg]: https://img.shields.io/npm/v/@w5s/commitlint-config.svg?style=flat-square
|
|
66
66
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
67
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
67
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}) -->
|
|
68
68
|
[package-url]: https://www.npmjs.com/package/@w5s/commitlint-config
|
|
69
69
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
70
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
70
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square) -->
|
|
71
71
|
[license-image]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square
|
|
72
72
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
73
73
|
[license-url]: ../../LICENSE
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Commit as CommitDefault } from 'conventional-commits-parser';
|
|
2
|
+
export type Commit = CommitDefault<never> & {
|
|
3
|
+
hash?: string;
|
|
4
|
+
};
|
|
5
|
+
export type CommitConventionalType = 'build' | 'ci' | 'docs' | 'feat' | 'fix' | 'perf' | 'refactor' | 'revert' | 'style' | 'test' | 'wip' | 'chore';
|
|
6
|
+
export declare const CommitConventionalType: {
|
|
7
|
+
hasInstance: (anyValue: unknown) => anyValue is CommitConventionalType;
|
|
8
|
+
getData: (commitType: CommitConventionalType) => CommitConventionalTypeData;
|
|
9
|
+
values: () => readonly CommitConventionalType[];
|
|
10
|
+
parse: (anyValue: string) => CommitConventionalType | undefined;
|
|
11
|
+
Build: "build";
|
|
12
|
+
CI: "ci";
|
|
13
|
+
Docs: "docs";
|
|
14
|
+
Feat: "feat";
|
|
15
|
+
Fix: "fix";
|
|
16
|
+
Perf: "perf";
|
|
17
|
+
Refactor: "refactor";
|
|
18
|
+
Revert: "revert";
|
|
19
|
+
Style: "style";
|
|
20
|
+
Test: "test";
|
|
21
|
+
WIP: "wip";
|
|
22
|
+
Chore: "chore";
|
|
23
|
+
};
|
|
24
|
+
export interface CommitConventionalTypeData {
|
|
25
|
+
emoji: string;
|
|
26
|
+
'en-US': string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/conventional-changelog/data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE3E,MAAM,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAC9B,OAAO,GACP,IAAI,GACJ,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,GACN,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,GACN,KAAK,GACL,OAAO,CAAC;AAEZ,eAAO,MAAM,sBAAsB;4BAqEF,OAAO;0BAIT,sBAAsB,KAAG,0BAA0B;;sBAIvD,MAAM,KAAG,sBAAsB,GAAG,SAAS;;;;;;;;;;;;;CASlE,CAAC;AAEL,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommitConventionalType = void 0;
|
|
4
|
+
exports.CommitConventionalType = (() => {
|
|
5
|
+
const enumObject = Object.freeze({
|
|
6
|
+
Build: 'build',
|
|
7
|
+
CI: 'ci',
|
|
8
|
+
Docs: 'docs',
|
|
9
|
+
Feat: 'feat',
|
|
10
|
+
Fix: 'fix',
|
|
11
|
+
Perf: 'perf',
|
|
12
|
+
Refactor: 'refactor',
|
|
13
|
+
Revert: 'revert',
|
|
14
|
+
Style: 'style',
|
|
15
|
+
Test: 'test',
|
|
16
|
+
WIP: 'wip',
|
|
17
|
+
Chore: 'chore',
|
|
18
|
+
});
|
|
19
|
+
const enumValues = Object.freeze(Object.values(enumObject).sort());
|
|
20
|
+
const enumValuesSet = new Set(enumValues);
|
|
21
|
+
const typeData = {
|
|
22
|
+
feat: {
|
|
23
|
+
emoji: '✨',
|
|
24
|
+
'en-US': 'Features',
|
|
25
|
+
},
|
|
26
|
+
fix: {
|
|
27
|
+
emoji: '🐛',
|
|
28
|
+
'en-US': 'Bug Fixes',
|
|
29
|
+
},
|
|
30
|
+
build: {
|
|
31
|
+
emoji: '👷',
|
|
32
|
+
'en-US': 'Build System',
|
|
33
|
+
},
|
|
34
|
+
chore: {
|
|
35
|
+
emoji: '🎫',
|
|
36
|
+
'en-US': 'Chores',
|
|
37
|
+
},
|
|
38
|
+
ci: {
|
|
39
|
+
emoji: '🔧',
|
|
40
|
+
'en-US': 'Continuous Integration',
|
|
41
|
+
},
|
|
42
|
+
docs: {
|
|
43
|
+
emoji: '📝',
|
|
44
|
+
'en-US': 'Documentation',
|
|
45
|
+
},
|
|
46
|
+
test: {
|
|
47
|
+
emoji: '✅',
|
|
48
|
+
'en-US': 'Tests',
|
|
49
|
+
},
|
|
50
|
+
perf: {
|
|
51
|
+
emoji: '⚡',
|
|
52
|
+
'en-US': 'Performance Improvements',
|
|
53
|
+
},
|
|
54
|
+
refactor: {
|
|
55
|
+
emoji: '♻',
|
|
56
|
+
'en-US': 'Code Refactoring',
|
|
57
|
+
},
|
|
58
|
+
revert: {
|
|
59
|
+
emoji: '⏪',
|
|
60
|
+
'en-US': 'Reverts',
|
|
61
|
+
},
|
|
62
|
+
style: {
|
|
63
|
+
emoji: '💄',
|
|
64
|
+
'en-US': 'Styles',
|
|
65
|
+
},
|
|
66
|
+
wip: {
|
|
67
|
+
emoji: '🚧',
|
|
68
|
+
'en-US': 'Work in progress',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
function hasInstance(anyValue) {
|
|
72
|
+
return typeof anyValue === 'string' && enumValuesSet.has(anyValue);
|
|
73
|
+
}
|
|
74
|
+
function getData(commitType) {
|
|
75
|
+
return typeData[commitType];
|
|
76
|
+
}
|
|
77
|
+
function parse(anyValue) {
|
|
78
|
+
return hasInstance(anyValue) ? anyValue : undefined;
|
|
79
|
+
}
|
|
80
|
+
function values() {
|
|
81
|
+
return enumValues;
|
|
82
|
+
}
|
|
83
|
+
return { ...enumObject, hasInstance, getData, values, parse };
|
|
84
|
+
})();
|
|
85
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/conventional-changelog/data.ts"],"names":[],"mappings":";;;AAqBa,QAAA,sBAAsB,GAAG,CAAC,GAAG,EAAE;IAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,KAAK,EAAE,OAAO;QACd,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;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O,EAAE,kBAAkB;SAC5B;KACF,CAAC;IAEF,SAAS,WAAW,CAAC,QAAiB;QACpC,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,QAA6C,CAAC,CAAC;IAC1G,CAAC;IAED,SAAS,OAAO,CAAC,UAAkC;QACjD,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS,KAAK,CAAC,QAAgB;QAC7B,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,CAAC;IAED,SAAS,MAAM;QACb,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,EAAE,GAAG,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAChE,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GitmojiUnicode, GitmojiEmoji } from 'gitmojis';
|
|
2
|
+
import type { CommitConventionalType } from './data';
|
|
3
|
+
export type GitmojiCode = GitmojiCode.Unicode | GitmojiCode.Emoji;
|
|
4
|
+
export declare namespace GitmojiCode {
|
|
5
|
+
type Unicode = GitmojiUnicode;
|
|
6
|
+
type Emoji = GitmojiEmoji;
|
|
7
|
+
const reEmoji: RegExp;
|
|
8
|
+
function isUnicode(anyValue: string): anyValue is Unicode;
|
|
9
|
+
function isEmoji(anyValue: string): anyValue is Emoji;
|
|
10
|
+
function isValid(anyValue: string): anyValue is GitmojiCode;
|
|
11
|
+
function toConventionalCommitType(gitmoji: GitmojiCode): CommitConventionalType;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=gitmoji.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitmoji.d.ts","sourceRoot":"","sources":["../../src/conventional-changelog/gitmoji.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC;AAClE,yBAAiB,WAAW,CAAC;IAC3B,KAAY,OAAO,GAAG,cAAc,CAAC;IACrC,KAAY,KAAK,GAAG,YAAY,CAAC;IAE1B,MAAM,OAAO,QAAgB,CAAC;IAerC,SAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,OAAO,CAE/D;IAED,SAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,KAAK,CAE3D;IAED,SAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,WAAW,CAEjE;IAmCD,SAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,sBAAsB,CAErF;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GitmojiCode = void 0;
|
|
7
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
8
|
+
const emoji_regex_1 = __importDefault(require("emoji-regex"));
|
|
9
|
+
const gitmojis_1 = require("gitmojis");
|
|
10
|
+
var GitmojiCode;
|
|
11
|
+
(function (GitmojiCode) {
|
|
12
|
+
GitmojiCode.reEmoji = (0, emoji_regex_1.default)();
|
|
13
|
+
const reGitmoji = new RegExp(`^${GitmojiCode.reEmoji.source}$`, GitmojiCode.reEmoji.flags);
|
|
14
|
+
const allGitmojiCodes = new Set(gitmojis_1.gitmojis.map((gitmoji) => gitmoji.code).concat(gitmojis_1.gitmojis.map((gitmoji) => gitmoji.emoji)));
|
|
15
|
+
const index = {
|
|
16
|
+
// code: createIndex(gitmojis, 'code'),
|
|
17
|
+
emoji: createIndex(gitmojis_1.gitmojis, 'emoji'),
|
|
18
|
+
};
|
|
19
|
+
function createIndex(list, key) {
|
|
20
|
+
return new Map(list.map((gitmoji) => [gitmoji[key], gitmoji]));
|
|
21
|
+
}
|
|
22
|
+
function isUnicode(anyValue) {
|
|
23
|
+
return anyValue.match(reGitmoji) != null;
|
|
24
|
+
}
|
|
25
|
+
GitmojiCode.isUnicode = isUnicode;
|
|
26
|
+
function isEmoji(anyValue) {
|
|
27
|
+
return anyValue.match(/^:(\w+):$/) != null;
|
|
28
|
+
}
|
|
29
|
+
GitmojiCode.isEmoji = isEmoji;
|
|
30
|
+
function isValid(anyValue) {
|
|
31
|
+
return allGitmojiCodes.has(anyValue);
|
|
32
|
+
}
|
|
33
|
+
GitmojiCode.isValid = isValid;
|
|
34
|
+
const defaultType = 'chore';
|
|
35
|
+
const conversionMap = (() => {
|
|
36
|
+
const data = {
|
|
37
|
+
feat: ['✨', '♿️', '🚸'],
|
|
38
|
+
fix: ['🐛'],
|
|
39
|
+
docs: ['📝'],
|
|
40
|
+
style: ['🎨', '🚨'],
|
|
41
|
+
refactor: ['♻️', '🏗️'],
|
|
42
|
+
test: ['✅'],
|
|
43
|
+
perf: ['⚡️'],
|
|
44
|
+
revert: ['⏪️'],
|
|
45
|
+
ci: ['👷', '💚'],
|
|
46
|
+
wip: ['🚧'],
|
|
47
|
+
build: [],
|
|
48
|
+
chore: [],
|
|
49
|
+
};
|
|
50
|
+
const entries = Array.from(
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
Object.entries(data));
|
|
53
|
+
return new Map(entries.reduce((acc, [commitType, gitmojiUnicodeArray]) => acc
|
|
54
|
+
.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [gitmojiUnicode, commitType]))
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
56
|
+
.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [index.emoji.get(gitmojiUnicode)?.code, commitType])), []));
|
|
57
|
+
})();
|
|
58
|
+
function toConventionalCommitType(gitmoji) {
|
|
59
|
+
return conversionMap.get(gitmoji) ?? defaultType;
|
|
60
|
+
}
|
|
61
|
+
GitmojiCode.toConventionalCommitType = toConventionalCommitType;
|
|
62
|
+
})(GitmojiCode = exports.GitmojiCode || (exports.GitmojiCode = {}));
|
|
63
|
+
//# sourceMappingURL=gitmoji.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitmoji.js","sourceRoot":"","sources":["../../src/conventional-changelog/gitmoji.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAyD;AACzD,8DAAsC;AACtC,uCAA2E;AAI3E,IAAiB,WAAW,CAmE3B;AAnED,WAAiB,WAAW;IAIb,mBAAO,GAAG,IAAA,qBAAW,GAAE,CAAC;IAErC,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,IAAI,YAAA,OAAO,CAAC,MAAM,GAAG,EAAE,YAAA,OAAO,CAAC,KAAK,CAAC,CAAC;IACnE,MAAM,eAAe,GAAG,IAAI,GAAG,CAC7B,mBAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAmB,CAAC,CAAC,MAAM,CAAC,mBAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CACxG,CAAC;IACF,MAAM,KAAK,GAAG;QACZ,uCAAuC;QACvC,KAAK,EAAE,WAAW,CAAC,mBAAQ,EAAE,OAAO,CAAC;KACtC,CAAC;IAEF,SAAS,WAAW,CAA0B,IAAwB,EAAE,GAAM;QAC5E,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACjE,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,CACzC,GAAG;aACA,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;YAClF,oEAAoE;aACnE,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,IAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAC9G,EAAE,CACH,CACF,CAAC;IACJ,CAAC,CAAC,EAAE,CAAC;IAEL,SAAgB,wBAAwB,CAAC,OAAoB;QAC3D,OAAO,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC;IACnD,CAAC;IAFe,oCAAwB,2BAEvC,CAAA;AACH,CAAC,EAnEgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAmE3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conventional-changelog/index.ts"],"names":[],"mappings":";;;AAEA,wBAEE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const parser_opts_1 = __importDefault(require("./parser-opts"));
|
|
7
|
+
exports.default = {
|
|
8
|
+
parserOpts: parser_opts_1.default,
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conventional-changelog/index.ts"],"names":[],"mappings":";;;;;AAAA,gEAAuC;AAEvC,kBAAe;IACb,UAAU,EAAV,qBAAU;CACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-opts.d.ts","sourceRoot":"","sources":["../../src/conventional-changelog/parser-opts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,QAAA,MAAM,UAAU,EAAE,aAOjB,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const gitmoji_1 = require("./gitmoji");
|
|
4
|
+
const parserOpts = {
|
|
5
|
+
headerPattern: new RegExp(`^(:\\w*:|${gitmoji_1.GitmojiCode.reEmoji.source}) (?:\\((.*)\\):? )?(.*)$`),
|
|
6
|
+
headerCorrespondence: ['type', 'scope', 'subject'],
|
|
7
|
+
revertPattern: /^(?:revert|revert:)\s"?([\S\s]+?)"?\s*this reverts commit (\w*)\./i,
|
|
8
|
+
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],
|
|
9
|
+
// revertPattern: /revert:\s([\S\s]*?)\s*this reverts commit (\w*)\./i,
|
|
10
|
+
revertCorrespondence: [`header`, `hash`],
|
|
11
|
+
};
|
|
12
|
+
exports.default = parserOpts;
|
|
13
|
+
//# sourceMappingURL=parser-opts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-opts.js","sourceRoot":"","sources":["../../src/conventional-changelog/parser-opts.ts"],"names":[],"mappings":";;AACA,uCAAwC;AAExC,MAAM,UAAU,GAAkB;IAChC,aAAa,EAAE,IAAI,MAAM,CAAC,YAAY,qBAAW,CAAC,OAAO,CAAC,MAAM,2BAA2B,CAAC;IAC5F,oBAAoB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC;IAClD,aAAa,EAAE,oEAAoE;IACnF,YAAY,EAAE,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IACrD,uEAAuE;IACvE,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;CACzC,CAAC;AACF,kBAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Options as WriterOptions } from 'conventional-changelog-writer';
|
|
2
|
+
import { CommitConventionalType } from './data.js';
|
|
3
|
+
export type Language = 'en-US';
|
|
4
|
+
export interface TransformConfig {
|
|
5
|
+
scopeDisplayName?: Record<string, string>;
|
|
6
|
+
displayTypes?: CommitConventionalType[];
|
|
7
|
+
displayScopes?: string[];
|
|
8
|
+
showAuthor?: boolean;
|
|
9
|
+
withEmoji?: boolean;
|
|
10
|
+
language?: Language;
|
|
11
|
+
}
|
|
12
|
+
export declare function displayScope(scope: string | null | undefined, scopeDisplayNameMap: Record<string, string>): string | undefined;
|
|
13
|
+
export declare function displayType(type: CommitConventionalType, options?: displayType.Options): string;
|
|
14
|
+
export declare namespace displayType {
|
|
15
|
+
interface Options {
|
|
16
|
+
readonly withEmoji?: boolean;
|
|
17
|
+
readonly language?: Language;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare function createTransform(config: TransformConfig): WriterOptions.Transform.Function;
|
|
21
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/conventional-changelog/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,OAAO,IAAI,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAU,MAAM,WAAW,CAAC;AAG3D,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC;AAE/B,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,YAAY,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACxC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,sBAMzG;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,GAAE,WAAW,CAAC,OAAY,GAAG,MAAM,CASnG;AACD,yBAAiB,WAAW,CAAC;IAC3B,UAAiB,OAAO;QACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;KAC9B;CACF;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,aAAa,CAAC,SAAS,CAAC,QAAQ,CAiFzF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTransform = exports.displayType = exports.displayScope = void 0;
|
|
4
|
+
const data_js_1 = require("./data.js");
|
|
5
|
+
const gitmoji_js_1 = require("./gitmoji.js");
|
|
6
|
+
function displayScope(scope, scopeDisplayNameMap) {
|
|
7
|
+
return scope == null || scope.length === 0
|
|
8
|
+
? scopeDisplayNameMap['*']
|
|
9
|
+
: scopeDisplayNameMap[scope] == null
|
|
10
|
+
? scope
|
|
11
|
+
: scopeDisplayNameMap[scope];
|
|
12
|
+
}
|
|
13
|
+
exports.displayScope = displayScope;
|
|
14
|
+
function displayType(type, options = {}) {
|
|
15
|
+
const { withEmoji = true, language = 'en-US' } = options;
|
|
16
|
+
if (data_js_1.CommitConventionalType.hasInstance(type)) {
|
|
17
|
+
const { emoji, [language]: title } = data_js_1.CommitConventionalType.getData(type);
|
|
18
|
+
return `${withEmoji ? `${emoji} ` : ''}${title}`;
|
|
19
|
+
}
|
|
20
|
+
return type;
|
|
21
|
+
}
|
|
22
|
+
exports.displayType = displayType;
|
|
23
|
+
function createTransform(config) {
|
|
24
|
+
const displayTypes = new Set(config.displayTypes == null ? data_js_1.CommitConventionalType.values() : config.displayTypes);
|
|
25
|
+
const ignoreType = (type) => type == null || !displayTypes.has(type);
|
|
26
|
+
const ignoreScope = (scope) => config.displayScopes == null ? false : scope != null && !config.displayScopes.includes(scope);
|
|
27
|
+
const transform = (commit, { repository, host, owner, repoUrl }) => {
|
|
28
|
+
const discard = commit.notes.length === 0;
|
|
29
|
+
const issues = new Set();
|
|
30
|
+
const notes = commit.notes.map((note) => ({
|
|
31
|
+
...note,
|
|
32
|
+
title: `${config.withEmoji === false ? '' : '💥 '}BREAKING CHANGES`,
|
|
33
|
+
}));
|
|
34
|
+
const conventionalType = commit.type == null
|
|
35
|
+
? undefined
|
|
36
|
+
: data_js_1.CommitConventionalType.parse(commit.type) ??
|
|
37
|
+
(gitmoji_js_1.GitmojiCode.isValid(commit.type) ? gitmoji_js_1.GitmojiCode.toConventionalCommitType(commit.type) : undefined);
|
|
38
|
+
if (ignoreType(conventionalType) && discard)
|
|
39
|
+
return false;
|
|
40
|
+
const type = conventionalType == null
|
|
41
|
+
? conventionalType
|
|
42
|
+
: displayType(conventionalType, {
|
|
43
|
+
withEmoji: config.withEmoji,
|
|
44
|
+
});
|
|
45
|
+
if (ignoreScope(commit.scope))
|
|
46
|
+
return false;
|
|
47
|
+
const scopeIntermediate = commit.scope === '*' ? '' : commit.scope;
|
|
48
|
+
const scope = config.scopeDisplayName == null ? scopeIntermediate : displayScope(scopeIntermediate, config.scopeDisplayName);
|
|
49
|
+
const hash = typeof commit.hash === 'string' ? commit.hash.slice(0, 7) : commit.hash;
|
|
50
|
+
const subject = typeof commit.subject === 'string'
|
|
51
|
+
? (() => {
|
|
52
|
+
let returnValue = commit.subject;
|
|
53
|
+
const url = repository == null ? repoUrl : [host, owner, repository].filter(Boolean).join('/');
|
|
54
|
+
if (url != null) {
|
|
55
|
+
const issueURL = `${url}/issues/`;
|
|
56
|
+
// Issue URLs.
|
|
57
|
+
returnValue = returnValue.replace(/#(\d+)/g, (_, issue) => {
|
|
58
|
+
issues.add(issue);
|
|
59
|
+
return `[#${issue}](${issueURL}${issue})`;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (host != null) {
|
|
63
|
+
// User URLs.
|
|
64
|
+
// eslint-disable-next-line unicorn/no-unsafe-regex
|
|
65
|
+
returnValue = returnValue.replace(/\B@([\da-z](?:-?[\d/a-z]){0,38})/g, (_, username) => username.includes('/') ? `@${username}` : `[@${username}](${host}/${username})`);
|
|
66
|
+
}
|
|
67
|
+
return returnValue;
|
|
68
|
+
})()
|
|
69
|
+
: commit.subject;
|
|
70
|
+
// Remove references that already appear in the subject
|
|
71
|
+
const references = commit.references.filter((reference) => !issues.has(reference.issue));
|
|
72
|
+
return {
|
|
73
|
+
...commit,
|
|
74
|
+
type,
|
|
75
|
+
hash,
|
|
76
|
+
scope,
|
|
77
|
+
subject,
|
|
78
|
+
references,
|
|
79
|
+
header: commit.header,
|
|
80
|
+
body: commit.body,
|
|
81
|
+
footer: commit.footer,
|
|
82
|
+
merge: commit.merge,
|
|
83
|
+
revert: commit.revert,
|
|
84
|
+
notes,
|
|
85
|
+
mentions: commit.mentions,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
return transform;
|
|
89
|
+
}
|
|
90
|
+
exports.createTransform = createTransform;
|
|
91
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/conventional-changelog/transform.ts"],"names":[],"mappings":";;;AACA,uCAA2D;AAC3D,6CAA2C;AAa3C,SAAgB,YAAY,CAAC,KAAgC,EAAE,mBAA2C;IACxG,OAAO,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QACxC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC;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,KAAK,IAAI,IAAI,QAAQ,GAAG,CAChF,CAAC;iBACH;gBACD,OAAO,WAAW,CAAC;YACrB,CAAC,CAAC,EAAE;YACN,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;QAErB,uDAAuD;QACvD,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAEzF,OAAO;YACL,GAAG,MAAM;YACT,IAAI;YACJ,IAAI;YACJ,KAAK;YACL,OAAO;YACP,UAAU;YACV,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK;YACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,SAAwD,CAAC;AAClE,CAAC;AAjFD,0CAiFC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer-opts.d.ts","sourceRoot":"","sources":["../../src/conventional-changelog/writer-opts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAa7D,QAAA,MAAM,UAAU,EAAE,OAUjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const node_fs_1 = require("node:fs");
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const transform_js_1 = require("./transform.js");
|
|
6
|
+
const basePath = (0, node_path_1.resolve)(__dirname, './templates');
|
|
7
|
+
const template = (0, node_fs_1.readFileSync)(`${basePath}/template.hbs`, 'utf8');
|
|
8
|
+
const header = (0, node_fs_1.readFileSync)(`${basePath}/header.hbs`, 'utf8');
|
|
9
|
+
const commit = (0, node_fs_1.readFileSync)(`${basePath}/commit.hbs`, 'utf8');
|
|
10
|
+
const footer = (0, node_fs_1.readFileSync)(`${basePath}/footer.hbs`, 'utf8');
|
|
11
|
+
const author = (0, node_fs_1.readFileSync)(`${basePath}/author.hbs`, 'utf8');
|
|
12
|
+
const writerOpts = {
|
|
13
|
+
transform: (0, transform_js_1.createTransform)({}),
|
|
14
|
+
groupBy: 'type',
|
|
15
|
+
commitGroupsSort: 'title',
|
|
16
|
+
commitsSort: ['scope', 'subject'],
|
|
17
|
+
noteGroupsSort: 'title',
|
|
18
|
+
mainTemplate: template,
|
|
19
|
+
headerPartial: header,
|
|
20
|
+
commitPartial: commit.replace(/{{gitUserInfo}}/g, author),
|
|
21
|
+
footerPartial: footer,
|
|
22
|
+
};
|
|
23
|
+
exports.default = writerOpts;
|
|
24
|
+
//# sourceMappingURL=writer-opts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer-opts.js","sourceRoot":"","sources":["../../src/conventional-changelog/writer-opts.ts"],"names":[],"mappings":";;AACA,qCAAuC;AACvC,yCAAoC;AACpC,iDAAiD;AAEjD,MAAM,QAAQ,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AAEnD,MAAM,QAAQ,GAAG,IAAA,sBAAY,EAAC,GAAG,QAAQ,eAAe,EAAE,MAAM,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,GAAG,QAAQ,aAAa,EAAE,MAAM,CAAC,CAAC;AAC9D,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,GAAG,QAAQ,aAAa,EAAE,MAAM,CAAC,CAAC;AAC9D,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,GAAG,QAAQ,aAAa,EAAE,MAAM,CAAC,CAAC;AAC9D,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,GAAG,QAAQ,aAAa,EAAE,MAAM,CAAC,CAAC;AAE9D,MAAM,UAAU,GAAY;IAC1B,SAAS,EAAE,IAAA,8BAAe,EAAC,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM;IACf,gBAAgB,EAAE,OAAO;IACzB,WAAW,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;IACjC,cAAc,EAAE,OAAO;IACvB,YAAY,EAAE,QAAQ;IACtB,aAAa,EAAE,MAAM;IACrB,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACzD,aAAa,EAAE,MAAM;CACtB,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2C,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA4B9F,QAAA,MAAM,MAAM;;;;CAIX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
7
|
/* eslint-disable import/no-import-module-exports */
|
|
4
8
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
parserOpts:
|
|
11
|
-
// eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals
|
|
12
|
-
headerPattern: new RegExp("^(:\\w*:|".concat(gitmoji_js_1.Gitmoji.reEmoji.source, ") (?:\\((.*)\\):? )?(.*)$")),
|
|
13
|
-
headerCorrespondence: ['type', 'scope', 'subject'],
|
|
14
|
-
},
|
|
9
|
+
const types_1 = require("@commitlint/types");
|
|
10
|
+
const index_js_1 = __importDefault(require("./conventional-changelog/index.js"));
|
|
11
|
+
const plugin_js_1 = require("./plugin.js");
|
|
12
|
+
const { Error, Warning, Disabled } = types_1.RuleConfigSeverity;
|
|
13
|
+
const parserPreset = {
|
|
14
|
+
parserOpts: index_js_1.default.parserOpts,
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
const rules = {
|
|
17
17
|
'body-leading-blank': [Warning, 'always'],
|
|
18
18
|
'body-max-line-length': [Error, 'always', 100],
|
|
19
19
|
'footer-leading-blank': [Warning, 'always'],
|
|
@@ -30,9 +30,9 @@ var rules = {
|
|
|
30
30
|
'type-gitmoji-style': [Error, 'always', 'unicode'],
|
|
31
31
|
'type-valid-gitmoji': [Error, 'always'],
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
parserPreset
|
|
35
|
-
rules
|
|
33
|
+
const config = {
|
|
34
|
+
parserPreset,
|
|
35
|
+
rules,
|
|
36
36
|
plugins: [plugin_js_1.gitmojiPlugin],
|
|
37
37
|
};
|
|
38
38
|
exports.default = config;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yDAAyD;AACzD,oDAAoD;AACpD,4DAA4D;AAC5D,6CAA8F;AAC9F,iFAAsE;AACtE,2CAA4C;AAE5C,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,0BAAkB,CAAC;AAExD,MAAM,YAAY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":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAuB,MAAM,mBAAmB,CAAC;AAQtE,eAAO,MAAM,gBAAgB,EAAE,IAAI,CAAC,SAAS,GAAG,OAAO,CAWtD,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAM9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAK3B,CAAC"}
|
package/lib/plugin.js
CHANGED
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.gitmojiPlugin = exports.typeValidGitmoji = exports.typeGitmojiStyle = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
var typeGitmojiStyle = function (parsed, when, value) {
|
|
12
|
-
if (when === void 0) { when = 'always'; }
|
|
13
|
-
if (value === void 0) { value = 'unicode'; }
|
|
14
|
-
var isUnicode = parsed.type != null && gitmoji_1.Gitmoji.isUnicode(parsed.type);
|
|
15
|
-
var isEmoji = parsed.type != null && gitmoji_1.Gitmoji.isEmoji(parsed.type);
|
|
4
|
+
const gitmoji_1 = require("./conventional-changelog/gitmoji");
|
|
5
|
+
const $if = (when = 'always') => (cond) => when === 'always' ? cond : !cond;
|
|
6
|
+
const typeGitmojiStyle = (parsed, when = 'always', value = 'unicode') => {
|
|
7
|
+
const isUnicode = parsed.type != null && gitmoji_1.GitmojiCode.isUnicode(parsed.type);
|
|
8
|
+
const isEmoji = parsed.type != null && gitmoji_1.GitmojiCode.isEmoji(parsed.type);
|
|
16
9
|
return value === 'unicode'
|
|
17
10
|
? $if(when)(isUnicode)
|
|
18
11
|
? [true]
|
|
19
|
-
: [false,
|
|
12
|
+
: [false, `Type should ${when} be an unicode character`]
|
|
20
13
|
: $if(when)(isEmoji)
|
|
21
14
|
? [true]
|
|
22
|
-
: [false,
|
|
15
|
+
: [false, `Type should ${when} be an valid :emoji:`];
|
|
23
16
|
};
|
|
24
17
|
exports.typeGitmojiStyle = typeGitmojiStyle;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var isValidGitmoji = parsed.type != null && gitmoji_1.Gitmoji.isValid(parsed.type);
|
|
18
|
+
const typeValidGitmoji = (parsed, when = 'always') => {
|
|
19
|
+
const isValidGitmoji = parsed.type != null && gitmoji_1.GitmojiCode.isValid(parsed.type);
|
|
28
20
|
return $if(when)(isValidGitmoji)
|
|
29
21
|
? [true]
|
|
30
|
-
: [false,
|
|
22
|
+
: [false, `Type should ${when} be an valid gitmoji (see https://gitmoji.dev)`];
|
|
31
23
|
};
|
|
32
24
|
exports.typeValidGitmoji = typeValidGitmoji;
|
|
33
25
|
/**
|
package/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;AAEA,8DAA+D;AAE/D,MAAM,GAAG,GACP,CAAC,OAAwC,QAAQ,EAAE,EAAE,CACrD,CAAC,IAAa,EAAE,EAAE,CAChB,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAE9B,MAAM,gBAAgB,GAA8B,CAAC,MAAM,EAAE,IAAI,GAAG,QAAQ,EAAE,KAAK,GAAG,SAAS,EAAE,EAAE;IACxG,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,IAAI,qBAAW,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,IAAI,qBAAW,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAExE,OAAO,KAAK,KAAK,SAAS;QACxB,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;YACpB,CAAC,CAAC,CAAC,IAAI,CAAC;YACR,CAAC,CAAC,CAAC,KAAK,EAAE,eAAe,IAAI,0BAA0B,CAAC;QAC1D,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;YACpB,CAAC,CAAC,CAAC,IAAI,CAAC;YACR,CAAC,CAAC,CAAC,KAAK,EAAE,eAAe,IAAI,sBAAsB,CAAC,CAAC;AACzD,CAAC,CAAC;AAXW,QAAA,gBAAgB,oBAW3B;AAEK,MAAM,gBAAgB,GAAS,CAAC,MAAM,EAAE,IAAI,GAAG,QAAQ,EAAE,EAAE;IAChE,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,IAAI,qBAAW,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/E,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC;QAC9B,CAAC,CAAC,CAAC,IAAI,CAAC;QACR,CAAC,CAAC,CAAC,KAAK,EAAE,eAAe,IAAI,gDAAgD,CAAC,CAAC;AACnF,CAAC,CAAC;AANW,QAAA,gBAAgB,oBAM3B;AAEF;;GAEG;AACU,QAAA,aAAa,GAAW;IACnC,KAAK,EAAE;QACL,oBAAoB,EAAE,wBAAgB;QACtC,oBAAoB,EAAE,wBAAgB;KACvC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/commitlint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Commitlint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commitlint",
|
|
@@ -37,12 +37,14 @@
|
|
|
37
37
|
"build": "concurrently \"npm:build:*\" \":\"",
|
|
38
38
|
"build:src": "tsc",
|
|
39
39
|
"clean": "concurrently \"npm:clean:*\" \":\"",
|
|
40
|
+
"clean:src": "rm -rf lib/*",
|
|
40
41
|
"docs": "md-magic --path '**/*.md' --ignore='node_modules'",
|
|
41
42
|
"format": "concurrently \"npm:format:*\" \":\"",
|
|
42
43
|
"format:src": "eslint . --fix --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml",
|
|
43
44
|
"lint": "concurrently \"npm:lint:*\" \":\"",
|
|
44
45
|
"lint:src": "eslint . --ext=mjs,cjs,js,jsx,ts,tsx,json,jsonc,json5,yml,yaml",
|
|
45
46
|
"prepare": "concurrently \"npm:prepare:*\" \":\"",
|
|
47
|
+
"prepublishOnly": "npm run build",
|
|
46
48
|
"spellcheck": "cspell --no-progress '**'",
|
|
47
49
|
"test": "concurrently \"npm:test:*\" ",
|
|
48
50
|
"test:src": "jest"
|
|
@@ -67,17 +69,24 @@
|
|
|
67
69
|
"gitmojis": "^3.13.0"
|
|
68
70
|
},
|
|
69
71
|
"devDependencies": {
|
|
70
|
-
"@commitlint/lint": "17.
|
|
71
|
-
"@jest/globals": "29.3.1"
|
|
72
|
+
"@commitlint/lint": "17.4.0",
|
|
73
|
+
"@jest/globals": "29.3.1",
|
|
74
|
+
"@types/conventional-changelog-writer": "4.0.2",
|
|
75
|
+
"@types/conventional-commits-parser": "3.0.3"
|
|
72
76
|
},
|
|
73
77
|
"peerDependencies": {
|
|
74
78
|
"@commitlint/cli": "^16.0.0 || ^17.0.0"
|
|
75
79
|
},
|
|
80
|
+
"peerDependenciesMeta": {
|
|
81
|
+
"@commitlint/cli": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
76
85
|
"engines": {
|
|
77
86
|
"node": ">=16.0.0"
|
|
78
87
|
},
|
|
79
88
|
"publishConfig": {
|
|
80
89
|
"access": "public"
|
|
81
90
|
},
|
|
82
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "61004fd9075a909dac066b6b3c012817bb082414"
|
|
83
92
|
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import type { Commit as CommitDefault } from 'conventional-commits-parser';
|
|
3
|
+
|
|
4
|
+
export type Commit = CommitDefault<never> & {
|
|
5
|
+
hash?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type CommitConventionalType =
|
|
9
|
+
| 'build'
|
|
10
|
+
| 'ci'
|
|
11
|
+
| 'docs'
|
|
12
|
+
| 'feat'
|
|
13
|
+
| 'fix'
|
|
14
|
+
| 'perf'
|
|
15
|
+
| 'refactor'
|
|
16
|
+
| 'revert'
|
|
17
|
+
| 'style'
|
|
18
|
+
| 'test'
|
|
19
|
+
| 'wip'
|
|
20
|
+
| 'chore';
|
|
21
|
+
|
|
22
|
+
export const CommitConventionalType = (() => {
|
|
23
|
+
const enumObject = Object.freeze({
|
|
24
|
+
Build: 'build',
|
|
25
|
+
CI: 'ci',
|
|
26
|
+
Docs: 'docs',
|
|
27
|
+
Feat: 'feat',
|
|
28
|
+
Fix: 'fix',
|
|
29
|
+
Perf: 'perf',
|
|
30
|
+
Refactor: 'refactor',
|
|
31
|
+
Revert: 'revert',
|
|
32
|
+
Style: 'style',
|
|
33
|
+
Test: 'test',
|
|
34
|
+
WIP: 'wip',
|
|
35
|
+
Chore: 'chore',
|
|
36
|
+
});
|
|
37
|
+
const enumValues: readonly CommitConventionalType[] = Object.freeze(Object.values(enumObject).sort());
|
|
38
|
+
const enumValuesSet = new Set(enumValues);
|
|
39
|
+
|
|
40
|
+
const typeData: Record<CommitConventionalType, CommitConventionalTypeData> = {
|
|
41
|
+
feat: {
|
|
42
|
+
emoji: '✨',
|
|
43
|
+
'en-US': 'Features',
|
|
44
|
+
},
|
|
45
|
+
fix: {
|
|
46
|
+
emoji: '🐛',
|
|
47
|
+
'en-US': 'Bug Fixes',
|
|
48
|
+
},
|
|
49
|
+
build: {
|
|
50
|
+
emoji: '👷',
|
|
51
|
+
'en-US': 'Build System',
|
|
52
|
+
},
|
|
53
|
+
chore: {
|
|
54
|
+
emoji: '🎫',
|
|
55
|
+
'en-US': 'Chores',
|
|
56
|
+
},
|
|
57
|
+
ci: {
|
|
58
|
+
emoji: '🔧',
|
|
59
|
+
'en-US': 'Continuous Integration',
|
|
60
|
+
},
|
|
61
|
+
docs: {
|
|
62
|
+
emoji: '📝',
|
|
63
|
+
'en-US': 'Documentation',
|
|
64
|
+
},
|
|
65
|
+
test: {
|
|
66
|
+
emoji: '✅',
|
|
67
|
+
'en-US': 'Tests',
|
|
68
|
+
},
|
|
69
|
+
perf: {
|
|
70
|
+
emoji: '⚡',
|
|
71
|
+
'en-US': 'Performance Improvements',
|
|
72
|
+
},
|
|
73
|
+
refactor: {
|
|
74
|
+
emoji: '♻',
|
|
75
|
+
'en-US': 'Code Refactoring',
|
|
76
|
+
},
|
|
77
|
+
revert: {
|
|
78
|
+
emoji: '⏪',
|
|
79
|
+
'en-US': 'Reverts',
|
|
80
|
+
},
|
|
81
|
+
style: {
|
|
82
|
+
emoji: '💄',
|
|
83
|
+
'en-US': 'Styles',
|
|
84
|
+
},
|
|
85
|
+
wip: {
|
|
86
|
+
emoji: '🚧',
|
|
87
|
+
'en-US': 'Work in progress',
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
function hasInstance(anyValue: unknown): anyValue is CommitConventionalType {
|
|
92
|
+
return typeof anyValue === 'string' && enumValuesSet.has(anyValue as unknown as CommitConventionalType);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function getData(commitType: CommitConventionalType): CommitConventionalTypeData {
|
|
96
|
+
return typeData[commitType];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function parse(anyValue: string): CommitConventionalType | undefined {
|
|
100
|
+
return hasInstance(anyValue) ? anyValue : undefined;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function values() {
|
|
104
|
+
return enumValues;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return { ...enumObject, hasInstance, getData, values, parse };
|
|
108
|
+
})();
|
|
109
|
+
|
|
110
|
+
export interface CommitConventionalTypeData {
|
|
111
|
+
emoji: string;
|
|
112
|
+
'en-US': string;
|
|
113
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import emojiRegexp from 'emoji-regex';
|
|
3
|
+
import { Gitmoji, gitmojis, GitmojiUnicode, GitmojiEmoji } from 'gitmojis';
|
|
4
|
+
import type { CommitConventionalType } from './data';
|
|
5
|
+
|
|
6
|
+
export type GitmojiCode = GitmojiCode.Unicode | GitmojiCode.Emoji;
|
|
7
|
+
export namespace GitmojiCode {
|
|
8
|
+
export type Unicode = GitmojiUnicode;
|
|
9
|
+
export type Emoji = GitmojiEmoji;
|
|
10
|
+
|
|
11
|
+
export const reEmoji = emojiRegexp();
|
|
12
|
+
|
|
13
|
+
const reGitmoji = new RegExp(`^${reEmoji.source}$`, reEmoji.flags);
|
|
14
|
+
const allGitmojiCodes = new Set(
|
|
15
|
+
gitmojis.map((gitmoji) => gitmoji.code as GitmojiCode).concat(gitmojis.map((gitmoji) => gitmoji.emoji))
|
|
16
|
+
);
|
|
17
|
+
const index = {
|
|
18
|
+
// code: createIndex(gitmojis, 'code'),
|
|
19
|
+
emoji: createIndex(gitmojis, 'emoji'),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function createIndex<K extends keyof Gitmoji>(list: readonly Gitmoji[], key: K): ReadonlyMap<Gitmoji[K], Gitmoji> {
|
|
23
|
+
return new Map(list.map((gitmoji) => [gitmoji[key], gitmoji]));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function isUnicode(anyValue: string): anyValue is Unicode {
|
|
27
|
+
return anyValue.match(reGitmoji) != null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function isEmoji(anyValue: string): anyValue is Emoji {
|
|
31
|
+
return anyValue.match(/^:(\w+):$/) != null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function isValid(anyValue: string): anyValue is GitmojiCode {
|
|
35
|
+
return allGitmojiCodes.has(anyValue as GitmojiCode);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const defaultType = 'chore';
|
|
39
|
+
const conversionMap: ReadonlyMap<GitmojiCode, CommitConventionalType> = (() => {
|
|
40
|
+
const data: Record<CommitConventionalType, GitmojiCode.Unicode[]> = {
|
|
41
|
+
feat: ['✨', '♿️', '🚸'] as GitmojiCode.Unicode[],
|
|
42
|
+
fix: ['🐛'] as GitmojiCode.Unicode[],
|
|
43
|
+
docs: ['📝'] as GitmojiCode.Unicode[],
|
|
44
|
+
style: ['🎨', '🚨'] as GitmojiCode.Unicode[],
|
|
45
|
+
refactor: ['♻️', '🏗️'] as GitmojiCode.Unicode[],
|
|
46
|
+
test: ['✅'] as GitmojiCode.Unicode[],
|
|
47
|
+
perf: ['⚡️'] as GitmojiCode.Unicode[],
|
|
48
|
+
revert: ['⏪️'] as GitmojiCode.Unicode[],
|
|
49
|
+
ci: ['👷', '💚'] as GitmojiCode.Unicode[],
|
|
50
|
+
wip: ['🚧'] as GitmojiCode.Unicode[],
|
|
51
|
+
build: [] as GitmojiCode.Unicode[],
|
|
52
|
+
chore: [] as GitmojiCode.Unicode[],
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const entries = Array.from<[CommitConventionalType, GitmojiCode.Unicode[]]>(
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
Object.entries(data)
|
|
58
|
+
);
|
|
59
|
+
return new Map(
|
|
60
|
+
entries.reduce<Array<[GitmojiCode, CommitConventionalType]>>(
|
|
61
|
+
(acc, [commitType, gitmojiUnicodeArray]) =>
|
|
62
|
+
acc
|
|
63
|
+
.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [gitmojiUnicode, commitType]))
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
65
|
+
.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [index.emoji.get(gitmojiUnicode)?.code!, commitType])),
|
|
66
|
+
[]
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
})();
|
|
70
|
+
|
|
71
|
+
export function toConventionalCommitType(gitmoji: GitmojiCode): CommitConventionalType {
|
|
72
|
+
return conversionMap.get(gitmoji) ?? defaultType;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ParserOptions } from '@commitlint/types';
|
|
2
|
+
import { GitmojiCode } from './gitmoji';
|
|
3
|
+
|
|
4
|
+
const parserOpts: ParserOptions = {
|
|
5
|
+
headerPattern: new RegExp(`^(:\\w*:|${GitmojiCode.reEmoji.source}) (?:\\((.*)\\):? )?(.*)$`),
|
|
6
|
+
headerCorrespondence: ['type', 'scope', 'subject'],
|
|
7
|
+
revertPattern: /^(?:revert|revert:)\s"?([\S\s]+?)"?\s*this reverts commit (\w*)\./i,
|
|
8
|
+
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],
|
|
9
|
+
// revertPattern: /revert:\s([\S\s]*?)\s*this reverts commit (\w*)\./i,
|
|
10
|
+
revertCorrespondence: [`header`, `hash`],
|
|
11
|
+
};
|
|
12
|
+
export default parserOpts;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { Context, Options as WriterOptions } from 'conventional-changelog-writer';
|
|
2
|
+
import { CommitConventionalType, Commit } from './data.js';
|
|
3
|
+
import { GitmojiCode } from './gitmoji.js';
|
|
4
|
+
|
|
5
|
+
export type Language = 'en-US';
|
|
6
|
+
|
|
7
|
+
export interface TransformConfig {
|
|
8
|
+
scopeDisplayName?: Record<string, string>;
|
|
9
|
+
displayTypes?: CommitConventionalType[];
|
|
10
|
+
displayScopes?: string[];
|
|
11
|
+
showAuthor?: boolean;
|
|
12
|
+
withEmoji?: boolean;
|
|
13
|
+
language?: Language;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function displayScope(scope: string | null | undefined, scopeDisplayNameMap: Record<string, string>) {
|
|
17
|
+
return scope == null || scope.length === 0
|
|
18
|
+
? scopeDisplayNameMap['*']
|
|
19
|
+
: scopeDisplayNameMap[scope] == null
|
|
20
|
+
? scope
|
|
21
|
+
: scopeDisplayNameMap[scope];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function displayType(type: CommitConventionalType, options: displayType.Options = {}): string {
|
|
25
|
+
const { withEmoji = true, language = 'en-US' } = options;
|
|
26
|
+
|
|
27
|
+
if (CommitConventionalType.hasInstance(type)) {
|
|
28
|
+
const { emoji, [language]: title } = CommitConventionalType.getData(type);
|
|
29
|
+
return `${withEmoji ? `${emoji} ` : ''}${title}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return type;
|
|
33
|
+
}
|
|
34
|
+
export namespace displayType {
|
|
35
|
+
export interface Options {
|
|
36
|
+
readonly withEmoji?: boolean;
|
|
37
|
+
readonly language?: Language;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function createTransform(config: TransformConfig): WriterOptions.Transform.Function {
|
|
42
|
+
const displayTypes = new Set(config.displayTypes == null ? CommitConventionalType.values() : config.displayTypes);
|
|
43
|
+
const ignoreType = (type: string | undefined) => type == null || !displayTypes.has(type as CommitConventionalType);
|
|
44
|
+
const ignoreScope = (scope: string | undefined | null) =>
|
|
45
|
+
config.displayScopes == null ? false : scope != null && !config.displayScopes.includes(scope);
|
|
46
|
+
|
|
47
|
+
const transform = (commit: Commit, { repository, host, owner, repoUrl }: Context): Commit | false => {
|
|
48
|
+
const discard = commit.notes.length === 0;
|
|
49
|
+
const issues = new Set<string>();
|
|
50
|
+
const notes = commit.notes.map((note) => ({
|
|
51
|
+
...note,
|
|
52
|
+
title: `${config.withEmoji === false ? '' : '💥 '}BREAKING CHANGES`,
|
|
53
|
+
}));
|
|
54
|
+
const conventionalType =
|
|
55
|
+
commit.type == null
|
|
56
|
+
? undefined
|
|
57
|
+
: CommitConventionalType.parse(commit.type) ??
|
|
58
|
+
(GitmojiCode.isValid(commit.type) ? GitmojiCode.toConventionalCommitType(commit.type) : undefined);
|
|
59
|
+
|
|
60
|
+
if (ignoreType(conventionalType) && discard) return false;
|
|
61
|
+
|
|
62
|
+
const type =
|
|
63
|
+
conventionalType == null
|
|
64
|
+
? conventionalType
|
|
65
|
+
: displayType(conventionalType, {
|
|
66
|
+
withEmoji: config.withEmoji,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (ignoreScope(commit.scope)) return false;
|
|
70
|
+
|
|
71
|
+
const scopeIntermediate = commit.scope === '*' ? '' : commit.scope;
|
|
72
|
+
const scope =
|
|
73
|
+
config.scopeDisplayName == null ? scopeIntermediate : displayScope(scopeIntermediate, config.scopeDisplayName);
|
|
74
|
+
const hash = typeof commit.hash === 'string' ? commit.hash.slice(0, 7) : commit.hash;
|
|
75
|
+
|
|
76
|
+
const subject =
|
|
77
|
+
typeof commit.subject === 'string'
|
|
78
|
+
? (() => {
|
|
79
|
+
let returnValue = commit.subject;
|
|
80
|
+
const url = repository == null ? repoUrl : [host, owner, repository].filter(Boolean).join('/');
|
|
81
|
+
if (url != null) {
|
|
82
|
+
const issueURL = `${url}/issues/`;
|
|
83
|
+
// Issue URLs.
|
|
84
|
+
returnValue = returnValue.replace(/#(\d+)/g, (_, issue: string) => {
|
|
85
|
+
issues.add(issue);
|
|
86
|
+
|
|
87
|
+
return `[#${issue}](${issueURL}${issue})`;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (host != null) {
|
|
91
|
+
// User URLs.
|
|
92
|
+
// eslint-disable-next-line unicorn/no-unsafe-regex
|
|
93
|
+
returnValue = returnValue.replace(/\B@([\da-z](?:-?[\d/a-z]){0,38})/g, (_, username: string) =>
|
|
94
|
+
username.includes('/') ? `@${username}` : `[@${username}](${host}/${username})`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return returnValue;
|
|
98
|
+
})()
|
|
99
|
+
: commit.subject;
|
|
100
|
+
|
|
101
|
+
// Remove references that already appear in the subject
|
|
102
|
+
const references = commit.references.filter((reference) => !issues.has(reference.issue));
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
...commit,
|
|
106
|
+
type,
|
|
107
|
+
hash,
|
|
108
|
+
scope,
|
|
109
|
+
subject,
|
|
110
|
+
references,
|
|
111
|
+
header: commit.header,
|
|
112
|
+
body: commit.body,
|
|
113
|
+
footer: commit.footer,
|
|
114
|
+
merge: commit.merge,
|
|
115
|
+
revert: commit.revert,
|
|
116
|
+
notes,
|
|
117
|
+
mentions: commit.mentions,
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
return transform as unknown as WriterOptions.Transform.Function;
|
|
122
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Options } from 'conventional-changelog-writer';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { createTransform } from './transform.js';
|
|
5
|
+
|
|
6
|
+
const basePath = resolve(__dirname, './templates');
|
|
7
|
+
|
|
8
|
+
const template = readFileSync(`${basePath}/template.hbs`, 'utf8');
|
|
9
|
+
const header = readFileSync(`${basePath}/header.hbs`, 'utf8');
|
|
10
|
+
const commit = readFileSync(`${basePath}/commit.hbs`, 'utf8');
|
|
11
|
+
const footer = readFileSync(`${basePath}/footer.hbs`, 'utf8');
|
|
12
|
+
const author = readFileSync(`${basePath}/author.hbs`, 'utf8');
|
|
13
|
+
|
|
14
|
+
const writerOpts: Options = {
|
|
15
|
+
transform: createTransform({}),
|
|
16
|
+
groupBy: 'type',
|
|
17
|
+
commitGroupsSort: 'title',
|
|
18
|
+
commitsSort: ['scope', 'subject'],
|
|
19
|
+
noteGroupsSort: 'title',
|
|
20
|
+
mainTemplate: template,
|
|
21
|
+
headerPartial: header,
|
|
22
|
+
commitPartial: commit.replace(/{{gitUserInfo}}/g, author),
|
|
23
|
+
footerPartial: footer,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default writerOpts;
|
package/src/index.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
/* eslint-disable import/no-import-module-exports */
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
3
4
|
import { RuleConfigSeverity, type QualifiedRules, type LintOptions } from '@commitlint/types';
|
|
4
|
-
import
|
|
5
|
+
import conventionalChangelog from './conventional-changelog/index.js';
|
|
5
6
|
import { gitmojiPlugin } from './plugin.js';
|
|
6
7
|
|
|
7
8
|
const { Error, Warning, Disabled } = RuleConfigSeverity;
|
|
8
9
|
|
|
9
10
|
const parserPreset: LintOptions = {
|
|
10
|
-
parserOpts:
|
|
11
|
-
// eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals
|
|
12
|
-
headerPattern: new RegExp(`^(:\\w*:|${Gitmoji.reEmoji.source}) (?:\\((.*)\\):? )?(.*)$`), /// ^(:\w*:) (?:\((.*)\) )?(.*)$/,
|
|
13
|
-
headerCorrespondence: ['type', 'scope', 'subject'],
|
|
14
|
-
},
|
|
11
|
+
parserOpts: conventionalChangelog.parserOpts,
|
|
15
12
|
};
|
|
16
13
|
|
|
17
14
|
const rules: QualifiedRules = {
|
package/src/plugin.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
import { Plugin, Rule, RuleConfigCondition } from '@commitlint/types';
|
|
2
|
-
import {
|
|
3
|
+
import { GitmojiCode } from './conventional-changelog/gitmoji';
|
|
3
4
|
|
|
4
5
|
const $if =
|
|
5
6
|
(when: RuleConfigCondition | undefined = 'always') =>
|
|
@@ -7,8 +8,8 @@ const $if =
|
|
|
7
8
|
when === 'always' ? cond : !cond;
|
|
8
9
|
|
|
9
10
|
export const typeGitmojiStyle: Rule<'unicode' | 'emoji'> = (parsed, when = 'always', value = 'unicode') => {
|
|
10
|
-
const isUnicode = parsed.type != null &&
|
|
11
|
-
const isEmoji = parsed.type != null &&
|
|
11
|
+
const isUnicode = parsed.type != null && GitmojiCode.isUnicode(parsed.type);
|
|
12
|
+
const isEmoji = parsed.type != null && GitmojiCode.isEmoji(parsed.type);
|
|
12
13
|
|
|
13
14
|
return value === 'unicode'
|
|
14
15
|
? $if(when)(isUnicode)
|
|
@@ -20,7 +21,7 @@ export const typeGitmojiStyle: Rule<'unicode' | 'emoji'> = (parsed, when = 'alwa
|
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export const typeValidGitmoji: Rule = (parsed, when = 'always') => {
|
|
23
|
-
const isValidGitmoji = parsed.type != null &&
|
|
24
|
+
const isValidGitmoji = parsed.type != null && GitmojiCode.isValid(parsed.type);
|
|
24
25
|
|
|
25
26
|
return $if(when)(isValidGitmoji)
|
|
26
27
|
? [true]
|
package/lib/gitmoji.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type Gitmoji = Gitmoji.Unicode | Gitmoji.Emoji;
|
|
2
|
-
export declare namespace Gitmoji {
|
|
3
|
-
type Unicode = string & {
|
|
4
|
-
'@@GitmojiStyle': 'unicode';
|
|
5
|
-
};
|
|
6
|
-
type Emoji = string & {
|
|
7
|
-
'@@GitmojiStyle': 'emoji';
|
|
8
|
-
};
|
|
9
|
-
const reEmoji: RegExp;
|
|
10
|
-
function isUnicode(anyValue: string): anyValue is Unicode;
|
|
11
|
-
function isEmoji(anyValue: string): anyValue is Emoji;
|
|
12
|
-
function isValid(anyValue: string): anyValue is Gitmoji;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=gitmoji.d.ts.map
|
package/lib/gitmoji.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitmoji.d.ts","sourceRoot":"","sources":["../src/gitmoji.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;AACtD,yBAAiB,OAAO,CAAC;IACvB,KAAY,OAAO,GAAG,MAAM,GAAG;QAAE,gBAAgB,EAAE,SAAS,CAAA;KAAE,CAAC;IAC/D,KAAY,KAAK,GAAG,MAAM,GAAG;QAAE,gBAAgB,EAAE,OAAO,CAAA;KAAE,CAAC;IAEpD,MAAM,OAAO,QAAgB,CAAC;IAOrC,SAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,OAAO,CAE/D;IAED,SAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,KAAK,CAE3D;IAED,SAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,OAAO,CAE7D;CACF"}
|
package/lib/gitmoji.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Gitmoji = void 0;
|
|
7
|
-
var emoji_regex_1 = __importDefault(require("emoji-regex"));
|
|
8
|
-
var gitmojis_1 = require("gitmojis");
|
|
9
|
-
var Gitmoji;
|
|
10
|
-
(function (Gitmoji) {
|
|
11
|
-
Gitmoji.reEmoji = (0, emoji_regex_1.default)();
|
|
12
|
-
var reGitmoji = new RegExp("^".concat(Gitmoji.reEmoji.source, "$"), Gitmoji.reEmoji.flags);
|
|
13
|
-
var allGitmojiCodes = new Set(gitmojis_1.gitmojis.map(function (gitmoji) { return gitmoji.code; }).concat(gitmojis_1.gitmojis.map(function (gitmoji) { return gitmoji.emoji; })));
|
|
14
|
-
function isUnicode(anyValue) {
|
|
15
|
-
return anyValue.match(reGitmoji) != null;
|
|
16
|
-
}
|
|
17
|
-
Gitmoji.isUnicode = isUnicode;
|
|
18
|
-
function isEmoji(anyValue) {
|
|
19
|
-
return anyValue.match(/^:(\w+):$/) != null;
|
|
20
|
-
}
|
|
21
|
-
Gitmoji.isEmoji = isEmoji;
|
|
22
|
-
function isValid(anyValue) {
|
|
23
|
-
return allGitmojiCodes.has(anyValue);
|
|
24
|
-
}
|
|
25
|
-
Gitmoji.isValid = isValid;
|
|
26
|
-
})(Gitmoji = exports.Gitmoji || (exports.Gitmoji = {}));
|
|
27
|
-
//# sourceMappingURL=gitmoji.js.map
|
package/lib/gitmoji.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitmoji.js","sourceRoot":"","sources":["../src/gitmoji.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAsC;AACtC,qCAAoC;AAGpC,IAAiB,OAAO,CAsBvB;AAtBD,WAAiB,OAAO;IAIT,eAAO,GAAG,IAAA,qBAAW,GAAE,CAAC;IAErC,IAAM,SAAS,GAAG,IAAI,MAAM,CAAC,WAAI,QAAA,OAAO,CAAC,MAAM,MAAG,EAAE,QAAA,OAAO,CAAC,KAAK,CAAC,CAAC;IACnE,IAAM,eAAe,GAAG,IAAI,GAAG,CAC7B,mBAAQ,CAAC,GAAG,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,IAAI,EAAZ,CAAY,CAAC,CAAC,MAAM,CAAC,mBAAQ,CAAC,GAAG,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,KAAK,EAAb,CAAa,CAAC,CAAC,CACzF,CAAC;IAEF,SAAgB,SAAS,CAAC,QAAgB;QACxC,OAAO,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;IAC3C,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,SAAgB,OAAO,CAAC,QAAgB;QACtC,OAAO,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC;IAC7C,CAAC;IAFe,eAAO,UAEtB,CAAA;IAED,SAAgB,OAAO,CAAC,QAAgB;QACtC,OAAO,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAFe,eAAO,UAEtB,CAAA;AACH,CAAC,EAtBgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAsBvB"}
|
package/src/gitmoji.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import emojiRegexp from 'emoji-regex';
|
|
2
|
-
import { gitmojis } from 'gitmojis';
|
|
3
|
-
|
|
4
|
-
export type Gitmoji = Gitmoji.Unicode | Gitmoji.Emoji;
|
|
5
|
-
export namespace Gitmoji {
|
|
6
|
-
export type Unicode = string & { '@@GitmojiStyle': 'unicode' };
|
|
7
|
-
export type Emoji = string & { '@@GitmojiStyle': 'emoji' };
|
|
8
|
-
|
|
9
|
-
export const reEmoji = emojiRegexp();
|
|
10
|
-
|
|
11
|
-
const reGitmoji = new RegExp(`^${reEmoji.source}$`, reEmoji.flags);
|
|
12
|
-
const allGitmojiCodes = new Set(
|
|
13
|
-
gitmojis.map((gitmoji) => gitmoji.code).concat(gitmojis.map((gitmoji) => gitmoji.emoji))
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export function isUnicode(anyValue: string): anyValue is Unicode {
|
|
17
|
-
return anyValue.match(reGitmoji) != null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function isEmoji(anyValue: string): anyValue is Emoji {
|
|
21
|
-
return anyValue.match(/^:(\w+):$/) != null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function isValid(anyValue: string): anyValue is Gitmoji {
|
|
25
|
-
return allGitmojiCodes.has(anyValue);
|
|
26
|
-
}
|
|
27
|
-
}
|