From a6a95c905b78edbfcce905419890ad05c9bfe0d3 Mon Sep 17 00:00:00 2001 From: Jerome Fitzgerald Date: Sun, 23 Jun 2024 16:37:03 -0400 Subject: [PATCH] =?UTF-8?q?=E2=8F=AA=EF=B8=8F=20=20NICE-126=20patch=20pack?= =?UTF-8?q?age=20[b]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ccommit/src/data/types.ts | 2 +- .../semantic/src/plugins/commitAnalyzer.ts | 38 +------------------ .../semantic/src/plugins/pluginOptions.ts | 2 +- 3 files changed, 3 insertions(+), 39 deletions(-) diff --git a/packages/ccommit/src/data/types.ts b/packages/ccommit/src/data/types.ts index 496eefd31..75e4c62f9 100644 --- a/packages/ccommit/src/data/types.ts +++ b/packages/ccommit/src/data/types.ts @@ -165,7 +165,7 @@ const types = [ }, { code: ':package:', - description: 'Add or update compiled files or packages', + description: 'Add or Update Compiled Files or Packages', emoji: '📦️', emojiLength: 1, semver: SEMVER.PATCH, diff --git a/packages/semantic/src/plugins/commitAnalyzer.ts b/packages/semantic/src/plugins/commitAnalyzer.ts index ba793f713..44d947932 100644 --- a/packages/semantic/src/plugins/commitAnalyzer.ts +++ b/packages/semantic/src/plugins/commitAnalyzer.ts @@ -3,42 +3,7 @@ import { releaseRules as releaseRulesDefault } from '@jeromefitz/conventional-gi import type { IReleaseRule } from '@jeromefitz/conventional-gitmoji' import type { PluginSpec } from 'semantic-release' -function createWhatBump(config) { - return function whatBump(commits) { - let level = 2 - let breakings = 0 - let features = 0 - - commits.forEach((commit) => { - console.dir(`klfjasdlkfjkladsfjkladsfjlkdasfjlkadsf`) - console.dir(commit) - if (commit.notes.length > 0) { - breakings += commit.notes.length - level = 0 - } else if (commit.type === 'feat' || commit.type === 'feature') { - features += 1 - if (level === 2) { - level = 1 - } - } - }) - - if (config?.preMajor && level < 2) { - level++ - } - - return { - level, - reason: - breakings === 1 - ? `There is ${breakings} BREAKING CHANGE and ${features} features` - : `There are ${breakings} BREAKING CHANGES and ${features} features`, - } - } -} - -const commitAnalyzer = (options): PluginSpec => { - const releaseRulesPassed: IReleaseRule[] = options?.releaseRule || [] +const commitAnalyzer = (releaseRulesPassed: IReleaseRule[] = []): PluginSpec => { const releaseRules = [...releaseRulesDefault, ...releaseRulesPassed] return [ @@ -46,7 +11,6 @@ const commitAnalyzer = (options): PluginSpec => { { config: '@jeromefitz/conventional-gitmoji', releaseRules, - whatBump: createWhatBump(options), }, ] } diff --git a/packages/semantic/src/plugins/pluginOptions.ts b/packages/semantic/src/plugins/pluginOptions.ts index d55a5c254..44b81e756 100644 --- a/packages/semantic/src/plugins/pluginOptions.ts +++ b/packages/semantic/src/plugins/pluginOptions.ts @@ -78,7 +78,7 @@ const getPluginOptions = (optionsPassed?: PluginOptions): PluginSpec[] => { const gitConfig = git(options) const _plugins: any = [ - commitAnalyzer(options), + commitAnalyzer(options.releaseRules), options.enableReleaseNotes ? releaseNotesConfig : '', options.enableReleaseNotesCustom ? releaseNotesCustomConfig : '', options.enableNpm ? npmConfig : '',