@w5s/conventional-changelog 3.0.6 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,7 +38,7 @@ Extra rules
38
38
  "commitlint": {
39
39
  "rules": {
40
40
  // Rule to validate gitmoji unicode (🐛) or emoji (:bug:)
41
- "type-gitmoji-style": ["error", "always", "unicode" /* | 'emoji' */],
41
+ "type-gitmoji-style": ["error", "always", "unicode"],
42
42
  // Rule to validate a gitmoji in the list
43
43
  "type-valid-gitmoji": ["error", "always"]
44
44
  }
package/dist/index.d.ts CHANGED
@@ -1,84 +1,93 @@
1
- import { Commit as Commit$2, ParserOptions as ParserOptions$1 } from 'conventional-commits-parser';
2
- import { Options } from 'conventional-changelog-writer';
3
-
4
- type Commit$1 = Commit$2;
5
-
6
- type Commit = Commit$2 & {
7
- type: string | null;
8
- subject: string | null;
9
- scope: string | null;
10
- hash: string | null;
1
+ //#region src/meta.d.ts
2
+ declare const meta: Readonly<{
3
+ name: string;
4
+ version: string;
5
+ buildNumber: number;
6
+ }>;
7
+ //#endregion
8
+ //#region src/data.d.ts
9
+ type Commit$1 = CommitDefault & {
10
+ type: string | null;
11
+ subject: string | null;
12
+ scope: string | null;
13
+ hash: string | null;
11
14
  };
12
15
  type CommitConventionalType = 'build' | 'ci' | 'docs' | 'feat' | 'fix' | 'perf' | 'refactor' | 'revert' | 'style' | 'test' | 'wip' | 'chore';
13
16
  declare const CommitConventionalType: {
14
- hasInstance: (anyValue: unknown) => anyValue is CommitConventionalType;
15
- getData: (commitType: CommitConventionalType) => CommitConventionalTypeData;
16
- values: () => readonly CommitConventionalType[];
17
- parse: (anyValue: string) => CommitConventionalType | undefined;
18
- findWhere: (predicate: (data: CommitConventionalTypeData) => boolean) => CommitConventionalType[];
19
- Build: "build";
20
- CI: "ci";
21
- Docs: "docs";
22
- Feat: "feat";
23
- Fix: "fix";
24
- Perf: "perf";
25
- Refactor: "refactor";
26
- Revert: "revert";
27
- Style: "style";
28
- Test: "test";
29
- WIP: "wip";
30
- Chore: "chore";
17
+ hasInstance: (anyValue: unknown) => anyValue is CommitConventionalType;
18
+ getData: (commitType: CommitConventionalType) => CommitConventionalTypeData;
19
+ values: () => readonly CommitConventionalType[];
20
+ parse: (anyValue: string) => CommitConventionalType | undefined;
21
+ findWhere: (predicate: (data: CommitConventionalTypeData) => boolean) => CommitConventionalType[];
22
+ Build: "build";
23
+ CI: "ci";
24
+ Docs: "docs";
25
+ Feat: "feat";
26
+ Fix: "fix";
27
+ Perf: "perf";
28
+ Refactor: "refactor";
29
+ Revert: "revert";
30
+ Style: "style";
31
+ Test: "test";
32
+ WIP: "wip";
33
+ Chore: "chore";
31
34
  };
32
35
  interface CommitConventionalTypeData {
33
- 'emoji': string;
34
- 'en-US': string;
35
- 'changelog': boolean;
36
- }
37
-
38
- interface WriterOptions extends Options<Commit> {
39
- }
40
-
41
- interface ParserOptions extends ParserOptions$1 {
36
+ 'emoji': string;
37
+ 'en-US': string;
38
+ 'changelog': boolean;
42
39
  }
43
-
40
+ //#endregion
41
+ //#region src/gitmoji.d.ts
44
42
  type Emoji = Emoji.Unicode | Emoji.Text;
45
43
  declare namespace Emoji {
46
- const reEmojiUnicode: RegExp;
47
- const reEmojiText: RegExp;
48
- type Unicode = string & {
49
- '@@EmojiStyle': 'unicode';
50
- };
51
- type Text = string & {
52
- '@@EmojiStyle': 'text';
53
- };
54
- function isUnicode(anyValue: string): anyValue is Unicode;
55
- function isText(anyValue: string): anyValue is Text;
56
- function hasInstance(anyValue: string): anyValue is Emoji;
44
+ const reEmojiUnicode: RegExp;
45
+ const reEmojiText: RegExp;
46
+ type Unicode = string & {
47
+ '@@EmojiStyle': 'unicode';
48
+ };
49
+ type Text = string & {
50
+ '@@EmojiStyle': 'text';
51
+ };
52
+ function isUnicode(anyValue: string): anyValue is Unicode;
53
+ function isText(anyValue: string): anyValue is Text;
54
+ function hasInstance(anyValue: string): anyValue is Emoji;
57
55
  }
58
56
  type GitmojiCode = Emoji & {
59
- '@@Gitmoji': true;
57
+ '@@Gitmoji': true;
60
58
  };
61
59
  declare namespace GitmojiCode {
62
- type Unicode = Emoji.Unicode & {
63
- '@@Gitmoji': true;
64
- };
65
- type Emoji = Emoji.Text & {
66
- '@@Gitmoji': true;
67
- };
68
- function isValid(anyValue: string): anyValue is GitmojiCode;
69
- function toConventionalCommitType(gitmoji: GitmojiCode): CommitConventionalType;
60
+ type Unicode = Emoji.Unicode & {
61
+ '@@Gitmoji': true;
62
+ };
63
+ type Emoji = Emoji.Text & {
64
+ '@@Gitmoji': true;
65
+ };
66
+ function isValid(anyValue: string): anyValue is GitmojiCode;
67
+ function toConventionalCommitType(gitmoji: GitmojiCode): CommitConventionalType;
70
68
  }
71
-
69
+ //#endregion
70
+ //#region src/parser.d.ts
71
+ interface ParserOptions extends ParserOptionsDefault {}
72
+ //#endregion
73
+ //#region src/writer.d.ts
74
+ interface WriterOptions extends Options<Commit$1> {}
75
+ //#endregion
76
+ //#region src/whatBump.d.ts
77
+ type Commit = CommitBase;
78
+ //#endregion
79
+ //#region src/createPreset.d.ts
72
80
  declare function createPreset(): Promise<{
73
- gitRawCommitOpts: {
74
- format: string;
75
- };
76
- parser: ParserOptions;
77
- writer: WriterOptions;
78
- whatBump: (commits: ReadonlyArray<Commit$1>) => {
79
- level: number;
80
- reason: string;
81
- };
81
+ gitRawCommitOpts: {
82
+ format: string;
83
+ };
84
+ parser: ParserOptions;
85
+ writer: WriterOptions;
86
+ whatBump: (commits: ReadonlyArray<Commit>) => {
87
+ level: number;
88
+ reason: string;
89
+ };
82
90
  }>;
83
-
84
- export { Emoji, GitmojiCode, createPreset as default };
91
+ //#endregion
92
+ export { Emoji, GitmojiCode, createPreset as default, meta };
93
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,334 +1,320 @@
1
- import emojiRegexp from 'emoji-regex';
2
- import { gitmojis } from 'gitmojis';
3
- import { readFileSync } from 'fs';
4
- import nodePath from 'path';
5
- import { fileURLToPath } from 'url';
6
-
7
- // src/git-raw-commit-opts.ts
8
- var gitRawCommitOpts = {
9
- format: "%B%n-hash-%n%H%n-gitTags-%n%d%n-committerDate-%n%ci%n-authorName-%n%an%n-authorEmail-%n%ae"
10
- };
11
-
12
- // src/parser.ts
13
- var createParserOpts = () => ({
14
- headerPattern: new RegExp(
15
- // Type
16
- // eslint-disable-next-line unicorn/prefer-string-raw
17
- `^(?<type>\\S*)? (?:\\((?<scope>.*)\\):? )?(?<subject>.*)$`,
18
- "u"
19
- ),
20
- headerCorrespondence: ["type", "scope", "subject"],
21
- revertPattern: /^(?:revert|revert:)\s"?([\S\s]+?)"?\s*this reverts commit (\w*)\./i,
22
- noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES"],
23
- // revertPattern: /revert:\s([\S\s]*?)\s*this reverts commit (\w*)\./i,
24
- revertCorrespondence: [`header`, `hash`]
1
+ import emojiRegexp from "emoji-regex";
2
+ import { gitmojis } from "gitmojis";
3
+ import { readFileSync } from "node:fs";
4
+ import nodePath from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ //#region src/meta.ts
7
+ const meta = Object.freeze({
8
+ name: "@w5s/conventional-changelog",
9
+ version: "3.1.0",
10
+ buildNumber: 1
25
11
  });
26
-
27
- // src/data.ts
28
- var CommitConventionalType = (() => {
29
- const enumObject = Object.freeze({
30
- Build: "build",
31
- CI: "ci",
32
- Docs: "docs",
33
- Feat: "feat",
34
- Fix: "fix",
35
- Perf: "perf",
36
- Refactor: "refactor",
37
- Revert: "revert",
38
- Style: "style",
39
- Test: "test",
40
- WIP: "wip",
41
- Chore: "chore"
42
- });
43
- const enumValues = Object.freeze(Object.values(enumObject).sort());
44
- const enumValuesSet = new Set(enumValues);
45
- const typeData = {
46
- feat: {
47
- "emoji": "\u2728",
48
- "en-US": "Features",
49
- "changelog": true
50
- },
51
- fix: {
52
- "emoji": "\u{1F41B}",
53
- "en-US": "Bug Fixes",
54
- "changelog": true
55
- },
56
- build: {
57
- "emoji": "\u{1F477}",
58
- "en-US": "Build System",
59
- "changelog": false
60
- },
61
- chore: {
62
- "emoji": "\u{1F3AB}",
63
- "en-US": "Chores",
64
- "changelog": false
65
- },
66
- ci: {
67
- "emoji": "\u{1F527}",
68
- "en-US": "Continuous Integration",
69
- "changelog": false
70
- },
71
- docs: {
72
- "emoji": "\u{1F4DD}",
73
- "en-US": "Documentation",
74
- "changelog": false
75
- },
76
- test: {
77
- "emoji": "\u2705",
78
- "en-US": "Tests",
79
- "changelog": false
80
- },
81
- perf: {
82
- "emoji": "\u26A1",
83
- "en-US": "Performance Improvements",
84
- "changelog": true
85
- },
86
- refactor: {
87
- "emoji": "\u267B",
88
- "en-US": "Code Refactoring",
89
- "changelog": false
90
- },
91
- revert: {
92
- "emoji": "\u23EA",
93
- "en-US": "Reverts",
94
- "changelog": true
95
- },
96
- style: {
97
- "emoji": "\u{1F484}",
98
- "en-US": "Styles",
99
- "changelog": false
100
- },
101
- wip: {
102
- "emoji": "\u{1F6A7}",
103
- "en-US": "Work in progress",
104
- "changelog": false
105
- }
106
- };
107
- function hasInstance(anyValue) {
108
- return typeof anyValue === "string" && enumValuesSet.has(anyValue);
109
- }
110
- function getData(commitType) {
111
- return typeData[commitType];
112
- }
113
- function parse(anyValue) {
114
- return hasInstance(anyValue) ? anyValue : void 0;
115
- }
116
- function values() {
117
- return enumValues;
118
- }
119
- function findWhere(predicate) {
120
- return enumValues.filter((enumValue) => predicate(getData(enumValue)));
121
- }
122
- return { ...enumObject, hasInstance, getData, values, parse, findWhere };
123
- })();
124
- var Emoji;
125
- ((Emoji2) => {
126
- Emoji2.reEmojiUnicode = emojiRegexp();
127
- Emoji2.reEmojiText = /:\w*:/;
128
- const reMatchOnly = (input) => new RegExp(`^${input.source}$`, "");
129
- const _reEmojiUnicode = reMatchOnly(Emoji2.reEmojiUnicode);
130
- const _reEmojiText = reMatchOnly(Emoji2.reEmojiText);
131
- function isUnicode(anyValue) {
132
- return _reEmojiUnicode.test(anyValue);
133
- }
134
- Emoji2.isUnicode = isUnicode;
135
- function isText(anyValue) {
136
- return _reEmojiText.test(anyValue);
137
- }
138
- Emoji2.isText = isText;
139
- function hasInstance(anyValue) {
140
- return isText(anyValue) || isUnicode(anyValue);
141
- }
142
- Emoji2.hasInstance = hasInstance;
12
+ //#endregion
13
+ //#region src/gitmoji.ts
14
+ let Emoji;
15
+ (function(_Emoji) {
16
+ const reEmojiUnicode = _Emoji.reEmojiUnicode = emojiRegexp();
17
+ const reEmojiText = _Emoji.reEmojiText = /:\w*:/;
18
+ const reMatchOnly = (input) => new RegExp(`^${input.source}$`, "");
19
+ const _reEmojiUnicode = reMatchOnly(reEmojiUnicode);
20
+ const _reEmojiText = reMatchOnly(reEmojiText);
21
+ function isUnicode(anyValue) {
22
+ return _reEmojiUnicode.test(anyValue);
23
+ }
24
+ _Emoji.isUnicode = isUnicode;
25
+ function isText(anyValue) {
26
+ return _reEmojiText.test(anyValue);
27
+ }
28
+ _Emoji.isText = isText;
29
+ function hasInstance(anyValue) {
30
+ return isText(anyValue) || isUnicode(anyValue);
31
+ }
32
+ _Emoji.hasInstance = hasInstance;
143
33
  })(Emoji || (Emoji = {}));
144
- var GitmojiCode;
145
- ((GitmojiCode2) => {
146
- const allGitmojiCodes = new Set(
147
- gitmojis.map((gitmoji) => gitmoji.code).concat(gitmojis.map((gitmoji) => gitmoji.emoji))
148
- );
149
- const index = {
150
- // code: createIndex(gitmojis, 'code'),
151
- emoji: createIndex(gitmojis, "emoji")
152
- };
153
- function createIndex(list, key) {
154
- return new Map(list.map((gitmoji) => [gitmoji[key], gitmoji]));
155
- }
156
- function isValid(anyValue) {
157
- return allGitmojiCodes.has(anyValue);
158
- }
159
- GitmojiCode2.isValid = isValid;
160
- const defaultType = "chore";
161
- const conversionMap = (() => {
162
- const data = {
163
- feat: ["\u2728", "\u267F\uFE0F", "\u{1F6B8}"],
164
- fix: ["\u{1F41B}"],
165
- docs: ["\u{1F4DD}"],
166
- style: ["\u{1F3A8}", "\u{1F6A8}"],
167
- refactor: ["\u267B\uFE0F", "\u{1F3D7}\uFE0F"],
168
- test: ["\u2705", "\u{1F9EA}"],
169
- perf: ["\u26A1\uFE0F"],
170
- revert: ["\u23EA\uFE0F"],
171
- ci: ["\u{1F477}", "\u{1F49A}"],
172
- wip: ["\u{1F6A7}"],
173
- build: [],
174
- chore: ["\u{1F527}"]
175
- };
176
- const entries = Array.from(
177
- // @ts-ignore entries are not well typed
178
- Object.entries(data)
179
- );
180
- return new Map(
181
- entries.reduce(
182
- (acc, [commitType, gitmojiUnicodeArray]) => acc.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [gitmojiUnicode, commitType])).concat(
183
- gitmojiUnicodeArray.map((gitmojiUnicode) => [
184
- // eslint-disable-next-line ts/no-non-null-assertion, ts/no-non-null-asserted-optional-chain
185
- index.emoji.get(gitmojiUnicode)?.code,
186
- commitType
187
- ])
188
- ),
189
- []
190
- )
191
- );
192
- })();
193
- function toConventionalCommitType2(gitmoji) {
194
- return conversionMap.get(gitmoji) ?? defaultType;
195
- }
196
- GitmojiCode2.toConventionalCommitType = toConventionalCommitType2;
34
+ let GitmojiCode;
35
+ (function(_GitmojiCode) {
36
+ const allGitmojiCodes = new Set(gitmojis.map((gitmoji) => gitmoji.code).concat(gitmojis.map((gitmoji) => gitmoji.emoji)));
37
+ const index = { emoji: createIndex(gitmojis, "emoji") };
38
+ function createIndex(list, key) {
39
+ return new Map(list.map((gitmoji) => [gitmoji[key], gitmoji]));
40
+ }
41
+ function isValid(anyValue) {
42
+ return allGitmojiCodes.has(anyValue);
43
+ }
44
+ _GitmojiCode.isValid = isValid;
45
+ const defaultType = "chore";
46
+ const conversionMap = (() => {
47
+ const entries = Array.from(Object.entries({
48
+ feat: [
49
+ "✨",
50
+ "♿️",
51
+ "🚸"
52
+ ],
53
+ fix: ["🐛"],
54
+ docs: ["📝"],
55
+ style: ["🎨", "🚨"],
56
+ refactor: ["♻️", "🏗️"],
57
+ test: ["", "🧪"],
58
+ perf: ["⚡️"],
59
+ revert: ["⏪️"],
60
+ ci: ["👷", "💚"],
61
+ wip: ["🚧"],
62
+ build: [],
63
+ chore: ["🔧"]
64
+ }));
65
+ return new Map(entries.reduce((acc, [commitType, gitmojiUnicodeArray]) => acc.concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [gitmojiUnicode, commitType])).concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [index.emoji.get(gitmojiUnicode)?.code, commitType])), []));
66
+ })();
67
+ function toConventionalCommitType(gitmoji) {
68
+ return conversionMap.get(gitmoji) ?? defaultType;
69
+ }
70
+ _GitmojiCode.toConventionalCommitType = toConventionalCommitType;
197
71
  })(GitmojiCode || (GitmojiCode = {}));
198
-
199
- // src/whatBump.ts
72
+ //#endregion
73
+ //#region src/git-raw-commit-opts.ts
74
+ const gitRawCommitOpts = { format: "%B%n-hash-%n%H%n-gitTags-%n%d%n-committerDate-%n%ci%n-authorName-%n%an%n-authorEmail-%n%ae" };
75
+ //#endregion
76
+ //#region src/parser.ts
77
+ const createParserOpts = () => ({
78
+ headerPattern: /* @__PURE__ */ new RegExp("^(?<type>\\S*)? (?:\\((?<scope>.*)\\):? )?(?<subject>.*)$", "u"),
79
+ headerCorrespondence: [
80
+ "type",
81
+ "scope",
82
+ "subject"
83
+ ],
84
+ revertPattern: /^(?:revert|revert:)\s"?([\S\s]+?)"?\s*this reverts commit (\w*)\./i,
85
+ noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES"],
86
+ revertCorrespondence: [`header`, `hash`]
87
+ });
88
+ //#endregion
89
+ //#region src/data.ts
90
+ const CommitConventionalType = (() => {
91
+ const enumObject = Object.freeze({
92
+ Build: "build",
93
+ CI: "ci",
94
+ Docs: "docs",
95
+ Feat: "feat",
96
+ Fix: "fix",
97
+ Perf: "perf",
98
+ Refactor: "refactor",
99
+ Revert: "revert",
100
+ Style: "style",
101
+ Test: "test",
102
+ WIP: "wip",
103
+ Chore: "chore"
104
+ });
105
+ const enumValues = Object.freeze(Object.values(enumObject).sort());
106
+ const enumValuesSet = new Set(enumValues);
107
+ const typeData = {
108
+ feat: {
109
+ "emoji": "✨",
110
+ "en-US": "Features",
111
+ "changelog": true
112
+ },
113
+ fix: {
114
+ "emoji": "🐛",
115
+ "en-US": "Bug Fixes",
116
+ "changelog": true
117
+ },
118
+ build: {
119
+ "emoji": "👷",
120
+ "en-US": "Build System",
121
+ "changelog": false
122
+ },
123
+ chore: {
124
+ "emoji": "🎫",
125
+ "en-US": "Chores",
126
+ "changelog": false
127
+ },
128
+ ci: {
129
+ "emoji": "🔧",
130
+ "en-US": "Continuous Integration",
131
+ "changelog": false
132
+ },
133
+ docs: {
134
+ "emoji": "📝",
135
+ "en-US": "Documentation",
136
+ "changelog": false
137
+ },
138
+ test: {
139
+ "emoji": "✅",
140
+ "en-US": "Tests",
141
+ "changelog": false
142
+ },
143
+ perf: {
144
+ "emoji": "⚡",
145
+ "en-US": "Performance Improvements",
146
+ "changelog": true
147
+ },
148
+ refactor: {
149
+ "emoji": "♻",
150
+ "en-US": "Code Refactoring",
151
+ "changelog": false
152
+ },
153
+ revert: {
154
+ "emoji": "⏪",
155
+ "en-US": "Reverts",
156
+ "changelog": true
157
+ },
158
+ style: {
159
+ "emoji": "💄",
160
+ "en-US": "Styles",
161
+ "changelog": false
162
+ },
163
+ wip: {
164
+ "emoji": "🚧",
165
+ "en-US": "Work in progress",
166
+ "changelog": false
167
+ }
168
+ };
169
+ function hasInstance(anyValue) {
170
+ return typeof anyValue === "string" && enumValuesSet.has(anyValue);
171
+ }
172
+ function getData(commitType) {
173
+ return typeData[commitType];
174
+ }
175
+ function parse(anyValue) {
176
+ return hasInstance(anyValue) ? anyValue : void 0;
177
+ }
178
+ function values() {
179
+ return enumValues;
180
+ }
181
+ function findWhere(predicate) {
182
+ return enumValues.filter((enumValue) => predicate(getData(enumValue)));
183
+ }
184
+ return {
185
+ ...enumObject,
186
+ hasInstance,
187
+ getData,
188
+ values,
189
+ parse,
190
+ findWhere
191
+ };
192
+ })();
193
+ //#endregion
194
+ //#region src/whatBump.ts
200
195
  function toConventionalCommitType(text) {
201
- return GitmojiCode.isValid(text) ? GitmojiCode.toConventionalCommitType(text) : CommitConventionalType.hasInstance(text) ? text : void 0;
196
+ return GitmojiCode.isValid(text) ? GitmojiCode.toConventionalCommitType(text) : CommitConventionalType.hasInstance(text) ? text : void 0;
202
197
  }
203
- var whatBump = (commits) => {
204
- let level = 2;
205
- let breakings = 0;
206
- let features = 0;
207
- for (const { type, notes } of commits) {
208
- const conventionalType = type == null ? type : toConventionalCommitType(type);
209
- if (notes.length > 0) {
210
- breakings += notes.length;
211
- level = 0;
212
- } else if (conventionalType === CommitConventionalType.Feat) {
213
- features += 1;
214
- if (level === 2) {
215
- level = 1;
216
- }
217
- }
218
- }
219
- return {
220
- level,
221
- reason: breakings === 1 ? `There is ${breakings} BREAKING CHANGE and ${features} features` : `There are ${breakings} BREAKING CHANGES and ${features} features`
222
- };
198
+ const whatBump = (commits) => {
199
+ let level = 2;
200
+ let breakings = 0;
201
+ let features = 0;
202
+ for (const { type, notes } of commits) {
203
+ const conventionalType = type == null ? type : toConventionalCommitType(type);
204
+ if (notes.length > 0) {
205
+ breakings += notes.length;
206
+ level = 0;
207
+ } else if (conventionalType === CommitConventionalType.Feat) {
208
+ features += 1;
209
+ if (level === 2) level = 1;
210
+ }
211
+ }
212
+ return {
213
+ level,
214
+ reason: breakings === 1 ? `There is ${breakings} BREAKING CHANGE and ${features} features` : `There are ${breakings} BREAKING CHANGES and ${features} features`
215
+ };
223
216
  };
224
-
225
- // src/transform.ts
217
+ //#endregion
218
+ //#region src/transform.ts
226
219
  function displayScope(scope, scopeDisplayNameMap) {
227
- return scope == null || scope.length === 0 ? scopeDisplayNameMap["*"] : scopeDisplayNameMap[scope] == null ? scope : scopeDisplayNameMap[scope];
220
+ return scope == null || scope.length === 0 ? scopeDisplayNameMap["*"] : scopeDisplayNameMap[scope] == null ? scope : scopeDisplayNameMap[scope];
228
221
  }
229
222
  function displayType(type, options = {}) {
230
- const { withEmoji = true, language = "en-US" } = options;
231
- if (CommitConventionalType.hasInstance(type)) {
232
- const { emoji, [language]: title } = CommitConventionalType.getData(type);
233
- return `${withEmoji ? `${emoji} ` : ""}${title}`;
234
- }
235
- return type;
223
+ const { withEmoji = true, language = "en-US" } = options;
224
+ if (CommitConventionalType.hasInstance(type)) {
225
+ const { emoji, [language]: title } = CommitConventionalType.getData(type);
226
+ return `${withEmoji ? `${emoji} ` : ""}${title}`;
227
+ }
228
+ return type;
236
229
  }
237
230
  function createTransform(config) {
238
- const displayTypes = new Set(config.displayTypes == null ? CommitConventionalType.values() : config.displayTypes);
239
- const ignoreType = (type) => type == null || !displayTypes.has(type);
240
- const ignoreScope = (scope) => config.displayScopes == null ? false : scope != null && !config.displayScopes.includes(scope);
241
- const transform = (commit, { repository, host, owner, repoUrl }) => {
242
- const discard = commit.notes.length === 0;
243
- const issues = /* @__PURE__ */ new Set();
244
- const notes = commit.notes.map((note) => ({
245
- ...note,
246
- title: `${config.withEmoji === false ? "" : "\u{1F4A5} "}BREAKING CHANGES`
247
- }));
248
- const conventionalType = commit.type == null ? void 0 : CommitConventionalType.parse(commit.type) ?? (GitmojiCode.isValid(commit.type) ? GitmojiCode.toConventionalCommitType(commit.type) : void 0);
249
- if (ignoreType(conventionalType) && discard) return false;
250
- const type = conventionalType == null ? null : displayType(conventionalType, {
251
- withEmoji: config.withEmoji
252
- });
253
- if (ignoreScope(commit.scope)) return false;
254
- const scopeIntermediate = commit.scope === "*" ? "" : commit.scope;
255
- const scope = config.scopeDisplayName == null ? null : displayScope(scopeIntermediate, config.scopeDisplayName) ?? null;
256
- const hash = typeof commit.hash === "string" ? commit.hash.slice(0, 7) : commit.hash;
257
- const subject = typeof commit.subject === "string" ? (() => {
258
- let returnValue = commit.subject;
259
- const url = repository == null ? repoUrl : [host, owner, repository].filter(Boolean).join("/");
260
- if (url != null) {
261
- const issueURL = `${url}/issues/`;
262
- returnValue = returnValue.replace(/#(\d+)/g, (_, issue) => {
263
- issues.add(issue);
264
- return `[#${issue}](${issueURL}${issue})`;
265
- });
266
- }
267
- if (host != null) {
268
- returnValue = returnValue.replace(
269
- /\B@([\da-z](?:-?[\d/a-z]){0,38})/g,
270
- (_, username) => username.includes("/") ? `@${username}` : `[@${username}](${host}/${username})`
271
- );
272
- }
273
- return returnValue;
274
- })() : commit.subject;
275
- const references = commit.references.filter((reference) => !issues.has(reference.issue));
276
- return {
277
- ...commit,
278
- type,
279
- hash,
280
- scope,
281
- subject,
282
- references,
283
- header: commit.header,
284
- body: commit.body,
285
- footer: commit.footer,
286
- merge: commit.merge,
287
- revert: commit.revert,
288
- notes,
289
- mentions: commit.mentions
290
- };
291
- };
292
- return transform;
231
+ const displayTypes = new Set(config.displayTypes == null ? CommitConventionalType.values() : config.displayTypes);
232
+ const ignoreType = (type) => type == null || !displayTypes.has(type);
233
+ const ignoreScope = (scope) => config.displayScopes == null ? false : scope != null && !config.displayScopes.includes(scope);
234
+ const transform = (commit, { repository, host, owner, repoUrl }) => {
235
+ const discard = commit.notes.length === 0;
236
+ const issues = /* @__PURE__ */ new Set();
237
+ const notes = commit.notes.map((note) => ({
238
+ ...note,
239
+ title: `${config.withEmoji === false ? "" : "💥 "}BREAKING CHANGES`
240
+ }));
241
+ const conventionalType = commit.type == null ? void 0 : CommitConventionalType.parse(commit.type) ?? (GitmojiCode.isValid(commit.type) ? GitmojiCode.toConventionalCommitType(commit.type) : void 0);
242
+ if (ignoreType(conventionalType) && discard) return false;
243
+ const type = conventionalType == null ? null : displayType(conventionalType, { withEmoji: config.withEmoji });
244
+ if (ignoreScope(commit.scope)) return false;
245
+ const scopeIntermediate = commit.scope === "*" ? "" : commit.scope;
246
+ const scope = config.scopeDisplayName == null ? null : displayScope(scopeIntermediate, config.scopeDisplayName) ?? null;
247
+ const hash = typeof commit.hash === "string" ? commit.hash.slice(0, 7) : commit.hash;
248
+ const subject = typeof commit.subject === "string" ? (() => {
249
+ let returnValue = commit.subject;
250
+ const url = repository == null ? repoUrl : [
251
+ host,
252
+ owner,
253
+ repository
254
+ ].filter(Boolean).join("/");
255
+ if (url != null) {
256
+ const issueURL = `${url}/issues/`;
257
+ returnValue = returnValue.replace(/#(\d+)/g, (_, issue) => {
258
+ issues.add(issue);
259
+ return `[#${issue}](${issueURL}${issue})`;
260
+ });
261
+ }
262
+ if (host != null) returnValue = returnValue.replace(/\B@([\da-z](?:-?[\d/a-z]){0,38})/g, (_, username) => username.includes("/") ? `@${username}` : `[@${username}](${host}/${username})`);
263
+ return returnValue;
264
+ })() : commit.subject;
265
+ const references = commit.references.filter((reference) => !issues.has(reference.issue));
266
+ return {
267
+ ...commit,
268
+ type,
269
+ hash,
270
+ scope,
271
+ subject,
272
+ references,
273
+ header: commit.header,
274
+ body: commit.body,
275
+ footer: commit.footer,
276
+ merge: commit.merge,
277
+ revert: commit.revert,
278
+ notes,
279
+ mentions: commit.mentions
280
+ };
281
+ };
282
+ return transform;
293
283
  }
294
-
295
- // src/writer.ts
296
- var _dirname = typeof __dirname === "undefined" ? nodePath.dirname(fileURLToPath(import.meta.url)) : __dirname;
297
- var basePath = nodePath.resolve(nodePath.dirname(_dirname), "./template");
298
- var defaultDisplayTypes = CommitConventionalType.findWhere((_) => _.changelog);
299
- var createWriterOpts = async () => {
300
- const mainTemplate = readFileSync(`${basePath}/template.hbs`, "utf8");
301
- const headerPartial = readFileSync(`${basePath}/header.hbs`, "utf8");
302
- const commitPartial = readFileSync(`${basePath}/commit.hbs`, "utf8");
303
- const footerPartial = readFileSync(`${basePath}/footer.hbs`, "utf8");
304
- const author = readFileSync(`${basePath}/author.hbs`, "utf8");
305
- return {
306
- transform: createTransform({
307
- displayTypes: defaultDisplayTypes
308
- }),
309
- groupBy: "type",
310
- commitGroupsSort: "title",
311
- // @ts-ignore FIXME: unknown error
312
- commitsSort: ["scope", "subject"],
313
- noteGroupsSort: "title",
314
- mainTemplate,
315
- headerPartial,
316
- // eslint-disable-next-line unicorn/prefer-string-replace-all
317
- commitPartial: commitPartial.replace(/{{gitUserInfo}}/g, author),
318
- footerPartial
319
- };
284
+ //#endregion
285
+ //#region src/writer.ts
286
+ const _dirname = typeof __dirname === "undefined" ? nodePath.dirname(fileURLToPath(import.meta.url)) : __dirname;
287
+ const basePath = nodePath.resolve(nodePath.dirname(_dirname), "./template");
288
+ const defaultDisplayTypes = CommitConventionalType.findWhere((_) => _.changelog);
289
+ const createWriterOpts = async () => {
290
+ const mainTemplate = readFileSync(`${basePath}/template.hbs`, "utf8");
291
+ const headerPartial = readFileSync(`${basePath}/header.hbs`, "utf8");
292
+ const commitPartial = readFileSync(`${basePath}/commit.hbs`, "utf8");
293
+ const footerPartial = readFileSync(`${basePath}/footer.hbs`, "utf8");
294
+ const author = readFileSync(`${basePath}/author.hbs`, "utf8");
295
+ return {
296
+ transform: createTransform({ displayTypes: defaultDisplayTypes }),
297
+ groupBy: "type",
298
+ commitGroupsSort: "title",
299
+ commitsSort: ["scope", "subject"],
300
+ noteGroupsSort: "title",
301
+ mainTemplate,
302
+ headerPartial,
303
+ commitPartial: commitPartial.replace(/{{gitUserInfo}}/g, author),
304
+ footerPartial
305
+ };
320
306
  };
321
-
322
- // src/index.ts
307
+ //#endregion
308
+ //#region src/createPreset.ts
323
309
  async function createPreset() {
324
- return {
325
- gitRawCommitOpts,
326
- parser: createParserOpts(),
327
- writer: await createWriterOpts(),
328
- whatBump
329
- };
310
+ return {
311
+ gitRawCommitOpts,
312
+ parser: createParserOpts(),
313
+ writer: await createWriterOpts(),
314
+ whatBump
315
+ };
330
316
  }
317
+ //#endregion
318
+ export { Emoji, GitmojiCode, createPreset as default, meta };
331
319
 
332
- export { Emoji, GitmojiCode, createPreset as default };
333
- //# sourceMappingURL=index.js.map
334
320
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/git-raw-commit-opts.ts","../src/parser.ts","../src/data.ts","../src/gitmo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BAAA,EAAkB,OAAA;AAAA;AAAA,IAElB,WAAA,EAAa,CAAC,OAAA,EAAS,SAAS,CAAA;AAAA,IAChC,cAAA,EAAgB,OAAA;AAAA,IAChB,YAAA;AAAA,IACA,aAAA;AAAA;AAAA,IAEA,aAAA,EAAe,aAAA,CAAc,OAAA,CAAQ,kBAAA,EAAoB,MAAM,CAAA;AAAA,IAC/D;AAAA,GACF;AACF,CAAA;;;AC7BA,eAAO,YAAA,GAAsC;AAC3C,EAAA,OAAO;AAAA,IACL,gBAAA;AAAA,IACA,QAAQ,gBAAA,EAAiB;AAAA,IACzB,MAAA,EAAQ,MAAM,gBAAA,EAAiB;AAAA,IAC/B;AAAA,GACF;AACF","file":"index.js","sourcesContent":["export const gitRawCommitOpts = {\n format: '%B%n-hash-%n%H%n-gitTags-%n%d%n-committerDate-%n%ci%n-authorName-%n%an%n-authorEmail-%n%ae',\n};\n","import type { ParserOptions as ParserOptionsDefault } from 'conventional-commits-parser';\n\nexport interface ParserOptions extends ParserOptionsDefault {}\n\nexport const createParserOpts = (): ParserOptions => ({\n headerPattern: new RegExp(\n // Type\n // eslint-disable-next-line unicorn/prefer-string-raw\n `^(?<type>\\\\S*)? ` +\n // Scope\n // eslint-disable-next-line unicorn/prefer-string-raw\n `(?:\\\\((?<scope>.*)\\\\):? )?` +\n // Subject\n `(?<subject>.*)$`,\n 'u',\n ),\n headerCorrespondence: ['type', 'scope', 'subject'],\n revertPattern: /^(?:revert|revert:)\\s\"?([\\S\\s]+?)\"?\\s*this reverts commit (\\w*)\\./i,\n noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],\n // revertPattern: /revert:\\s([\\S\\s]*?)\\s*this reverts commit (\\w*)\\./i,\n revertCorrespondence: [`header`, `hash`],\n});\n","import type { Commit as CommitDefault } from 'conventional-commits-parser';\n\nexport type Commit = CommitDefault & {\n type: string | null;\n subject: string | null;\n scope: string | null;\n hash: string | null;\n};\n\nexport type CommitConventionalType =\n | 'build'\n | 'ci'\n | 'docs'\n | 'feat'\n | 'fix'\n | 'perf'\n | 'refactor'\n | 'revert'\n | 'style'\n | 'test'\n | 'wip'\n | 'chore';\n\nexport const CommitConventionalType = (() => {\n const enumObject = Object.freeze({\n Build: 'build',\n CI: 'ci',\n Docs: 'docs',\n Feat: 'feat',\n Fix: 'fix',\n Perf: 'perf',\n Refactor: 'refactor',\n Revert: 'revert',\n Style: 'style',\n Test: 'test',\n WIP: 'wip',\n Chore: 'chore',\n });\n // eslint-disable-next-line unicorn/no-array-sort\n const enumValues: readonly CommitConventionalType[] = Object.freeze(Object.values(enumObject).sort());\n const enumValuesSet = new Set(enumValues);\n\n const typeData: Record<CommitConventionalType, CommitConventionalTypeData> = {\n feat: {\n 'emoji': '✨',\n 'en-US': 'Features',\n 'changelog': true,\n },\n fix: {\n 'emoji': '🐛',\n 'en-US': 'Bug Fixes',\n 'changelog': true,\n },\n build: {\n 'emoji': '👷',\n 'en-US': 'Build System',\n 'changelog': false,\n },\n chore: {\n 'emoji': '🎫',\n 'en-US': 'Chores',\n 'changelog': false,\n },\n ci: {\n 'emoji': '🔧',\n 'en-US': 'Continuous Integration',\n 'changelog': false,\n },\n docs: {\n 'emoji': '📝',\n 'en-US': 'Documentation',\n 'changelog': false,\n },\n test: {\n 'emoji': '✅',\n 'en-US': 'Tests',\n 'changelog': false,\n },\n perf: {\n 'emoji': '⚡',\n 'en-US': 'Performance Improvements',\n 'changelog': true,\n },\n refactor: {\n 'emoji': '♻',\n 'en-US': 'Code Refactoring',\n 'changelog': false,\n },\n revert: {\n 'emoji': '⏪',\n 'en-US': 'Reverts',\n 'changelog': true,\n },\n style: {\n 'emoji': '💄',\n 'en-US': 'Styles',\n 'changelog': false,\n },\n wip: {\n 'emoji': '🚧',\n 'en-US': 'Work in progress',\n 'changelog': false,\n },\n };\n\n function hasInstance(anyValue: unknown): anyValue is CommitConventionalType {\n return typeof anyValue === 'string' && enumValuesSet.has(anyValue as unknown as CommitConventionalType);\n }\n\n function getData(commitType: CommitConventionalType): CommitConventionalTypeData {\n return typeData[commitType];\n }\n\n function parse(anyValue: string): CommitConventionalType | undefined {\n return hasInstance(anyValue) ? anyValue : undefined;\n }\n\n function values() {\n return enumValues;\n }\n\n function findWhere(predicate: (data: CommitConventionalTypeData) => boolean): CommitConventionalType[] {\n return enumValues.filter((enumValue) => predicate(getData(enumValue)));\n }\n\n return { ...enumObject, hasInstance, getData, values, parse, findWhere };\n})();\n\nexport interface CommitConventionalTypeData {\n 'emoji': string;\n 'en-US': string;\n 'changelog': boolean;\n}\n","/* eslint-disable unicorn/prefer-spread */\nimport emojiRegexp from 'emoji-regex';\nimport { type Gitmoji, gitmojis } from 'gitmojis';\nimport type { CommitConventionalType } from './data.js';\n\nexport type Emoji = Emoji.Unicode | Emoji.Text;\nexport namespace Emoji {\n export const reEmojiUnicode = emojiRegexp();\n\n export const reEmojiText = /:\\w*:/;\n\n const reMatchOnly = (input: RegExp) => new RegExp(`^${input.source}$`, '');\n const _reEmojiUnicode = reMatchOnly(reEmojiUnicode);\n const _reEmojiText = reMatchOnly(reEmojiText);\n\n export type Unicode = string & { '@@EmojiStyle': 'unicode' };\n export type Text = string & { '@@EmojiStyle': 'text' };\n\n export function isUnicode(anyValue: string): anyValue is Unicode {\n return _reEmojiUnicode.test(anyValue);\n }\n\n export function isText(anyValue: string): anyValue is Text {\n return _reEmojiText.test(anyValue);\n }\n\n export function hasInstance(anyValue: string): anyValue is Emoji {\n return isText(anyValue) || isUnicode(anyValue);\n }\n}\n\nexport type GitmojiCode = Emoji & { '@@Gitmoji': true };\nexport namespace GitmojiCode {\n export type Unicode = Emoji.Unicode & { '@@Gitmoji': true };\n export type Emoji = Emoji.Text & { '@@Gitmoji': true };\n\n // export const reEmoji = emojiRegexp();\n\n const allGitmojiCodes = new Set(\n gitmojis\n .map((gitmoji) => gitmoji.code as GitmojiCode)\n .concat(gitmojis.map((gitmoji) => gitmoji.emoji as GitmojiCode)),\n );\n const index = {\n // code: createIndex(gitmojis, 'code'),\n emoji: createIndex(gitmojis, 'emoji'),\n };\n\n function createIndex<K extends keyof Gitmoji>(list: readonly Gitmoji[], key: K): ReadonlyMap<Gitmoji[K], Gitmoji> {\n return new Map(list.map((gitmoji) => [gitmoji[key], gitmoji]));\n }\n\n export function isValid(anyValue: string): anyValue is GitmojiCode {\n return allGitmojiCodes.has(anyValue as GitmojiCode);\n }\n\n const defaultType = 'chore';\n const conversionMap: ReadonlyMap<GitmojiCode, CommitConventionalType> = (() => {\n const data: Record<CommitConventionalType, GitmojiCode.Unicode[]> = {\n feat: ['✨', '♿️', '🚸'] as GitmojiCode.Unicode[],\n fix: ['🐛'] as GitmojiCode.Unicode[],\n docs: ['📝'] as GitmojiCode.Unicode[],\n style: ['🎨', '🚨'] as GitmojiCode.Unicode[],\n refactor: ['♻️', '🏗️'] as GitmojiCode.Unicode[],\n test: ['✅', '🧪'] as GitmojiCode.Unicode[],\n perf: ['⚡️'] as GitmojiCode.Unicode[],\n revert: ['⏪️'] as GitmojiCode.Unicode[],\n ci: ['👷', '💚'] as GitmojiCode.Unicode[],\n wip: ['🚧'] as GitmojiCode.Unicode[],\n build: [] as GitmojiCode.Unicode[],\n chore: ['🔧'] as GitmojiCode.Unicode[],\n };\n\n const entries = Array.from<[CommitConventionalType, GitmojiCode.Unicode[]]>(\n // @ts-ignore entries are not well typed\n Object.entries(data),\n );\n return new Map(\n entries.reduce<Array<[GitmojiCode, CommitConventionalType]>>(\n (acc, [commitType, gitmojiUnicodeArray]) =>\n acc\n .concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [gitmojiUnicode, commitType]))\n\n .concat(\n gitmojiUnicodeArray.map((gitmojiUnicode) => [\n // eslint-disable-next-line ts/no-non-null-assertion, ts/no-non-null-asserted-optional-chain\n index.emoji.get(gitmojiUnicode)?.code! as GitmojiCode,\n commitType,\n ]),\n ),\n [],\n ),\n );\n })();\n\n export function toConventionalCommitType(gitmoji: GitmojiCode): CommitConventionalType {\n return conversionMap.get(gitmoji) ?? defaultType;\n }\n}\n","import type { Commit as CommitBase } from 'conventional-commits-parser';\nimport { CommitConventionalType } from './data.js';\nimport { GitmojiCode } from './gitmoji.js';\n\nfunction toConventionalCommitType(text: string) {\n return GitmojiCode.isValid(text)\n ? GitmojiCode.toConventionalCommitType(text)\n : CommitConventionalType.hasInstance(text)\n ? text\n : undefined;\n}\n\nexport type Commit = CommitBase;\n\nexport const whatBump = (commits: ReadonlyArray<Commit>) => {\n let level = 2;\n let breakings = 0;\n let features = 0;\n\n for (const { type, notes } of commits) {\n const conventionalType = type == null ? type : toConventionalCommitType(type);\n if (notes.length > 0) {\n breakings += notes.length;\n level = 0;\n } else if (conventionalType === CommitConventionalType.Feat) {\n features += 1;\n if (level === 2) {\n level = 1;\n }\n }\n }\n\n return {\n level,\n reason:\n breakings === 1\n ? `There is ${breakings} BREAKING CHANGE and ${features} features`\n : `There are ${breakings} BREAKING CHANGES and ${features} features`,\n };\n};\n","import type { CommitTransformFunction, Context } from 'conventional-changelog-writer';\nimport { CommitConventionalType, Commit } from './data.js';\nimport { GitmojiCode } from './gitmoji.js';\n\nexport type Language = 'en-US';\n\nexport interface TransformConfig {\n scopeDisplayName?: Record<string, string>;\n displayTypes?: CommitConventionalType[];\n displayScopes?: string[];\n showAuthor?: boolean;\n withEmoji?: boolean;\n language?: Language;\n}\n\nexport function displayScope(scope: string | null | undefined, scopeDisplayNameMap: Record<string, string>) {\n return scope == null || scope.length === 0\n ? scopeDisplayNameMap['*']\n : scopeDisplayNameMap[scope] == null\n ? scope\n : scopeDisplayNameMap[scope];\n}\n\nexport function displayType(type: string, options: displayType.Options = {}): string {\n const { withEmoji = true, language = 'en-US' } = options;\n\n if (CommitConventionalType.hasInstance(type)) {\n const { emoji, [language]: title } = CommitConventionalType.getData(type);\n return `${withEmoji ? `${emoji} ` : ''}${title}`;\n }\n\n return type;\n}\nexport namespace displayType {\n export interface Options {\n readonly withEmoji?: boolean | undefined;\n readonly language?: Language;\n }\n}\n\nexport function createTransform(config: TransformConfig): CommitTransformFunction<Commit> {\n const displayTypes = new Set(config.displayTypes == null ? CommitConventionalType.values() : config.displayTypes);\n const ignoreType = (type: string | undefined) => type == null || !displayTypes.has(type as CommitConventionalType);\n const ignoreScope = (scope: string | undefined | null) =>\n config.displayScopes == null ? false : scope != null && !config.displayScopes.includes(scope);\n\n const transform = (commit: Commit, { repository, host, owner, repoUrl }: Context): Commit | false => {\n const discard = commit.notes.length === 0;\n const issues = new Set<string>();\n const notes = commit.notes.map((note) => ({\n ...note,\n title: `${config.withEmoji === false ? '' : '💥 '}BREAKING CHANGES`,\n }));\n const conventionalType =\n commit.type == null\n ? undefined\n : (CommitConventionalType.parse(commit.type) ??\n (GitmojiCode.isValid(commit.type) ? GitmojiCode.toConventionalCommitType(commit.type) : undefined));\n\n if (ignoreType(conventionalType) && discard) return false;\n\n const type =\n conventionalType == null\n ? null\n : displayType(conventionalType, {\n withEmoji: config.withEmoji,\n });\n\n if (ignoreScope(commit.scope)) return false;\n\n const scopeIntermediate = commit.scope === '*' ? '' : commit.scope;\n const scope =\n config.scopeDisplayName == null ? null : (displayScope(scopeIntermediate, config.scopeDisplayName) ?? null);\n const hash = typeof commit.hash === 'string' ? commit.hash.slice(0, 7) : commit.hash;\n\n const subject =\n typeof commit.subject === 'string'\n ? (() => {\n let returnValue = commit.subject;\n const url = repository == null ? repoUrl : [host, owner, repository].filter(Boolean).join('/');\n if (url != null) {\n const issueURL = `${url}/issues/`;\n // Issue URLs.\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n returnValue = returnValue.replace(/#(\\d+)/g, (_, issue: string) => {\n issues.add(issue);\n\n return `[#${issue}](${issueURL}${issue})`;\n });\n }\n if (host != null) {\n // User URLs.\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n returnValue = returnValue.replace(/\\B@([\\da-z](?:-?[\\d/a-z]){0,38})/g, (_, username: string) =>\n username.includes('/') ? `@${username}` : `[@${username}](${host}/${username})`,\n );\n }\n return returnValue;\n })()\n : commit.subject;\n\n // Remove references that already appear in the subject\n const references = commit.references.filter((reference) => !issues.has(reference.issue));\n\n // eslint-disable-next-line ts/consistent-type-assertions\n return {\n ...commit,\n type,\n hash,\n scope,\n subject,\n references,\n header: commit.header,\n body: commit.body,\n footer: commit.footer,\n merge: commit.merge,\n revert: commit.revert,\n notes,\n mentions: commit.mentions,\n } as Commit;\n };\n\n return transform as unknown as CommitTransformFunction<Commit>;\n}\n","import { readFileSync } from 'node:fs';\nimport nodePath from 'node:path';\nimport type { Options } from 'conventional-changelog-writer';\nimport { fileURLToPath } from 'node:url';\nimport { createTransform } from './transform.js';\nimport { Commit, CommitConventionalType } from './data.js';\n\nexport interface WriterOptions extends Options<Commit> {}\n\nconst _dirname = typeof __dirname === 'undefined' ? nodePath.dirname(fileURLToPath(import.meta.url)) : __dirname;\nconst basePath = nodePath.resolve(nodePath.dirname(_dirname), './template');\n\nexport const defaultDisplayTypes = CommitConventionalType.findWhere((_) => _.changelog);\n\nexport const createWriterOpts = async (): Promise<WriterOptions> => {\n const mainTemplate = readFileSync(`${basePath}/template.hbs`, 'utf8');\n const headerPartial = readFileSync(`${basePath}/header.hbs`, 'utf8');\n const commitPartial = readFileSync(`${basePath}/commit.hbs`, 'utf8');\n const footerPartial = readFileSync(`${basePath}/footer.hbs`, 'utf8');\n const author = readFileSync(`${basePath}/author.hbs`, 'utf8');\n\n return {\n transform: createTransform({\n displayTypes: defaultDisplayTypes,\n }),\n groupBy: 'type',\n commitGroupsSort: 'title',\n // @ts-ignore FIXME: unknown error\n commitsSort: ['scope', 'subject'],\n noteGroupsSort: 'title',\n mainTemplate,\n headerPartial,\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n commitPartial: commitPartial.replace(/{{gitUserInfo}}/g, author),\n footerPartial,\n };\n};\n","import { gitRawCommitOpts } from './git-raw-commit-opts.js';\nimport { createParserOpts } from './parser.js';\nimport { whatBump } from './whatBump.js';\nimport { createWriterOpts } from './writer.js';\n\nexport { Emoji, GitmojiCode } from './gitmoji.js';\n\nexport default async function createPreset() {\n return {\n gitRawCommitOpts,\n parser: createParserOpts(),\n writer: await createWriterOpts(),\n whatBump,\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/meta.ts","../src/gitmoji.ts","../src/git-raw-commit-opts.ts","../src/parser.ts","../src/data.ts","../src/whatBump.ts","../src/transform.ts","../src/writer.ts","../src/createPreset.ts"],"sourcesContent":["export const meta = Object.freeze({\n // @ts-ignore - these variables are injected at build time\n name: (typeof __PACKAGE_NAME__ === 'undefined' ? '' : __PACKAGE_NAME__) as string,\n // @ts-ignore - these variables are injected at build time\n version: (typeof __PACKAGE_VERSION__ === 'undefined' ? '' : __PACKAGE_VERSION__) as string,\n // @ts-ignore - these variables are injected at build time\n buildNumber: 1 as number, // (typeof __PACKAGE_BUILD_NUMBER__ === 'undefined' ? 0 : __PACKAGE_BUILD_NUMBER__) as number,\n});\n","/* eslint-disable unicorn/prefer-spread */\nimport emojiRegexp from 'emoji-regex';\nimport { type Gitmoji, gitmojis } from 'gitmojis';\nimport type { CommitConventionalType } from './data.js';\n\nexport type Emoji = Emoji.Unicode | Emoji.Text;\nexport namespace Emoji {\n export const reEmojiUnicode = emojiRegexp();\n\n export const reEmojiText = /:\\w*:/;\n\n const reMatchOnly = (input: RegExp) => new RegExp(`^${input.source}$`, '');\n const _reEmojiUnicode = reMatchOnly(reEmojiUnicode);\n const _reEmojiText = reMatchOnly(reEmojiText);\n\n export type Unicode = string & { '@@EmojiStyle': 'unicode' };\n export type Text = string & { '@@EmojiStyle': 'text' };\n\n export function isUnicode(anyValue: string): anyValue is Unicode {\n return _reEmojiUnicode.test(anyValue);\n }\n\n export function isText(anyValue: string): anyValue is Text {\n return _reEmojiText.test(anyValue);\n }\n\n export function hasInstance(anyValue: string): anyValue is Emoji {\n return isText(anyValue) || isUnicode(anyValue);\n }\n}\n\nexport type GitmojiCode = Emoji & { '@@Gitmoji': true };\nexport namespace GitmojiCode {\n export type Unicode = Emoji.Unicode & { '@@Gitmoji': true };\n export type Emoji = Emoji.Text & { '@@Gitmoji': true };\n\n // export const reEmoji = emojiRegexp();\n\n const allGitmojiCodes = new Set(\n gitmojis\n .map((gitmoji) => gitmoji.code as GitmojiCode)\n .concat(gitmojis.map((gitmoji) => gitmoji.emoji as GitmojiCode)),\n );\n const index = {\n // code: createIndex(gitmojis, 'code'),\n emoji: createIndex(gitmojis, 'emoji'),\n };\n\n function createIndex<K extends keyof Gitmoji>(list: readonly Gitmoji[], key: K): ReadonlyMap<Gitmoji[K], Gitmoji> {\n return new Map(list.map((gitmoji) => [gitmoji[key], gitmoji]));\n }\n\n export function isValid(anyValue: string): anyValue is GitmojiCode {\n return allGitmojiCodes.has(anyValue as GitmojiCode);\n }\n\n const defaultType = 'chore';\n const conversionMap: ReadonlyMap<GitmojiCode, CommitConventionalType> = (() => {\n const data: Record<CommitConventionalType, GitmojiCode.Unicode[]> = {\n feat: ['✨', '♿️', '🚸'] as GitmojiCode.Unicode[],\n fix: ['🐛'] as GitmojiCode.Unicode[],\n docs: ['📝'] as GitmojiCode.Unicode[],\n style: ['🎨', '🚨'] as GitmojiCode.Unicode[],\n refactor: ['♻️', '🏗️'] as GitmojiCode.Unicode[],\n test: ['✅', '🧪'] as GitmojiCode.Unicode[],\n perf: ['⚡️'] as GitmojiCode.Unicode[],\n revert: ['⏪️'] as GitmojiCode.Unicode[],\n ci: ['👷', '💚'] as GitmojiCode.Unicode[],\n wip: ['🚧'] as GitmojiCode.Unicode[],\n build: [] as GitmojiCode.Unicode[],\n chore: ['🔧'] as GitmojiCode.Unicode[],\n };\n\n const entries = Array.from<[CommitConventionalType, GitmojiCode.Unicode[]]>(\n // @ts-ignore entries are not well typed\n Object.entries(data),\n );\n return new Map(\n entries.reduce<Array<[GitmojiCode, CommitConventionalType]>>(\n (acc, [commitType, gitmojiUnicodeArray]) =>\n acc\n .concat(gitmojiUnicodeArray.map((gitmojiUnicode) => [gitmojiUnicode, commitType]))\n\n .concat(\n gitmojiUnicodeArray.map((gitmojiUnicode) => [\n // eslint-disable-next-line ts/no-non-null-assertion, ts/no-non-null-asserted-optional-chain\n index.emoji.get(gitmojiUnicode)?.code! as GitmojiCode,\n commitType,\n ]),\n ),\n [],\n ),\n );\n })();\n\n export function toConventionalCommitType(gitmoji: GitmojiCode): CommitConventionalType {\n return conversionMap.get(gitmoji) ?? defaultType;\n }\n}\n","export const gitRawCommitOpts = {\n format: '%B%n-hash-%n%H%n-gitTags-%n%d%n-committerDate-%n%ci%n-authorName-%n%an%n-authorEmail-%n%ae',\n};\n","import type { Options as ParserOptionsDefault } from 'conventional-commits-parser';\n\nexport interface ParserOptions extends ParserOptionsDefault {}\n\nexport const createParserOpts = (): ParserOptions => ({\n headerPattern: new RegExp(\n // Type\n // eslint-disable-next-line unicorn/prefer-string-raw\n `^(?<type>\\\\S*)? ` +\n // Scope\n // eslint-disable-next-line unicorn/prefer-string-raw\n `(?:\\\\((?<scope>.*)\\\\):? )?` +\n // Subject\n `(?<subject>.*)$`,\n 'u',\n ),\n headerCorrespondence: ['type', 'scope', 'subject'],\n revertPattern: /^(?:revert|revert:)\\s\"?([\\S\\s]+?)\"?\\s*this reverts commit (\\w*)\\./i,\n noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],\n // revertPattern: /revert:\\s([\\S\\s]*?)\\s*this reverts commit (\\w*)\\./i,\n revertCorrespondence: [`header`, `hash`],\n});\n","import type { Commit as CommitDefault } from 'conventional-commits-parser';\n\nexport type Commit = CommitDefault & {\n type: string | null;\n subject: string | null;\n scope: string | null;\n hash: string | null;\n};\n\nexport type CommitConventionalType =\n | 'build'\n | 'ci'\n | 'docs'\n | 'feat'\n | 'fix'\n | 'perf'\n | 'refactor'\n | 'revert'\n | 'style'\n | 'test'\n | 'wip'\n | 'chore';\n\nexport const CommitConventionalType = (() => {\n const enumObject = Object.freeze({\n Build: 'build',\n CI: 'ci',\n Docs: 'docs',\n Feat: 'feat',\n Fix: 'fix',\n Perf: 'perf',\n Refactor: 'refactor',\n Revert: 'revert',\n Style: 'style',\n Test: 'test',\n WIP: 'wip',\n Chore: 'chore',\n });\n // eslint-disable-next-line unicorn/no-array-sort\n const enumValues: readonly CommitConventionalType[] = Object.freeze(Object.values(enumObject).sort());\n const enumValuesSet = new Set(enumValues);\n\n const typeData: Record<CommitConventionalType, CommitConventionalTypeData> = {\n feat: {\n 'emoji': '✨',\n 'en-US': 'Features',\n 'changelog': true,\n },\n fix: {\n 'emoji': '🐛',\n 'en-US': 'Bug Fixes',\n 'changelog': true,\n },\n build: {\n 'emoji': '👷',\n 'en-US': 'Build System',\n 'changelog': false,\n },\n chore: {\n 'emoji': '🎫',\n 'en-US': 'Chores',\n 'changelog': false,\n },\n ci: {\n 'emoji': '🔧',\n 'en-US': 'Continuous Integration',\n 'changelog': false,\n },\n docs: {\n 'emoji': '📝',\n 'en-US': 'Documentation',\n 'changelog': false,\n },\n test: {\n 'emoji': '✅',\n 'en-US': 'Tests',\n 'changelog': false,\n },\n perf: {\n 'emoji': '⚡',\n 'en-US': 'Performance Improvements',\n 'changelog': true,\n },\n refactor: {\n 'emoji': '♻',\n 'en-US': 'Code Refactoring',\n 'changelog': false,\n },\n revert: {\n 'emoji': '⏪',\n 'en-US': 'Reverts',\n 'changelog': true,\n },\n style: {\n 'emoji': '💄',\n 'en-US': 'Styles',\n 'changelog': false,\n },\n wip: {\n 'emoji': '🚧',\n 'en-US': 'Work in progress',\n 'changelog': false,\n },\n };\n\n function hasInstance(anyValue: unknown): anyValue is CommitConventionalType {\n return typeof anyValue === 'string' && enumValuesSet.has(anyValue as unknown as CommitConventionalType);\n }\n\n function getData(commitType: CommitConventionalType): CommitConventionalTypeData {\n return typeData[commitType];\n }\n\n function parse(anyValue: string): CommitConventionalType | undefined {\n return hasInstance(anyValue) ? anyValue : undefined;\n }\n\n function values() {\n return enumValues;\n }\n\n function findWhere(predicate: (data: CommitConventionalTypeData) => boolean): CommitConventionalType[] {\n return enumValues.filter((enumValue) => predicate(getData(enumValue)));\n }\n\n return { ...enumObject, hasInstance, getData, values, parse, findWhere };\n})();\n\nexport interface CommitConventionalTypeData {\n 'emoji': string;\n 'en-US': string;\n 'changelog': boolean;\n}\n","import type { Commit as CommitBase } from 'conventional-commits-parser';\nimport { CommitConventionalType } from './data.js';\nimport { GitmojiCode } from './gitmoji.js';\n\nfunction toConventionalCommitType(text: string) {\n return GitmojiCode.isValid(text)\n ? GitmojiCode.toConventionalCommitType(text)\n : CommitConventionalType.hasInstance(text)\n ? text\n : undefined;\n}\n\nexport type Commit = CommitBase;\n\nexport const whatBump = (commits: ReadonlyArray<Commit>) => {\n let level = 2;\n let breakings = 0;\n let features = 0;\n\n for (const { type, notes } of commits) {\n const conventionalType = type == null ? type : toConventionalCommitType(type);\n if (notes.length > 0) {\n breakings += notes.length;\n level = 0;\n } else if (conventionalType === CommitConventionalType.Feat) {\n features += 1;\n if (level === 2) {\n level = 1;\n }\n }\n }\n\n return {\n level,\n reason:\n breakings === 1\n ? `There is ${breakings} BREAKING CHANGE and ${features} features`\n : `There are ${breakings} BREAKING CHANGES and ${features} features`,\n };\n};\n","import type { CommitTransformFunction, Context } from 'conventional-changelog-writer';\nimport { CommitConventionalType, Commit } from './data.js';\nimport { GitmojiCode } from './gitmoji.js';\n\nexport type Language = 'en-US';\n\nexport interface TransformConfig {\n scopeDisplayName?: Record<string, string>;\n displayTypes?: CommitConventionalType[];\n displayScopes?: string[];\n showAuthor?: boolean;\n withEmoji?: boolean;\n language?: Language;\n}\n\nexport function displayScope(scope: string | null | undefined, scopeDisplayNameMap: Record<string, string>) {\n return scope == null || scope.length === 0\n ? scopeDisplayNameMap['*']\n : scopeDisplayNameMap[scope] == null\n ? scope\n : scopeDisplayNameMap[scope];\n}\n\nexport function displayType(type: string, options: displayType.Options = {}): string {\n const { withEmoji = true, language = 'en-US' } = options;\n\n if (CommitConventionalType.hasInstance(type)) {\n const { emoji, [language]: title } = CommitConventionalType.getData(type);\n return `${withEmoji ? `${emoji} ` : ''}${title}`;\n }\n\n return type;\n}\nexport namespace displayType {\n export interface Options {\n readonly withEmoji?: boolean | undefined;\n readonly language?: Language;\n }\n}\n\nexport function createTransform(config: TransformConfig): CommitTransformFunction<Commit> {\n const displayTypes = new Set(config.displayTypes == null ? CommitConventionalType.values() : config.displayTypes);\n const ignoreType = (type: string | undefined) => type == null || !displayTypes.has(type as CommitConventionalType);\n const ignoreScope = (scope: string | undefined | null) =>\n config.displayScopes == null ? false : scope != null && !config.displayScopes.includes(scope);\n\n const transform = (commit: Commit, { repository, host, owner, repoUrl }: Context): Commit | false => {\n const discard = commit.notes.length === 0;\n const issues = new Set<string>();\n const notes = commit.notes.map((note) => ({\n ...note,\n title: `${config.withEmoji === false ? '' : '💥 '}BREAKING CHANGES`,\n }));\n const conventionalType =\n commit.type == null\n ? undefined\n : (CommitConventionalType.parse(commit.type) ??\n (GitmojiCode.isValid(commit.type) ? GitmojiCode.toConventionalCommitType(commit.type) : undefined));\n\n if (ignoreType(conventionalType) && discard) return false;\n\n const type =\n conventionalType == null\n ? null\n : displayType(conventionalType, {\n withEmoji: config.withEmoji,\n });\n\n if (ignoreScope(commit.scope)) return false;\n\n const scopeIntermediate = commit.scope === '*' ? '' : commit.scope;\n const scope =\n config.scopeDisplayName == null ? null : (displayScope(scopeIntermediate, config.scopeDisplayName) ?? null);\n const hash = typeof commit.hash === 'string' ? commit.hash.slice(0, 7) : commit.hash;\n\n const subject =\n typeof commit.subject === 'string'\n ? (() => {\n let returnValue = commit.subject;\n const url = repository == null ? repoUrl : [host, owner, repository].filter(Boolean).join('/');\n if (url != null) {\n const issueURL = `${url}/issues/`;\n // Issue URLs.\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n returnValue = returnValue.replace(/#(\\d+)/g, (_, issue: string) => {\n issues.add(issue);\n\n return `[#${issue}](${issueURL}${issue})`;\n });\n }\n if (host != null) {\n // User URLs.\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n returnValue = returnValue.replace(/\\B@([\\da-z](?:-?[\\d/a-z]){0,38})/g, (_, username: string) =>\n username.includes('/') ? `@${username}` : `[@${username}](${host}/${username})`,\n );\n }\n return returnValue;\n })()\n : commit.subject;\n\n // Remove references that already appear in the subject\n const references = commit.references.filter((reference) => !issues.has(reference.issue));\n\n // eslint-disable-next-line ts/consistent-type-assertions\n return {\n ...commit,\n type,\n hash,\n scope,\n subject,\n references,\n header: commit.header,\n body: commit.body,\n footer: commit.footer,\n merge: commit.merge,\n revert: commit.revert,\n notes,\n mentions: commit.mentions,\n } as Commit;\n };\n\n return transform as unknown as CommitTransformFunction<Commit>;\n}\n","import { readFileSync } from 'node:fs';\nimport nodePath from 'node:path';\nimport type { Options } from 'conventional-changelog-writer';\nimport { fileURLToPath } from 'node:url';\nimport { createTransform } from './transform.js';\nimport { Commit, CommitConventionalType } from './data.js';\n\nexport interface WriterOptions extends Options<Commit> {}\n\nconst _dirname = typeof __dirname === 'undefined' ? nodePath.dirname(fileURLToPath(import.meta.url)) : __dirname;\nconst basePath = nodePath.resolve(nodePath.dirname(_dirname), './template');\n\nexport const defaultDisplayTypes = CommitConventionalType.findWhere((_) => _.changelog);\n\nexport const createWriterOpts = async (): Promise<WriterOptions> => {\n const mainTemplate = readFileSync(`${basePath}/template.hbs`, 'utf8');\n const headerPartial = readFileSync(`${basePath}/header.hbs`, 'utf8');\n const commitPartial = readFileSync(`${basePath}/commit.hbs`, 'utf8');\n const footerPartial = readFileSync(`${basePath}/footer.hbs`, 'utf8');\n const author = readFileSync(`${basePath}/author.hbs`, 'utf8');\n\n return {\n transform: createTransform({\n displayTypes: defaultDisplayTypes,\n }),\n groupBy: 'type',\n commitGroupsSort: 'title',\n // @ts-ignore FIXME: unknown error\n commitsSort: ['scope', 'subject'],\n noteGroupsSort: 'title',\n mainTemplate,\n headerPartial,\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n commitPartial: commitPartial.replace(/{{gitUserInfo}}/g, author),\n footerPartial,\n };\n};\n","import { gitRawCommitOpts } from './git-raw-commit-opts.js';\nimport { createParserOpts } from './parser.js';\nimport { whatBump } from './whatBump.js';\nimport { createWriterOpts } from './writer.js';\n\nexport { Emoji, GitmojiCode } from './gitmoji.js';\n\nexport async function createPreset() {\n return {\n gitRawCommitOpts,\n parser: createParserOpts(),\n writer: await createWriterOpts(),\n whatBump,\n };\n}\n"],"mappings":";;;;;;AAAA,MAAa,OAAO,OAAO,OAAO;CAEhC,MAAA;CAEA,SAAA;CAEA,aAAa;CACd,CAAC;;;ACDK,IAAA;;CACE,MAAM,iBAAA,OAAA,iBAAiB,aAAa;CAEpC,MAAM,cAAA,OAAA,cAAc;CAE3B,MAAM,eAAe,UAAkB,IAAI,OAAO,IAAI,MAAM,OAAO,IAAI,GAAG;CAC1E,MAAM,kBAAkB,YAAY,eAAe;CACnD,MAAM,eAAe,YAAY,YAAY;CAKtC,SAAS,UAAU,UAAuC;AAC/D,SAAO,gBAAgB,KAAK,SAAS;;;CAGhC,SAAS,OAAO,UAAoC;AACzD,SAAO,aAAa,KAAK,SAAS;;;CAG7B,SAAS,YAAY,UAAqC;AAC/D,SAAO,OAAO,SAAS,IAAI,UAAU,SAAS;;;yBAEjD;AAGM,IAAA;;CAML,MAAM,kBAAkB,IAAI,IAC1B,SACG,KAAK,YAAY,QAAQ,KAAoB,CAC7C,OAAO,SAAS,KAAK,YAAY,QAAQ,MAAqB,CAAC,CACnE;CACD,MAAM,QAAQ,EAEZ,OAAO,YAAY,UAAU,QAAQ,EACtC;CAED,SAAS,YAAqC,MAA0B,KAA0C;AAChH,SAAO,IAAI,IAAI,KAAK,KAAK,YAAY,CAAC,QAAQ,MAAM,QAAQ,CAAC,CAAC;;CAGzD,SAAS,QAAQ,UAA2C;AACjE,SAAO,gBAAgB,IAAI,SAAwB;;;CAGrD,MAAM,cAAc;CACpB,MAAM,uBAAyE;EAgB7E,MAAM,UAAU,MAAM,KAEpB,OAAO,QAjB2D;GAClE,MAAM;IAAC;IAAK;IAAM;IAAK;GACvB,KAAK,CAAC,KAAK;GACX,MAAM,C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,OAAO,KAAK,IAAI,CAAC,GAAG;AACvG,MAAM,WAAW,SAAS,QAAQ,SAAS,QAAQ,SAAS,EAAE,aAAa;AAE3E,MAAa,sBAAsB,uBAAuB,WAAW,MAAM,EAAE,UAAU;AAEvF,MAAa,mBAAmB,YAAoC;CAClE,MAAM,eAAe,aAAa,GAAG,SAAS,gBAAgB,OAAO;CACrE,MAAM,gBAAgB,aAAa,GAAG,SAAS,cAAc,OAAO;CACpE,MAAM,gBAAgB,aAAa,GAAG,SAAS,cAAc,OAAO;CACpE,MAAM,gBAAgB,aAAa,GAAG,SAAS,cAAc,OAAO;CACpE,MAAM,SAAS,aAAa,GAAG,SAAS,cAAc,OAAO;AAE7D,QAAO;EACL,WAAW,gBAAgB,EACzB,cAAc,qBACf,CAAC;EACF,SAAS;EACT,kBAAkB;EAElB,aAAa,CAAC,SAAS,UAAU;EACjC,gBAAgB;EAChB;EACA;EAEA,eAAe,cAAc,QAAQ,oBAAoB,OAAO;EAChE;EACD;;;;AC5BH,eAAsB,eAAe;AACnC,QAAO;EACL;EACA,QAAQ,kBAAkB;EAC1B,QAAQ,MAAM,kBAAkB;EAChC;EACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w5s/conventional-changelog",
3
- "version": "3.0.6",
3
+ "version": "3.1.0",
4
4
  "description": "Conventional changelog plugin for @w5s",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/w5s/project-config/blob/main/packages/conventional-changelog#readme",
@@ -35,38 +35,13 @@
35
35
  "!**/__tests__/**"
36
36
  ],
37
37
  "scripts": {
38
- "build": "npx run-p \"build:*\"",
39
- "build:tsc": "npx tsup",
40
- "clean": "npx run-p \"clean:*\"",
41
- "clean:tsc": "rm -rf dist",
42
- "docs": "node ../../markdown.mjs",
43
- "format": "npx run-p \"format:*\"",
44
- "format:src": "eslint . --fix",
45
- "lint": "npx run-p \"lint:*\"",
46
- "lint:src": "eslint .",
47
- "postpack": "npx clean-package restore",
48
- "prepack": "npx clean-package",
49
- "prepare": "npx run-p \"prepare:*\"",
50
- "prepare:empty": ":",
51
- "prepublishOnly": "npm run clean;npm run build",
52
- "spellcheck": "cspell --no-progress '**'",
53
- "test": "npx run-p \"test:*\"",
54
- "test:src": "vitest run"
38
+ "postpack": "clean-package restore"
55
39
  },
56
40
  "dependencies": {
57
41
  "@commitlint/types": "^20.0.0",
58
42
  "emoji-regex": "^10.2.1",
59
43
  "gitmojis": "^3.13.4"
60
44
  },
61
- "devDependencies": {
62
- "@types/conventional-changelog-writer": "4.0.11",
63
- "@types/conventional-commits-parser": "5.0.2",
64
- "@w5s/tsup-config": "2.0.4",
65
- "tsup": "8.5.1",
66
- "vite": "7.3.1",
67
- "vitest": "4.0.18"
68
- },
69
- "clean-package": "../../clean-package.config.mjs",
70
45
  "engines": {
71
46
  "node": ">=20.0.0"
72
47
  },
@@ -74,5 +49,5 @@
74
49
  "access": "public"
75
50
  },
76
51
  "sideEffect": false,
77
- "gitHead": "6d0fd278d32187d231f63936bc50b87baebcf34c"
52
+ "gitHead": "8d96574cd89109fa8268a2c77601337ad871ef1e"
78
53
  }
@@ -0,0 +1,15 @@
1
+ import { gitRawCommitOpts } from './git-raw-commit-opts.js';
2
+ import { createParserOpts } from './parser.js';
3
+ import { whatBump } from './whatBump.js';
4
+ import { createWriterOpts } from './writer.js';
5
+
6
+ export { Emoji, GitmojiCode } from './gitmoji.js';
7
+
8
+ export async function createPreset() {
9
+ return {
10
+ gitRawCommitOpts,
11
+ parser: createParserOpts(),
12
+ writer: await createWriterOpts(),
13
+ whatBump,
14
+ };
15
+ }
package/src/index.ts CHANGED
@@ -1,15 +1,3 @@
1
- import { gitRawCommitOpts } from './git-raw-commit-opts.js';
2
- import { createParserOpts } from './parser.js';
3
- import { whatBump } from './whatBump.js';
4
- import { createWriterOpts } from './writer.js';
5
-
1
+ export * from './meta.js';
6
2
  export { Emoji, GitmojiCode } from './gitmoji.js';
7
-
8
- export default async function createPreset() {
9
- return {
10
- gitRawCommitOpts,
11
- parser: createParserOpts(),
12
- writer: await createWriterOpts(),
13
- whatBump,
14
- };
15
- }
3
+ export { createPreset as default } from './createPreset.js';
package/src/meta.ts ADDED
@@ -0,0 +1,8 @@
1
+ export const meta = Object.freeze({
2
+ // @ts-ignore - these variables are injected at build time
3
+ name: (typeof __PACKAGE_NAME__ === 'undefined' ? '' : __PACKAGE_NAME__) as string,
4
+ // @ts-ignore - these variables are injected at build time
5
+ version: (typeof __PACKAGE_VERSION__ === 'undefined' ? '' : __PACKAGE_VERSION__) as string,
6
+ // @ts-ignore - these variables are injected at build time
7
+ buildNumber: 1 as number, // (typeof __PACKAGE_BUILD_NUMBER__ === 'undefined' ? 0 : __PACKAGE_BUILD_NUMBER__) as number,
8
+ });
package/src/parser.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ParserOptions as ParserOptionsDefault } from 'conventional-commits-parser';
1
+ import type { Options as ParserOptionsDefault } from 'conventional-commits-parser';
2
2
 
3
3
  export interface ParserOptions extends ParserOptionsDefault {}
4
4