Skip to content

Commit

Permalink
⏪️ NICE-126 patch package [b]
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeFitz committed Jun 23, 2024
1 parent b91512c commit a6a95c9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 39 deletions.
2 changes: 1 addition & 1 deletion packages/ccommit/src/data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
38 changes: 1 addition & 37 deletions packages/semantic/src/plugins/commitAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,14 @@ 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 [
'@semantic-release/commit-analyzer',
{
config: '@jeromefitz/conventional-gitmoji',
releaseRules,
whatBump: createWhatBump(options),
},
]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/semantic/src/plugins/pluginOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 : '',
Expand Down

0 comments on commit a6a95c9

Please sign in to comment.