@w5s/conventional-changelog 3.2.4 โ 3.2.7
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/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -9
- package/src/data.ts +1 -1
- package/src/transform.ts +7 -6
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
//#region src/meta.ts
|
|
7
7
|
const meta = Object.freeze({
|
|
8
8
|
name: "@w5s/conventional-changelog",
|
|
9
|
-
version: "3.2.
|
|
9
|
+
version: "3.2.7",
|
|
10
10
|
buildNumber: 1
|
|
11
11
|
});
|
|
12
12
|
//#endregion
|
|
@@ -108,7 +108,7 @@ const CommitConventionalType = (() => {
|
|
|
108
108
|
WIP: "wip",
|
|
109
109
|
Chore: "chore"
|
|
110
110
|
});
|
|
111
|
-
const enumValues = Object.freeze(Object.values(enumObject).sort());
|
|
111
|
+
const enumValues = Object.freeze(Object.values(enumObject).sort((left, right) => left.localeCompare(right)));
|
|
112
112
|
const enumValuesSet = new Set(enumValues);
|
|
113
113
|
const typeData = {
|
|
114
114
|
feat: {
|
|
@@ -235,19 +235,19 @@ function displayType(type, options = {}) {
|
|
|
235
235
|
}
|
|
236
236
|
function createTransform(config) {
|
|
237
237
|
const displayTypes = new Set(config.displayTypes ?? CommitConventionalType.values());
|
|
238
|
-
const
|
|
239
|
-
const
|
|
238
|
+
const shouldIgnoreType = (type) => type == null || !displayTypes.has(type);
|
|
239
|
+
const shouldIgnoreScope = (scope) => config.displayScopes == null ? false : scope != null && !config.displayScopes.includes(scope);
|
|
240
240
|
const transform = (commit, { repository, host, owner, repoUrl }) => {
|
|
241
|
-
const
|
|
241
|
+
const isDiscard = commit.notes.length === 0;
|
|
242
242
|
const issues = /* @__PURE__ */ new Set();
|
|
243
243
|
const notes = commit.notes.map((note) => ({
|
|
244
244
|
...note,
|
|
245
245
|
title: `${config.withEmoji === false ? "" : "๐ฅ "}BREAKING CHANGES`
|
|
246
246
|
}));
|
|
247
247
|
const conventionalType = commit.type == null ? void 0 : CommitConventionalType.parse(commit.type) ?? (GitmojiCode.isValid(commit.type) ? GitmojiCode.toConventionalCommitType(commit.type) : void 0);
|
|
248
|
-
if (
|
|
248
|
+
if (shouldIgnoreType(conventionalType) && isDiscard) return false;
|
|
249
|
+
if (shouldIgnoreScope(commit.scope)) return false;
|
|
249
250
|
const type = conventionalType == null ? null : displayType(conventionalType, { withEmoji: config.withEmoji });
|
|
250
|
-
if (ignoreScope(commit.scope)) return false;
|
|
251
251
|
const scopeIntermediate = commit.scope === "*" ? "" : commit.scope;
|
|
252
252
|
const scope = config.scopeDisplayName == null ? null : displayScope(scopeIntermediate, config.scopeDisplayName) ?? null;
|
|
253
253
|
const hash = typeof commit.hash === "string" ? commit.hash.slice(0, 7) : commit.hash;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["toConventionalCommitType"],"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 type Unicode = string & { '@@EmojiStyle': 'unicode' };\n export type Text = string & { '@@EmojiStyle': 'text' };\n}\n\nconst reEmojiUnicode = emojiRegexp();\nconst reEmojiText = /:\\w*:/;\n\nconst reMatchOnly = (input: RegExp) => new RegExp(`^${input.source}$`, '');\nconst _reEmojiUnicode = reMatchOnly(reEmojiUnicode);\nconst _reEmojiText = reMatchOnly(reEmojiText);\n\nfunction isUnicode(anyValue: string): anyValue is Emoji.Unicode {\n return _reEmojiUnicode.test(anyValue);\n}\n\nfunction isText(anyValue: string): anyValue is Emoji.Text {\n return _reEmojiText.test(anyValue);\n}\n\nfunction hasInstance(anyValue: string): anyValue is Emoji {\n return isText(anyValue) || isUnicode(anyValue);\n}\n\n/**\n * @namespace\n */\nexport const Emoji = Object.freeze({\n hasInstance,\n isText,\n isUnicode,\n reEmojiText,\n reEmojiUnicode,\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\nconst allGitmojiCodes = new Set(\n gitmojis\n .map((gitmoji) => gitmoji.code as GitmojiCode)\n .concat(gitmojis.map((gitmoji) => gitmoji.emoji as GitmojiCode)),\n);\nconst index = {\n // code: createIndex(gitmojis, 'code'),\n emoji: createIndex(gitmojis, 'emoji'),\n};\n\nfunction 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\nfunction isValid(anyValue: string): anyValue is GitmojiCode {\n return allGitmojiCodes.has(anyValue as GitmojiCode);\n}\n\nconst defaultType = 'chore';\nconst 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\nfunction toConventionalCommitType(gitmoji: GitmojiCode): CommitConventionalType {\n return conversionMap.get(gitmoji) ?? defaultType;\n}\n\n/**\n * @namespace\n */\nexport const GitmojiCode = Object.freeze({\n isValid,\n toConventionalCommitType,\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","export interface ParserOptions {\n headerPattern?: RegExp | string | null;\n headerCorrespondence?: string[] | string | null;\n revertPattern?: RegExp | string | null;\n revertCorrespondence?: string[] | string | null;\n noteKeywords?: string[] | string | null;\n}\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 // eslint-disable-next-line e18e/prefer-static-regex\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","export interface Commit {\n merge: Commit.Field;\n header: Commit.Field;\n body: Commit.Field;\n footer: Commit.Field;\n notes: Commit.Note[];\n references: Commit.Reference[];\n mentions: string[];\n revert: Commit.Revert | null;\n type: string | null;\n subject: string | null;\n scope: string | null;\n hash: string | null;\n}\n\nexport namespace Commit {\n export type Field = string | null;\n\n export interface Note {\n title: string;\n text: string;\n }\n\n export interface Reference {\n issue: string;\n action: Field;\n owner: Field;\n repository: Field;\n prefix: string;\n raw: string;\n }\n\n export interface Revert {\n hash?: Field | undefined;\n header?: Field | undefined;\n [field: string]: Field | undefined;\n }\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 { CommitConventionalType, type Commit } 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 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 { CommitConventionalType, type 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 interface WriterContext {\n repository?: string | undefined;\n host?: string | undefined;\n owner?: string | undefined;\n repoUrl?: string | undefined;\n}\n\nexport interface CommitTransformFunction<TCommit extends Commit = Commit> {\n (commit: Commit, context: WriterContext, ...args: unknown[]): TCommit | false;\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] ?? 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 ?? CommitConventionalType.values());\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 }: WriterContext): 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 { fileURLToPath } from 'node:url';\nimport { createTransform, type CommitTransformFunction } from './transform.js';\nimport { CommitConventionalType, type Commit } from './data.js';\n\nexport interface WriterOptions {\n transform?: CommitTransformFunction<Commit> | undefined;\n groupBy?: string | false | undefined;\n commitGroupsSort?: string | readonly string[] | false | undefined;\n commitsSort?: string | readonly string[] | false | undefined;\n noteGroupsSort?: string | readonly string[] | false | undefined;\n mainTemplate?: string | undefined;\n headerPartial?: string | undefined;\n commitPartial?: string | undefined;\n footerPartial?: string | undefined;\n}\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;AACf,CAAC;;;ACID,MAAM,iBAAiB,YAAY;AACnC,MAAM,cAAc;AAEpB,MAAM,eAAe,UAAkB,IAAI,OAAO,IAAI,MAAM,OAAO,IAAI,EAAE;AACzE,MAAM,kBAAkB,YAAY,cAAc;AAClD,MAAM,eAAe,YAAY,WAAW;AAE5C,SAAS,UAAU,UAA6C;CAC9D,OAAO,gBAAgB,KAAK,QAAQ;AACtC;AAEA,SAAS,OAAO,UAA0C;CACxD,OAAO,aAAa,KAAK,QAAQ;AACnC;AAEA,SAAS,YAAY,UAAqC;CACxD,OAAO,OAAO,QAAQ,KAAK,UAAU,QAAQ;AAC/C;;;;AAKA,MAAa,QAAQ,OAAO,OAAO;CACjC;CACA;CACA;CACA;CACA;AACF,CAAC;AAQD,MAAM,kBAAkB,IAAI,IAC1B,SACG,KAAK,YAAY,QAAQ,IAAmB,CAAC,CAC7C,OAAO,SAAS,KAAK,YAAY,QAAQ,KAAoB,CAAC,CACnE;AACA,MAAM,QAAQ,EAEZ,OAAO,YAAY,UAAU,OAAO,EACtC;AAEA,SAAS,YAAqC,MAA0B,KAA0C;CAChH,OAAO,IAAI,IAAI,KAAK,KAAK,YAAY,CAAC,QAAQ,MAAM,OAAO,CAAC,CAAC;AAC/D;AAEA,SAAS,QAAQ,UAA2C;CAC1D,OAAO,gBAAgB,IAAI,QAAuB;AACpD;AAEA,MAAM,cAAc;AACpB,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QAAQ,cAAc,CAAC,OAAO,IAAI,UAAU,KAAK,CAAC;EAGvF,OAAO;GACL,GAAG;GACH;GACA;GACA;GACA;GACA;GACA,QAAQ,OAAO;GACf,MAAM,OAAO;GACb,QAAQ,OAAO;GACf,OAAO,OAAO;GACd,QAAQ,OAAO;GACf;GACA,UAAU,OAAO;EACnB;CACF;CAEA,OAAO;AACT;;;ACjHA,MAAM,WAAW,OAAO,cAAc,cAAc,SAAS,QAAQ,cAAc,OAAO,KAAK,GAAG,CAAC,IAAI;AACvG,MAAM,WAAW,SAAS,QAAQ,SAAS,QAAQ,QAAQ,GAAG,YAAY;AAE1E,MAAa,sBAAsB,uBAAuB,WAAW,MAAM,EAAE,SAAS;AAEtF,MAAa,mBAAmB,YAAoC;CAClE,MAAM,eAAe,aAAa,GAAG,SAAS,gBAAgB,MAAM;CACpE,MAAM,gBAAgB,aAAa,GAAG,SAAS,cAAc,MAAM;CACnE,MAAM,gBAAgB,aAAa,GAAG,SAAS,cAAc,MAAM;CACnE,MAAM,gBAAgB,aAAa,GAAG,SAAS,cAAc,MAAM;CACnE,MAAM,SAAS,aAAa,GAAG,SAAS,cAAc,MAAM;CAE5D,OAAO;EACL,WAAW,gBAAgB,EACzB,cAAc,oBAChB,CAAC;EACD,SAAS;EACT,kBAAkB;EAElB,aAAa,CAAC,SAAS,SAAS;EAChC,gBAAgB;EAChB;EACA;EAEA,eAAe,cAAc,QAAQ,oBAAoB,MAAM;EAC/D;CACF;AACF;;;ACtCA,eAAsB,eAAe;CACnC,OAAO;EACL;EACA,QAAQ,iBAAiB;EACzB,QAAQ,MAAM,iBAAiB;EAC/B;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["toConventionalCommitType"],"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 type Unicode = string & { '@@EmojiStyle': 'unicode' };\n export type Text = string & { '@@EmojiStyle': 'text' };\n}\n\nconst reEmojiUnicode = emojiRegexp();\nconst reEmojiText = /:\\w*:/;\n\nconst reMatchOnly = (input: RegExp) => new RegExp(`^${input.source}$`, '');\nconst _reEmojiUnicode = reMatchOnly(reEmojiUnicode);\nconst _reEmojiText = reMatchOnly(reEmojiText);\n\nfunction isUnicode(anyValue: string): anyValue is Emoji.Unicode {\n return _reEmojiUnicode.test(anyValue);\n}\n\nfunction isText(anyValue: string): anyValue is Emoji.Text {\n return _reEmojiText.test(anyValue);\n}\n\nfunction hasInstance(anyValue: string): anyValue is Emoji {\n return isText(anyValue) || isUnicode(anyValue);\n}\n\n/**\n * @namespace\n */\nexport const Emoji = Object.freeze({\n hasInstance,\n isText,\n isUnicode,\n reEmojiText,\n reEmojiUnicode,\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\nconst allGitmojiCodes = new Set(\n gitmojis\n .map((gitmoji) => gitmoji.code as GitmojiCode)\n .concat(gitmojis.map((gitmoji) => gitmoji.emoji as GitmojiCode)),\n);\nconst index = {\n // code: createIndex(gitmojis, 'code'),\n emoji: createIndex(gitmojis, 'emoji'),\n};\n\nfunction 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\nfunction isValid(anyValue: string): anyValue is GitmojiCode {\n return allGitmojiCodes.has(anyValue as GitmojiCode);\n}\n\nconst defaultType = 'chore';\nconst 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\nfunction toConventionalCommitType(gitmoji: GitmojiCode): CommitConventionalType {\n return conversionMap.get(gitmoji) ?? defaultType;\n}\n\n/**\n * @namespace\n */\nexport const GitmojiCode = Object.freeze({\n isValid,\n toConventionalCommitType,\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","export interface ParserOptions {\n headerPattern?: RegExp | string | null;\n headerCorrespondence?: string[] | string | null;\n revertPattern?: RegExp | string | null;\n revertCorrespondence?: string[] | string | null;\n noteKeywords?: string[] | string | null;\n}\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 // eslint-disable-next-line e18e/prefer-static-regex\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","export interface Commit {\n merge: Commit.Field;\n header: Commit.Field;\n body: Commit.Field;\n footer: Commit.Field;\n notes: Commit.Note[];\n references: Commit.Reference[];\n mentions: string[];\n revert: Commit.Revert | null;\n type: string | null;\n subject: string | null;\n scope: string | null;\n hash: string | null;\n}\n\nexport namespace Commit {\n export type Field = string | null;\n\n export interface Note {\n title: string;\n text: string;\n }\n\n export interface Reference {\n issue: string;\n action: Field;\n owner: Field;\n repository: Field;\n prefix: string;\n raw: string;\n }\n\n export interface Revert {\n hash?: Field | undefined;\n header?: Field | undefined;\n [field: string]: Field | undefined;\n }\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((left, right) => left.localeCompare(right)));\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 { CommitConventionalType, type Commit } 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 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 { CommitConventionalType, type 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 interface WriterContext {\n repository?: string | undefined;\n host?: string | undefined;\n owner?: string | undefined;\n repoUrl?: string | undefined;\n}\n\nexport interface CommitTransformFunction<TCommit extends Commit = Commit> {\n (commit: Commit, context: WriterContext, ...args: unknown[]): TCommit | false;\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] ?? 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 // eslint-disable-next-line unicorn/no-unreadable-object-destructuring\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 ?? CommitConventionalType.values());\n const shouldIgnoreType = (type: string | undefined) => type == null || !displayTypes.has(type as CommitConventionalType);\n const shouldIgnoreScope = (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 }: WriterContext): Commit | false => {\n const isDiscard = 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 (shouldIgnoreType(conventionalType) && isDiscard) return false;\n\n if (shouldIgnoreScope(commit.scope)) return false;\n\n const type =\n conventionalType == null\n ? null\n : displayType(conventionalType, {\n withEmoji: config.withEmoji,\n });\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 { fileURLToPath } from 'node:url';\nimport { createTransform, type CommitTransformFunction } from './transform.js';\nimport { CommitConventionalType, type Commit } from './data.js';\n\nexport interface WriterOptions {\n transform?: CommitTransformFunction<Commit> | undefined;\n groupBy?: string | false | undefined;\n commitGroupsSort?: string | readonly string[] | false | undefined;\n commitsSort?: string | readonly string[] | false | undefined;\n noteGroupsSort?: string | readonly string[] | false | undefined;\n mainTemplate?: string | undefined;\n headerPartial?: string | undefined;\n commitPartial?: string | undefined;\n footerPartial?: string | undefined;\n}\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;AACf,CAAC;;;ACID,MAAM,iBAAiB,YAAY;AACnC,MAAM,cAAc;AAEpB,MAAM,eAAe,UAAkB,IAAI,OAAO,IAAI,MAAM,OAAO,IAAI,EAAE;AACzE,MAAM,kBAAkB,YAAY,cAAc;AAClD,MAAM,eAAe,YAAY,WAAW;AAE5C,SAAS,UAAU,UAA6C;CAC9D,OAAO,gBAAgB,KAAK,QAAQ;AACtC;AAEA,SAAS,OAAO,UAA0C;CACxD,OAAO,aAAa,KAAK,QAAQ;AACnC;AAEA,SAAS,YAAY,UAAqC;CACxD,OA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nE,MAAM,SAAS,aAAa,GAAG,SAAS,cAAc,MAAM;CAE5D,OAAO;EACL,WAAW,gBAAgB,EACzB,cAAc,oBAChB,CAAC;EACD,SAAS;EACT,kBAAkB;EAElB,aAAa,CAAC,SAAS,SAAS;EAChC,gBAAgB;EAChB;EACA;EAEA,eAAe,cAAc,QAAQ,oBAAoB,MAAM;EAC/D;CACF;AACF;;;ACtCA,eAAsB,eAAe;CACnC,OAAO;EACL;EACA,QAAQ,iBAAiB;EACzB,QAAQ,MAAM,iBAAiB;EAC/B;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/conventional-changelog",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7",
|
|
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",
|
|
@@ -17,12 +17,7 @@
|
|
|
17
17
|
"type": "module",
|
|
18
18
|
"exports": {
|
|
19
19
|
"./package.json": "./package.json",
|
|
20
|
-
".":
|
|
21
|
-
"import": {
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
|
-
"default": "./dist/index.js"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
20
|
+
".": "./dist/index.js",
|
|
26
21
|
"./internal/*": null
|
|
27
22
|
},
|
|
28
23
|
"files": [
|
|
@@ -31,7 +26,6 @@
|
|
|
31
26
|
"src/",
|
|
32
27
|
"index.js",
|
|
33
28
|
"index.d.ts",
|
|
34
|
-
"!*.d.ts.map",
|
|
35
29
|
"!**/*.spec.*",
|
|
36
30
|
"!**/__tests__/**"
|
|
37
31
|
],
|
|
@@ -50,5 +44,5 @@
|
|
|
50
44
|
"access": "public"
|
|
51
45
|
},
|
|
52
46
|
"sideEffect": false,
|
|
53
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "fcde4af12d29afdb46ed396ef832c36a399ed057"
|
|
54
48
|
}
|
package/src/data.ts
CHANGED
|
@@ -67,7 +67,7 @@ export const CommitConventionalType = (() => {
|
|
|
67
67
|
Chore: 'chore',
|
|
68
68
|
});
|
|
69
69
|
// eslint-disable-next-line unicorn/no-array-sort
|
|
70
|
-
const enumValues: readonly CommitConventionalType[] = Object.freeze(Object.values(enumObject).sort());
|
|
70
|
+
const enumValues: readonly CommitConventionalType[] = Object.freeze(Object.values(enumObject).sort((left, right) => left.localeCompare(right)));
|
|
71
71
|
const enumValuesSet = new Set(enumValues);
|
|
72
72
|
|
|
73
73
|
const typeData: Record<CommitConventionalType, CommitConventionalTypeData> = {
|
package/src/transform.ts
CHANGED
|
@@ -33,6 +33,7 @@ export function displayType(type: string, options: displayType.Options = {}): st
|
|
|
33
33
|
const { withEmoji = true, language = 'en-US' } = options;
|
|
34
34
|
|
|
35
35
|
if (CommitConventionalType.hasInstance(type)) {
|
|
36
|
+
// eslint-disable-next-line unicorn/no-unreadable-object-destructuring
|
|
36
37
|
const { emoji, [language]: title } = CommitConventionalType.getData(type);
|
|
37
38
|
return `${withEmoji ? `${emoji} ` : ''}${title}`;
|
|
38
39
|
}
|
|
@@ -48,12 +49,12 @@ export namespace displayType {
|
|
|
48
49
|
|
|
49
50
|
export function createTransform(config: TransformConfig): CommitTransformFunction<Commit> {
|
|
50
51
|
const displayTypes = new Set(config.displayTypes ?? CommitConventionalType.values());
|
|
51
|
-
const
|
|
52
|
-
const
|
|
52
|
+
const shouldIgnoreType = (type: string | undefined) => type == null || !displayTypes.has(type as CommitConventionalType);
|
|
53
|
+
const shouldIgnoreScope = (scope: string | undefined | null) =>
|
|
53
54
|
config.displayScopes == null ? false : scope != null && !config.displayScopes.includes(scope);
|
|
54
55
|
|
|
55
56
|
const transform = (commit: Commit, { repository, host, owner, repoUrl }: WriterContext): Commit | false => {
|
|
56
|
-
const
|
|
57
|
+
const isDiscard = commit.notes.length === 0;
|
|
57
58
|
const issues = new Set<string>();
|
|
58
59
|
const notes = commit.notes.map((note) => ({
|
|
59
60
|
...note,
|
|
@@ -65,7 +66,9 @@ export function createTransform(config: TransformConfig): CommitTransformFunctio
|
|
|
65
66
|
: (CommitConventionalType.parse(commit.type) ??
|
|
66
67
|
(GitmojiCode.isValid(commit.type) ? GitmojiCode.toConventionalCommitType(commit.type) : undefined));
|
|
67
68
|
|
|
68
|
-
if (
|
|
69
|
+
if (shouldIgnoreType(conventionalType) && isDiscard) return false;
|
|
70
|
+
|
|
71
|
+
if (shouldIgnoreScope(commit.scope)) return false;
|
|
69
72
|
|
|
70
73
|
const type =
|
|
71
74
|
conventionalType == null
|
|
@@ -74,8 +77,6 @@ export function createTransform(config: TransformConfig): CommitTransformFunctio
|
|
|
74
77
|
withEmoji: config.withEmoji,
|
|
75
78
|
});
|
|
76
79
|
|
|
77
|
-
if (ignoreScope(commit.scope)) return false;
|
|
78
|
-
|
|
79
80
|
const scopeIntermediate = commit.scope === '*' ? '' : commit.scope;
|
|
80
81
|
const scope =
|
|
81
82
|
config.scopeDisplayName == null ? null : (displayScope(scopeIntermediate, config.scopeDisplayName) ?? null);
|