Skip to content

Commit

Permalink
Merge pull request #56 from momocow/dev
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
momocow authored Jan 12, 2023
2 parents f53f316 + 1f6ed2b commit e314393
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
14 changes: 13 additions & 1 deletion lib/helper/parse-commits.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ function parseIssuesAndTasks ({ message = '' } = {}, options) {
}
}

const IMAGE_STYLE_SELECTOR = String.fromCharCode(0xfe0f)

/**
* Newer version of gitmojis may contains selector 0xfe0f (image style)
* however we need to support gitmoji from older version of gitmojis
*
* @see https://github.com/carloscuesta/gitmoji/pull/753
*/
function matchEmoji (emoji) {
return (spec) => spec.emoji === emoji || spec.emoji === emoji + IMAGE_STYLE_SELECTOR
}

function parseGitmoji ({ subject = '', message = '', body = '' } = {}, issues = []) {
subject = emojify(subject.trim())
if (issues.length > 0) {
Expand All @@ -35,7 +47,7 @@ function parseGitmoji ({ subject = '', message = '', body = '' } = {}, issues =
if (!matched || matched.index !== 0) return null

const gitmoji = matched[0]
const semver = gitmojis.find(item => item.emoji === gitmoji).semver || 'other'
const semver = gitmojis.find(matchEmoji(gitmoji)).semver || 'other'
subject = subject.replace(new RegExp('^' + gitmoji), '')

return { subject, message: subject + '\n\n' + body, gitmoji, semver }
Expand Down
8 changes: 3 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-standard": "^4.0.1",
"gitmoji-cli": "^7.0.3",
"gitmojis": "^3.13.1",
"lodash.set": "^4.3.2",
"lodash.shuffle": "^4.2.0",
"semantic-release": "^19.0.2",
Expand All @@ -52,6 +51,7 @@
"debug": "^4.3.2",
"emoji-regex": "^9.2.2",
"git-url-parse": "^13.0.0",
"gitmojis": "^3.13.1",
"handlebars": "^4.7.6",
"issue-regex": "^3.1.0",
"lodash.clonedeep": "^4.5.0",
Expand All @@ -66,4 +66,4 @@
"lib",
"index.js"
]
}
}

0 comments on commit e314393

Please sign in to comment.