@w5s/commitlint-config 1.0.6 → 1.0.8
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/index.d.ts +0 -1
- package/lib/index.js +2 -3
- package/lib/plugin.d.ts +0 -1
- package/lib/plugin.js +4 -5
- package/package.json +5 -8
- package/src/index.ts +3 -3
- package/src/plugin.ts +3 -3
- package/lib/conventional-changelog/data.d.ts +0 -28
- package/lib/conventional-changelog/data.d.ts.map +0 -1
- package/lib/conventional-changelog/data.js +0 -85
- package/lib/conventional-changelog/data.js.map +0 -1
- package/lib/conventional-changelog/gitmoji.d.ts +0 -13
- package/lib/conventional-changelog/gitmoji.d.ts.map +0 -1
- package/lib/conventional-changelog/gitmoji.js +0 -62
- package/lib/conventional-changelog/gitmoji.js.map +0 -1
- package/lib/conventional-changelog/index.d.ts +0 -5
- package/lib/conventional-changelog/index.d.ts.map +0 -1
- package/lib/conventional-changelog/index.js +0 -10
- package/lib/conventional-changelog/index.js.map +0 -1
- package/lib/conventional-changelog/parser-opts.d.ts +0 -4
- package/lib/conventional-changelog/parser-opts.d.ts.map +0 -1
- package/lib/conventional-changelog/parser-opts.js +0 -13
- package/lib/conventional-changelog/parser-opts.js.map +0 -1
- package/lib/conventional-changelog/transform.d.ts +0 -21
- package/lib/conventional-changelog/transform.d.ts.map +0 -1
- package/lib/conventional-changelog/transform.js +0 -91
- package/lib/conventional-changelog/transform.js.map +0 -1
- package/lib/conventional-changelog/writer-opts.d.ts +0 -4
- package/lib/conventional-changelog/writer-opts.d.ts.map +0 -1
- package/lib/conventional-changelog/writer-opts.js +0 -24
- package/lib/conventional-changelog/writer-opts.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/plugin.d.ts.map +0 -1
- package/lib/plugin.js.map +0 -1
- package/src/conventional-changelog/data.ts +0 -112
- package/src/conventional-changelog/gitmoji.ts +0 -73
- package/src/conventional-changelog/index.ts +0 -5
- package/src/conventional-changelog/parser-opts.ts +0 -12
- package/src/conventional-changelog/transform.ts +0 -122
- package/src/conventional-changelog/writer-opts.ts +0 -26
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const types_1 = require("@commitlint/types");
|
|
7
|
-
const
|
|
7
|
+
const conventional_changelog_1 = __importDefault(require("@w5s/conventional-changelog"));
|
|
8
8
|
const plugin_js_1 = require("./plugin.js");
|
|
9
9
|
const { Error, Warning, Disabled } = types_1.RuleConfigSeverity;
|
|
10
10
|
const parserPreset = {
|
|
11
|
-
parserOpts:
|
|
11
|
+
parserOpts: conventional_changelog_1.default.parserOpts,
|
|
12
12
|
};
|
|
13
13
|
const rules = {
|
|
14
14
|
'body-leading-blank': [Warning, 'always'],
|
|
@@ -33,4 +33,3 @@ const config = {
|
|
|
33
33
|
plugins: [plugin_js_1.gitmojiPlugin],
|
|
34
34
|
};
|
|
35
35
|
exports.default = config;
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
package/lib/plugin.d.ts
CHANGED
package/lib/plugin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.gitmojiPlugin = exports.typeValidGitmoji = exports.typeGitmojiStyle = void 0;
|
|
4
|
-
const
|
|
4
|
+
const gitmoji_js_1 = require("@w5s/conventional-changelog/lib/gitmoji.js");
|
|
5
5
|
const $if = (when = 'always') => (cond) => when === 'always' ? cond : !cond;
|
|
6
6
|
const typeGitmojiStyle = (parsed, when = 'always', value = 'unicode') => {
|
|
7
|
-
const isUnicode = parsed.type != null &&
|
|
8
|
-
const isEmoji = parsed.type != null &&
|
|
7
|
+
const isUnicode = parsed.type != null && gitmoji_js_1.Emoji.isUnicode(parsed.type);
|
|
8
|
+
const isEmoji = parsed.type != null && gitmoji_js_1.Emoji.isText(parsed.type);
|
|
9
9
|
return value === 'unicode'
|
|
10
10
|
? $if(when)(isUnicode)
|
|
11
11
|
? [true]
|
|
@@ -16,7 +16,7 @@ const typeGitmojiStyle = (parsed, when = 'always', value = 'unicode') => {
|
|
|
16
16
|
};
|
|
17
17
|
exports.typeGitmojiStyle = typeGitmojiStyle;
|
|
18
18
|
const typeValidGitmoji = (parsed, when = 'always') => {
|
|
19
|
-
const isValidGitmoji = parsed.type != null &&
|
|
19
|
+
const isValidGitmoji = parsed.type != null && gitmoji_js_1.GitmojiCode.isValid(parsed.type);
|
|
20
20
|
return $if(when)(isValidGitmoji)
|
|
21
21
|
? [true]
|
|
22
22
|
: [false, `Type should ${when} be an valid gitmoji (see https://gitmoji.dev)`];
|
|
@@ -31,4 +31,3 @@ exports.gitmojiPlugin = {
|
|
|
31
31
|
'type-valid-gitmoji': exports.typeValidGitmoji,
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=plugin.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/commitlint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Commitlint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commitlint",
|
|
@@ -65,14 +65,11 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@commitlint/types": "^17.0.0",
|
|
68
|
-
"
|
|
69
|
-
"gitmojis": "^3.13.0"
|
|
68
|
+
"@w5s/conventional-changelog": "^1.0.0-alpha.1"
|
|
70
69
|
},
|
|
71
70
|
"devDependencies": {
|
|
72
|
-
"@commitlint/lint": "17.4.
|
|
73
|
-
"@jest/globals": "29.
|
|
74
|
-
"@types/conventional-changelog-writer": "4.0.2",
|
|
75
|
-
"@types/conventional-commits-parser": "3.0.3"
|
|
71
|
+
"@commitlint/lint": "17.4.2",
|
|
72
|
+
"@jest/globals": "29.4.1"
|
|
76
73
|
},
|
|
77
74
|
"peerDependencies": {
|
|
78
75
|
"@commitlint/cli": "^16.0.0 || ^17.0.0"
|
|
@@ -88,5 +85,5 @@
|
|
|
88
85
|
"publishConfig": {
|
|
89
86
|
"access": "public"
|
|
90
87
|
},
|
|
91
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "dd093c2907cf8e136f4adec9a14b176e0851de17"
|
|
92
89
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { RuleConfigSeverity, type QualifiedRules, type LintOptions } from '@commitlint/types';
|
|
2
|
-
import conventionalChangelog from '
|
|
1
|
+
import { RuleConfigSeverity, type QualifiedRules, type LintOptions, ParserOptions } from '@commitlint/types';
|
|
2
|
+
import conventionalChangelog from '@w5s/conventional-changelog';
|
|
3
3
|
import { gitmojiPlugin } from './plugin.js';
|
|
4
4
|
|
|
5
5
|
const { Error, Warning, Disabled } = RuleConfigSeverity;
|
|
6
6
|
|
|
7
7
|
const parserPreset: LintOptions = {
|
|
8
|
-
parserOpts: conventionalChangelog.parserOpts,
|
|
8
|
+
parserOpts: conventionalChangelog.parserOpts as ParserOptions,
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const rules: QualifiedRules = {
|
package/src/plugin.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin, Rule, RuleConfigCondition } from '@commitlint/types';
|
|
2
|
-
import { GitmojiCode } from '
|
|
2
|
+
import { Emoji, GitmojiCode } from '@w5s/conventional-changelog/lib/gitmoji.js';
|
|
3
3
|
|
|
4
4
|
const $if =
|
|
5
5
|
(when: RuleConfigCondition | undefined = 'always') =>
|
|
@@ -7,8 +7,8 @@ const $if =
|
|
|
7
7
|
when === 'always' ? cond : !cond;
|
|
8
8
|
|
|
9
9
|
export const typeGitmojiStyle: Rule<'unicode' | 'emoji'> = (parsed, when = 'always', value = 'unicode') => {
|
|
10
|
-
const isUnicode = parsed.type != null &&
|
|
11
|
-
const isEmoji = parsed.type != null &&
|
|
10
|
+
const isUnicode = parsed.type != null && Emoji.isUnicode(parsed.type);
|
|
11
|
+
const isEmoji = parsed.type != null && Emoji.isText(parsed.type);
|
|
12
12
|
|
|
13
13
|
return value === 'unicode'
|
|
14
14
|
? $if(when)(isUnicode)
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/conventional-changelog/data.ts"],"names":[],"mappings":"AAAA,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"}
|
|
@@ -1,85 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/conventional-changelog/data.ts"],"names":[],"mappings":";;;AAoBa,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;QACZ,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,KAAK;QACV,KAAK,EAAE,OAAO;KACf,CAAC,CAAC;IACH,MAAM,UAAU,GAAsC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACtG,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAE1C,MAAM,QAAQ,GAA+D;QAC3E,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,UAAU;SACpB;QACD,GAAG,EAAE;YACH,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,WAAW;SACrB;QACD,KAAK,EAAE;YACL,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,cAAc;SACxB;QACD,KAAK,EAAE;YACL,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,QAAQ;SAClB;QACD,EAAE,EAAE;YACF,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,wBAAwB;SAClC;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,eAAe;SACzB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,OAAO;SACjB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,0BAA0B;SACpC;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,kBAAkB;SAC5B;QACD,MAAM,EAAE;YACN,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,SAAS;SACnB;QACD,KAAK,EAAE;YACL,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,QAAQ;SAClB;QACD,GAAG,EAAE;YACH,KAAK,EAAE,IAAI;YACX,OAAO,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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitmoji.d.ts","sourceRoot":"","sources":["../../src/conventional-changelog/gitmoji.ts"],"names":[],"mappings":"AACA,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"}
|
|
@@ -1,62 +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.GitmojiCode = void 0;
|
|
7
|
-
const emoji_regex_1 = __importDefault(require("emoji-regex"));
|
|
8
|
-
const gitmojis_1 = require("gitmojis");
|
|
9
|
-
var GitmojiCode;
|
|
10
|
-
(function (GitmojiCode) {
|
|
11
|
-
GitmojiCode.reEmoji = (0, emoji_regex_1.default)();
|
|
12
|
-
const reGitmoji = new RegExp(`^${GitmojiCode.reEmoji.source}$`, GitmojiCode.reEmoji.flags);
|
|
13
|
-
const allGitmojiCodes = new Set(gitmojis_1.gitmojis.map((gitmoji) => gitmoji.code).concat(gitmojis_1.gitmojis.map((gitmoji) => gitmoji.emoji)));
|
|
14
|
-
const index = {
|
|
15
|
-
// code: createIndex(gitmojis, 'code'),
|
|
16
|
-
emoji: createIndex(gitmojis_1.gitmojis, 'emoji'),
|
|
17
|
-
};
|
|
18
|
-
function createIndex(list, key) {
|
|
19
|
-
return new Map(list.map((gitmoji) => [gitmoji[key], gitmoji]));
|
|
20
|
-
}
|
|
21
|
-
function isUnicode(anyValue) {
|
|
22
|
-
return anyValue.match(reGitmoji) != null;
|
|
23
|
-
}
|
|
24
|
-
GitmojiCode.isUnicode = isUnicode;
|
|
25
|
-
function isEmoji(anyValue) {
|
|
26
|
-
return anyValue.match(/^:(\w+):$/) != null;
|
|
27
|
-
}
|
|
28
|
-
GitmojiCode.isEmoji = isEmoji;
|
|
29
|
-
function isValid(anyValue) {
|
|
30
|
-
return allGitmojiCodes.has(anyValue);
|
|
31
|
-
}
|
|
32
|
-
GitmojiCode.isValid = isValid;
|
|
33
|
-
const defaultType = 'chore';
|
|
34
|
-
const conversionMap = (() => {
|
|
35
|
-
const data = {
|
|
36
|
-
feat: ['✨', '♿️', '🚸'],
|
|
37
|
-
fix: ['🐛'],
|
|
38
|
-
docs: ['📝'],
|
|
39
|
-
style: ['🎨', '🚨'],
|
|
40
|
-
refactor: ['♻️', '🏗️'],
|
|
41
|
-
test: ['✅'],
|
|
42
|
-
perf: ['⚡️'],
|
|
43
|
-
revert: ['⏪️'],
|
|
44
|
-
ci: ['👷', '💚'],
|
|
45
|
-
wip: ['🚧'],
|
|
46
|
-
build: [],
|
|
47
|
-
chore: [],
|
|
48
|
-
};
|
|
49
|
-
const entries = Array.from(
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
Object.entries(data));
|
|
52
|
-
return new Map(entries.reduce((acc, [commitType, gitmojiUnicodeArray]) => acc
|
|
53
|
-
.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [gitmojiUnicode, commitType]))
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
55
|
-
.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [index.emoji.get(gitmojiUnicode)?.code, commitType])), []));
|
|
56
|
-
})();
|
|
57
|
-
function toConventionalCommitType(gitmoji) {
|
|
58
|
-
return conversionMap.get(gitmoji) ?? defaultType;
|
|
59
|
-
}
|
|
60
|
-
GitmojiCode.toConventionalCommitType = toConventionalCommitType;
|
|
61
|
-
})(GitmojiCode = exports.GitmojiCode || (exports.GitmojiCode = {}));
|
|
62
|
-
//# sourceMappingURL=gitmoji.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitmoji.js","sourceRoot":"","sources":["../../src/conventional-changelog/gitmoji.ts"],"names":[],"mappings":";;;;;;AAAA,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,CAA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;YACzC,GAAG,EAAE,CAAC,IAAI,CAA0B;YACpC,KAAK,EAAE,EAA2B;YAClC,KAAK,EAAE,EAA2B;SACnC,CAAC;QAEF,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI;QACxB,aAAa;QACb,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CACrB,CAAC;QACF,OAAO,IAAI,GAAG,CACZ,OAAO,CAAC,MAAM,CACZ,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,mBAAmB,CAAC,EAAE,EAAE,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conventional-changelog/index.ts"],"names":[],"mappings":";;;AAEA,wBAEE"}
|
|
@@ -1,10 +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
|
-
const parser_opts_1 = __importDefault(require("./parser-opts"));
|
|
7
|
-
exports.default = {
|
|
8
|
-
parserOpts: parser_opts_1.default,
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,91 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;QAC1B,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,IAAI;YACpC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAND,oCAMC;AAED,SAAgB,WAAW,CAAC,IAA4B,EAAE,UAA+B,EAAE;IACzF,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC;IAEzD,IAAI,gCAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;QAC5C,MAAM,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,gCAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1E,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;KAClD;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AATD,kCASC;AAQD,SAAgB,eAAe,CAAC,MAAuB;IACrD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,gCAAsB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAClH,MAAM,UAAU,GAAG,CAAC,IAAwB,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC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,EAAE,OAUjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA4B9F,QAAA,MAAM,MAAM;;;;CAIX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,6CAA8F;AAC9F,iFAAsE;AACtE,2CAA4C;AAE5C,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,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AK,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"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { Commit as CommitDefault } from 'conventional-commits-parser';
|
|
2
|
-
|
|
3
|
-
export type Commit = CommitDefault<never> & {
|
|
4
|
-
hash?: string;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type CommitConventionalType =
|
|
8
|
-
| 'build'
|
|
9
|
-
| 'ci'
|
|
10
|
-
| 'docs'
|
|
11
|
-
| 'feat'
|
|
12
|
-
| 'fix'
|
|
13
|
-
| 'perf'
|
|
14
|
-
| 'refactor'
|
|
15
|
-
| 'revert'
|
|
16
|
-
| 'style'
|
|
17
|
-
| 'test'
|
|
18
|
-
| 'wip'
|
|
19
|
-
| 'chore';
|
|
20
|
-
|
|
21
|
-
export const CommitConventionalType = (() => {
|
|
22
|
-
const enumObject = Object.freeze({
|
|
23
|
-
Build: 'build',
|
|
24
|
-
CI: 'ci',
|
|
25
|
-
Docs: 'docs',
|
|
26
|
-
Feat: 'feat',
|
|
27
|
-
Fix: 'fix',
|
|
28
|
-
Perf: 'perf',
|
|
29
|
-
Refactor: 'refactor',
|
|
30
|
-
Revert: 'revert',
|
|
31
|
-
Style: 'style',
|
|
32
|
-
Test: 'test',
|
|
33
|
-
WIP: 'wip',
|
|
34
|
-
Chore: 'chore',
|
|
35
|
-
});
|
|
36
|
-
const enumValues: readonly CommitConventionalType[] = Object.freeze(Object.values(enumObject).sort());
|
|
37
|
-
const enumValuesSet = new Set(enumValues);
|
|
38
|
-
|
|
39
|
-
const typeData: Record<CommitConventionalType, CommitConventionalTypeData> = {
|
|
40
|
-
feat: {
|
|
41
|
-
emoji: '✨',
|
|
42
|
-
'en-US': 'Features',
|
|
43
|
-
},
|
|
44
|
-
fix: {
|
|
45
|
-
emoji: '🐛',
|
|
46
|
-
'en-US': 'Bug Fixes',
|
|
47
|
-
},
|
|
48
|
-
build: {
|
|
49
|
-
emoji: '👷',
|
|
50
|
-
'en-US': 'Build System',
|
|
51
|
-
},
|
|
52
|
-
chore: {
|
|
53
|
-
emoji: '🎫',
|
|
54
|
-
'en-US': 'Chores',
|
|
55
|
-
},
|
|
56
|
-
ci: {
|
|
57
|
-
emoji: '🔧',
|
|
58
|
-
'en-US': 'Continuous Integration',
|
|
59
|
-
},
|
|
60
|
-
docs: {
|
|
61
|
-
emoji: '📝',
|
|
62
|
-
'en-US': 'Documentation',
|
|
63
|
-
},
|
|
64
|
-
test: {
|
|
65
|
-
emoji: '✅',
|
|
66
|
-
'en-US': 'Tests',
|
|
67
|
-
},
|
|
68
|
-
perf: {
|
|
69
|
-
emoji: '⚡',
|
|
70
|
-
'en-US': 'Performance Improvements',
|
|
71
|
-
},
|
|
72
|
-
refactor: {
|
|
73
|
-
emoji: '♻',
|
|
74
|
-
'en-US': 'Code Refactoring',
|
|
75
|
-
},
|
|
76
|
-
revert: {
|
|
77
|
-
emoji: '⏪',
|
|
78
|
-
'en-US': 'Reverts',
|
|
79
|
-
},
|
|
80
|
-
style: {
|
|
81
|
-
emoji: '💄',
|
|
82
|
-
'en-US': 'Styles',
|
|
83
|
-
},
|
|
84
|
-
wip: {
|
|
85
|
-
emoji: '🚧',
|
|
86
|
-
'en-US': 'Work in progress',
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
function hasInstance(anyValue: unknown): anyValue is CommitConventionalType {
|
|
91
|
-
return typeof anyValue === 'string' && enumValuesSet.has(anyValue as unknown as CommitConventionalType);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function getData(commitType: CommitConventionalType): CommitConventionalTypeData {
|
|
95
|
-
return typeData[commitType];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function parse(anyValue: string): CommitConventionalType | undefined {
|
|
99
|
-
return hasInstance(anyValue) ? anyValue : undefined;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function values() {
|
|
103
|
-
return enumValues;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return { ...enumObject, hasInstance, getData, values, parse };
|
|
107
|
-
})();
|
|
108
|
-
|
|
109
|
-
export interface CommitConventionalTypeData {
|
|
110
|
-
emoji: string;
|
|
111
|
-
'en-US': string;
|
|
112
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import emojiRegexp from 'emoji-regex';
|
|
2
|
-
import { Gitmoji, gitmojis, GitmojiUnicode, GitmojiEmoji } from 'gitmojis';
|
|
3
|
-
import type { CommitConventionalType } from './data';
|
|
4
|
-
|
|
5
|
-
export type GitmojiCode = GitmojiCode.Unicode | GitmojiCode.Emoji;
|
|
6
|
-
export namespace GitmojiCode {
|
|
7
|
-
export type Unicode = GitmojiUnicode;
|
|
8
|
-
export type Emoji = GitmojiEmoji;
|
|
9
|
-
|
|
10
|
-
export const reEmoji = emojiRegexp();
|
|
11
|
-
|
|
12
|
-
const reGitmoji = new RegExp(`^${reEmoji.source}$`, reEmoji.flags);
|
|
13
|
-
const allGitmojiCodes = new Set(
|
|
14
|
-
gitmojis.map((gitmoji) => gitmoji.code as GitmojiCode).concat(gitmojis.map((gitmoji) => gitmoji.emoji))
|
|
15
|
-
);
|
|
16
|
-
const index = {
|
|
17
|
-
// code: createIndex(gitmojis, 'code'),
|
|
18
|
-
emoji: createIndex(gitmojis, 'emoji'),
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function createIndex<K extends keyof Gitmoji>(list: readonly Gitmoji[], key: K): ReadonlyMap<Gitmoji[K], Gitmoji> {
|
|
22
|
-
return new Map(list.map((gitmoji) => [gitmoji[key], gitmoji]));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function isUnicode(anyValue: string): anyValue is Unicode {
|
|
26
|
-
return anyValue.match(reGitmoji) != null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function isEmoji(anyValue: string): anyValue is Emoji {
|
|
30
|
-
return anyValue.match(/^:(\w+):$/) != null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function isValid(anyValue: string): anyValue is GitmojiCode {
|
|
34
|
-
return allGitmojiCodes.has(anyValue as GitmojiCode);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const defaultType = 'chore';
|
|
38
|
-
const conversionMap: ReadonlyMap<GitmojiCode, CommitConventionalType> = (() => {
|
|
39
|
-
const data: Record<CommitConventionalType, GitmojiCode.Unicode[]> = {
|
|
40
|
-
feat: ['✨', '♿️', '🚸'] as GitmojiCode.Unicode[],
|
|
41
|
-
fix: ['🐛'] as GitmojiCode.Unicode[],
|
|
42
|
-
docs: ['📝'] as GitmojiCode.Unicode[],
|
|
43
|
-
style: ['🎨', '🚨'] as GitmojiCode.Unicode[],
|
|
44
|
-
refactor: ['♻️', '🏗️'] as GitmojiCode.Unicode[],
|
|
45
|
-
test: ['✅'] as GitmojiCode.Unicode[],
|
|
46
|
-
perf: ['⚡️'] as GitmojiCode.Unicode[],
|
|
47
|
-
revert: ['⏪️'] as GitmojiCode.Unicode[],
|
|
48
|
-
ci: ['👷', '💚'] as GitmojiCode.Unicode[],
|
|
49
|
-
wip: ['🚧'] as GitmojiCode.Unicode[],
|
|
50
|
-
build: [] as GitmojiCode.Unicode[],
|
|
51
|
-
chore: [] as GitmojiCode.Unicode[],
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const entries = Array.from<[CommitConventionalType, GitmojiCode.Unicode[]]>(
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
Object.entries(data)
|
|
57
|
-
);
|
|
58
|
-
return new Map(
|
|
59
|
-
entries.reduce<Array<[GitmojiCode, CommitConventionalType]>>(
|
|
60
|
-
(acc, [commitType, gitmojiUnicodeArray]) =>
|
|
61
|
-
acc
|
|
62
|
-
.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [gitmojiUnicode, commitType]))
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
64
|
-
.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [index.emoji.get(gitmojiUnicode)?.code!, commitType])),
|
|
65
|
-
[]
|
|
66
|
-
)
|
|
67
|
-
);
|
|
68
|
-
})();
|
|
69
|
-
|
|
70
|
-
export function toConventionalCommitType(gitmoji: GitmojiCode): CommitConventionalType {
|
|
71
|
-
return conversionMap.get(gitmoji) ?? defaultType;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,122 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
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;
|