Installations
npm install semantic-release-gitmoji
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
20.15.1
NPM Version
10.8.2
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (90.86%)
Handlebars (9.14%)
Developer
momocow
Download Statistics
Total Downloads
7,450,527
Last Day
5,756
Last Week
33,564
Last Month
159,518
Last Year
1,989,205
GitHub Statistics
94 Stars
140 Commits
20 Forks
3 Watching
8 Branches
12 Contributors
Bundle Size
194.68 kB
Minified
60.95 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.6.8
Package Id
semantic-release-gitmoji@1.6.8
Unpacked Size
29.19 kB
Size
9.45 kB
File Count
17
NPM Version
10.8.2
Node Version
20.15.1
Publised On
30 Jul 2024
Total Downloads
Cumulative downloads
Total Downloads
7,450,527
Last day
4.7%
5,756
Compared to previous day
Last week
-12.9%
33,564
Compared to previous week
Last month
-3.7%
159,518
Compared to previous month
Last year
-5.9%
1,989,205
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
12
Peer Dependencies
1
semantic-release-gitmoji
✨🐛💥 A semantic-release plugin for gitmojis.
Different from conventional changelog, Gitmoji commits are used to determine a release type and generate release notes.
Step | Description |
---|---|
analyzeCommits | Determine the type of release by analyzing commits with Gitmoji. |
generateNotes | Generate release notes for the commits added since the last release with Gitmoji. |
Features
- Categorize commits according to Gitmojis
- Progressive commits composed of a final commit and several WIP (🚧) commits
Install
npm install semantic-release-gitmoji -D
Usage
The plugin can be configured in the semantic-release configuration file:
1// in ".releaserc.js" or "release.config.js" 2 3const { promisify } = require('util') 4const dateFormat = require('dateformat') 5const readFileAsync = promisify(require('fs').readFile) 6 7// Given a `const` variable `TEMPLATE_DIR` which points to "<semantic-release-gitmoji>/lib/assets/templates" 8 9// the *.hbs template and partials should be passed as strings of contents 10const template = readFileAsync(path.join(TEMPLATE_DIR, 'default-template.hbs')) 11const commitTemplate = readFileAsync(path.join(TEMPLATE_DIR, 'commit-template.hbs')) 12 13module.exports = { 14 plugins: [ 15 [ 16 'semantic-release-gitmoji', { 17 releaseRules: { 18 major: [ ':boom:' ], 19 minor: [ ':sparkles:' ], 20 patch: [ 21 ':bug:', 22 ':ambulance:', 23 ':lock:' 24 ] 25 }, 26 releaseNotes: { 27 template, 28 partials: { commitTemplate }, 29 helpers: { 30 datetime: function (format = 'UTC:yyyy-mm-dd') { 31 return dateFormat(new Date(), format) 32 } 33 }, 34 issueResolution: { 35 template: '{baseUrl}/{owner}/{repo}/issues/{ref}', 36 baseUrl: 'https://github.com', 37 source: 'github.com', 38 removeFromCommit: false, 39 regex: /#\d+/g 40 } 41 } 42 } 43 ], 44 '@semantic-release/github', 45 '@semantic-release/npm' 46 ] 47}
This configuration is the same semantic as the default configuration of semantic-release-gitmoji
.
semantic-release-gitmoji
should be used in place of both @semantic-release/commit-analyzer
and @semantic-release/release-notes-generator
since the both plugins parse commits following the conventional changelog while this plugin requires Gitmoji commits.
Configuration
It is recommended to write the configuration in a javascript file since templates are required to be string
s of their contents.
1interface SemanticReleaseGitmojiOptions { 2 releaseRules?: ReleaseRules 3 releaseNotes?: ReleaseNotesOptions 4}
ReleaseRules
The ReleaseRules
is a map from a release type to a set of emojis.
1interface ReleaseRules { 2 major?: Array<Emoji> | EmojiArrayModifier 3 premajor?: Array<Emoji> | EmojiArrayModifier 4 minor?: Array<Emoji> | EmojiArrayModifier 5 preminor?: Array<Emoji> | EmojiArrayModifier 6 patch?: Array<Emoji> | EmojiArrayModifier 7 prepatch?: Array<Emoji> | EmojiArrayModifier 8 prerelease?: Array<Emoji> | EmojiArrayModifier 9}
Emoji
Emoji
is a string of valid GitHub emoji markup (e.g. ":boom:"
, ":collision:"
) or raw emoji characters (e.g. "💥"
).
No need to worry about which format to use since this plugin handles it for you!
See https://github.com/omnidan/node-emoji for more information about emojis.
1type Emoji = string
EmojiArrayModifier
1interface EmojiArrayModifier { 2 include?: Array<Emoji> 3 exclude?: Array<Emoji> 4}
ReleaseNotesOptions
ReleaseNotesOptions
defines how to render the release notes from a given set of Gitmoji commits.
All templates file are compiled and renderered by handlebars
, therefore you may need to get familiar with the .hbs
format before starting to customize your own templates.
semver
is a boolean to define if releaseNotes should be based on Gitmoji only or on key semver associated to gitmoji used in commit to determine the next release tag.
partials
is a map from the partial name to the content of the partial template.
helpers
is a map from the helper name to the helper function. There is already a default helper datetime
which takes a format string as the first argument and return a formatted current timestamp. See npm/dateformat for more information about how to format a timestamp and see the default template as an example.
Besides, You are allowed to provide helpers with the same names to override default helpers.
issueResolution
defines how issues are resolved to. The default and the only supported source currently is github.com
, or you can provide your own issueResolution.template
to override the default resolution to GitHub.
There are five variables that can be used in issueResolution.template
:
baseUrl
owner
repo
ref
, which is the numeric ID of issueissue
, which is the full issue
1interface ReleaseNotesOptions { 2 template?: TemplateContent 3 semver?: Boolean 4 partials?: Record<string, TemplateContent> 5 helpers?: Record<string, Function> 6 issueResolution?: { 7 template?: string 8 baseUrl?: string 9 source?: 'github.com' | null // currently only GitHub is supported, PR welcome :) 10 regex?: RegExp, // regex to match the issue(s). If not provided, will find issues thanks to [issue-regex](https://www.npmjs.com/package/issue-regex) 11 removeFromCommit?: boolean // if true, will remove found issue(s) from commit name 12 } 13}
TemplateContent
1type TemplateContent = string | Buffer | Promise<string> | Promise<Buffer>
Templates
Context
The context for templates is inherited from semantic-release
context with some modifications such as owner
, repo
and compareUrl
.
commits
is a map from Emoji
(don't worry about the format) to a list of extended commits.
Values of commits
are extended to contain more information related to Gitmoji. See CommitContext
1interface TemplateContext { 2 owner: string 3 repo: string 4 source: string 5 commits: Record<string, Array<CommitContext>> 6 lastRelease: { 7 gitHead: string 8 version: string 9 gitTag: string 10 } 11 nextRelease: { 12 type: string 13 gitHead: string 14 version: string 15 gitTag: string 16 } 17 compareUrl: string 18}
CommitContext
CommitContext
is extended from SemanticReleaseCommitObj
.
Note that emojis at the beginning of message
and subject
are trimmed, which are the same emoji in gitmoji
.
gitmoji
is a raw emoji since an emoji may have more than one GitHub emoji markup representation, e.g. ":boom:"
and ":collision:"
both represent for th emoji, "💥"
.
1interface CommitContext extends SemanticReleaseCommitObj { 2 message: string 3 subject: string 4 owner: string 5 repo: string 6 source: string 7 gitmoji: string 8 issues: Array<IssueLink> 9 wip: Array<CommitContext> 10}
IssueLink
1interface IssueLink { 2 text: string 3 link: string 4}
Progressive commits
Assume you file an issue (e.g. #1
) to implement a new feature, then you make 3 commits as belows (the toppest is the latest).
✨ Add a new feature.\n\n#1
🚧 Implement part B.\n\n#1
🚧 Implement part A.\n\n#1
The ✨ commit will be the final commit composed of two 🚧 commits. They are linked together via #1
in the commit message.
Therefore the commits
of the template context will be as follows.
1{ 2 "commits": { 3 4 "sparkles": [ 5 { 6 "message": "Add a new feature.\n\n#1", 7 "subject": "Add a new feature.", 8 "body": "#1", 9 "gitmoji": "✨", 10 "// repo": "", 11 "// owner": "", 12 "source": "github.com", 13 "issues": [{ 14 "text": "#1", 15 "// link": "" 16 }], 17 18 "wip": [ 19 { 20 "message": "Implement part B.\n\n#1", 21 "subject": "Implement part B.", 22 "body": "#1", 23 "gitmoji": "🚧", 24 "// repo": "", 25 "// owner": "", 26 "source": "github.com", 27 "issues": [{ 28 "text": "#1", 29 "// link": "" 30 }] 31 }, 32 { 33 "message": "Implement part A.\n\n#1", 34 "subject": "Implement part A.", 35 "body": "#1", 36 "gitmoji": "🚧", 37 "// repo": "", 38 "// owner": "", 39 "source": "github.com", 40 "issues": [{ 41 "text": "#1", 42 "// link": "" 43 }] 44 } 45 ] 46 } 47 ], 48 49 "// other gitmojis": "" 50 } 51}
Commit Syntax
Beside using issue number to link commits, the following syntax is also available to link commits together.
wip#{target_name}
While target_name
is an identifier for those progressive commits, for example, wip#feature-A
.
target_name
can contain numbers, letters (both cases),_
or-
.target_name
should not start with_
or-
.
Contribution
PRs are welcome.
Before sending PRs, please follow the steps below.
- Fork the branch
dev
. - Make commits.
- Run
npm run lint
and ensure you pass the linter. - Run
npm test
and ensure nothing broken.- If you introduce new features in the PR, ensure tests have been written for each feature.
- Send your PR to branch
dev
and wait for reviews.
Thanks for all lovers and contributers of this project!
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
4 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/momocow/semantic-release-gitmoji/release.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/momocow/semantic-release-gitmoji/release.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/momocow/semantic-release-gitmoji/test.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/momocow/semantic-release-gitmoji/test.yaml/main?enable=pin
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 2 out of 2 npmCommand dependencies pinned
Reason
Found 4/25 approved changesets -- score normalized to 1
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/release.yaml:1
- Warn: no topLevel permission defined: .github/workflows/test.yaml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 20 are checked with a SAST tool
Score
3.7
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to semantic-release-gitmoji
semantic-release-config-gitmoji
a gitmoji commit style presets for semantic-release
@dgilperez/semantic-release-gitmoji
Different from conventional changelog, Gitmoji commits are used to determine a release type and generate release notes.
semantic-release-config-gitmoji-module
a gitmoji commit style presets for semantic-release
@wavevision/semantic-release
The Wavevision semantic release setup.