• Stars
    star
    211
  • Rank 186,867 (Top 4 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Git Conventional Commits Util to generate Semantic Version and Markdown Change Log and Validate Commit Messag

Git Conventional Commits Sparkline

npm

Have a look at Git Commit Conventions

Changelog

see CHANGELOG.md

Install

npm install --global git-conventional-commits

Usage

  • Create config file git-conventional-commits init
  • Adjust config git-conventional-commits.yaml to your needs

Commands

add help parameter -h to commands to list all possible options

  init [options]                               creates a config file template `git-conventional-commits.yaml`
  version [options]                            determine version from conventional commits
  changelog [options]                          generate change log from conventional commits
  commit-msg-hook [options] <commit-msg-file>  check for conventional commit message format

Config File

Example git-conventional-commits.yaml

---
convention:
  commitTypes:
  - feat
  - fix
  - perf
  - refactor
  - style
  - test
  - build
  - ops
  - docs
  - merge
  commitScopes: []
  releaseTagGlobPattern: v[0-9]*.[0-9]*.[0-9]*
changelog:
  commitTypes:
  - feat
  - fix
  - perf
  - merge
  includeInvalidCommits: true
  commitScopes: []
  commitIgnoreRegexPattern: "^WIP "
  headlines:
    feat: Features
    fix: Bug Fixes
    perf: Performance Improvements
    merge: Merges
    breakingChange: BREAKING CHANGES
  commitUrl: https://github.com/qoomon/git-conventional-commits/commit/%commit%
  commitRangeUrl: https://github.com/qoomon/git-conventional-commits/compare/%from%...%to%?diff=split
  issueRegexPattern: "#[0-9]+"
  issueUrl: https://github.com/qoomon/git-conventional-commits/issues/%issue%
  • convention

    • commitTypes an array of expected commit types
      • show warnings for unexpected types
      • if not set or empty commit type validation is disabled
      • e.g. ["feat", "fix", "doc", "style"]
    • commitScopes an array of expected commit types
      • show warnings for unexpected scopes
      • if not set or empty commit scope validation is disabled
      • e.g. ["ui", "database"]
    • releaseTagGlobPattern glob pattern to filter for release tags
      • release tags must contain semantic version ([0-9]+\.[0-9]+\.[0-9]+)
      • default *
    • issueRegexPattern regex pattern to find issue IDs
      • e.g. Jira issue pattern [A-Z]{3,}-\\d+
  • changelog

    • commitTypes filter commits by type
      • a subset of convention.commitTypes plus
        • merge commits
      • if not set or empty commit type filter is disabled
      • e.g. ["feat", "fix", "merge"]
    • commitScopes filter commits by scopes
      • a subset of convention.commitScopes
      • if not set or empty commit scope filter is disabled
      • e.g. ["ui"]
    • includeInvalidCommits include commits without valid type: default: true
      • if set to false all commits with undefined commitTypes will be removed from changelog
    • commitIgnoreRegexPattern filter commits by commit subject regex
      • default ^WIP
    • headlines a map of headline identifier and actual headline
      • a subset of changelog.commitTypes plus
        • breakingChange Breaking Changes Section
      • e.g. { "feat": "Features", "fix": "Bug Fixes", "breakingChange": "BREAKING CHANGES"}
      • default { "feat": "Features", "fix": "Bug Fixes", "merge": "Merges", "breakingChange": "BREAKING CHANGES"}
    • commitUrl an URL template for generating markdown links to repository commits
      • %commit% commit hash placeholder
      • eg https://github.com/qoomon/git-conventional-commits/commit/%commit%
      • if not set or empty link generation is disabled
    • issueUrl an URL template for generating markdown links to an issue tracker
      • %issue% issue id placeholder
      • eg https://jira.example.org/browse/%issue%
      • if not set or empty link generation is disabled

Automatically Validate Commit Message Convention before Commit

To automatically validate commit messages, a git hook can be used in the commit-msg stage. The hook can be created either manually or using the pre-commit framework.

Setup with the pre-commit framework

  • Create .pre-commit-config.yaml file in the root directory of your repository with following content.
    repos:
    - repo: https://github.com/qoomon/git-conventional-commits
      rev: <revision e.g. v2.1.0>
      hooks:
        - id: conventional-commits
  • Install the pre-commit framework pip install pre-commit
  • Install the commit-msg hook pre-commit install -t commit-msg

Setup manually

  • Setup Commit Message Hook to
    • Navigate to your repository directory cd <repository-path>
    • Create git hook directory mkdir .git-hooks
    • Set update hooksPath git config core.hooksPath .git-hooks
    • Create commit message hook script and make it executable
      • touch .git-hooks/commit-msg && chmod +x .git-hooks/commit-msg
      • Open .git-hooks/commit-msg with your favorite editor and paste following script
        #!/bin/sh
        
        # fix for windows systems
        PATH="/c/Program Files/nodejs:$HOME/AppData/Roaming/npm/:$PATH"
        
        git-conventional-commits commit-msg-hook "$1"
    • Add and commit .git-hooks/commit-msg to repository
    • ⚠️ Whenever you clone your repository with git hooks you need to enable git hooks once again
      • git config core.hooksPath .git-hooks

Release Workflow with git-conventional-commits

  • Determine version by git-conventional-commits version
  • Update version in project files
    • Commit version bump git commit -am'build(release): bump project version to <version>'
  • Generate change log by git-conventional-commits changelog --release <version> --file 'CHANGELOG.md'
    • Commit change log git commit -am'docs(release): create <version> change log entry'
  • Tag commit with version git tag -a -m'build(release): <version>' '<version-prefix><version>'
  • Push all changes git push
  • Build and upload artifacts

Build/Release

  • npm install
  • npm test
  • npm login
  • npm publish

More Repositories

1

docker-host

A docker sidecar container to forward all traffic to local docker host or any other host
Shell
1,027
star
2

maven-git-versioning-extension

This extension will set project version, based on current Git branch or tag.
Java
278
star
3

aws-s3-bucket-browser

Single page application to browse AWS S3 bucket content
HTML
181
star
4

aws-ssm-ec2-proxy-command

AWS SSM EC2 SSH Proxy Command
PowerShell
180
star
5

otp-authenticator-webapp

A 'Google Authenticator' like Single Page Application
JavaScript
93
star
6

zsh-lazyload

zsh plugin for lazy load commands and speed up start up time of zsh
Shell
78
star
7

gradle-git-versioning-plugin

This extension will set project version, based on current Git branch or tag.
Java
77
star
8

Jira-Issue-Card-Printer

Beautiful Issue Card Printer
JavaScript
69
star
9

banking-swift-messages-java

Banking SWIFT Library, MT Format Message Parser Writer SWIFT(Society for Worldwide Interbank Financial Telecommunication)
Java
29
star
10

time-timer-webapp

A CountDown and CountUp Timer
JavaScript
25
star
11

smart-life-webapp

JavaScript
20
star
12

my-zsh

handy and beautiful ZSH config
Shell
17
star
13

github-actions-access-manager

Manage access from GitHub actions workflows.
JavaScript
11
star
14

zjump

Simplify zsh directory navigation; jump to already visited, parent or sub folders.
Shell
10
star
15

zgem

zsh dependency manager 🐚 💎
Shell
10
star
16

unchecked-exceptions-java

Throw any Java Exception anywhere without the need of catching them nor wrapping them into RuntimeException
Java
7
star
17

aws-session

A CLI to generate and store session credentials in ~/.aws/credentials file, based on ~/.aws/config profiles
Python
6
star
18

aws-ec2-ssh-iam

AWS IAM managed EC2 SSH access
JavaScript
4
star
19

vercel-cors-proxy

JavaScript
3
star
20

gmail-rss-feed

Google Scripts Project to generate a RSS feed based on labeled emails
JavaScript
3
star
21

chrome-tab-multiselect-extension

JavaScript
3
star
22

meeting-cash-creep

Vue
3
star
23

userscript-kleinanzeigen-duplicate-ad

JavaScript
3
star
24

actions-publish-to-github-pages

GitHub Action to Publish Directory to GitHub Pages
Shell
3
star
25

chrome-tab-shift-extension

This extension will add a shortcuts to shift tabs.
JavaScript
2
star
26

junit-extension

Java JUnit Utils and Extentions
Java
2
star
27

domain-value-java

Domain Values
Java
2
star
28

zsh-theme-qoomon

zsh prompt theme
Shell
2
star
29

qoomon

About
2
star
30

zsh-history-search

zsh-history-search
Shell
2
star
31

aws-configure

A CLI to configure AWS named profiles in ~/.aws/config and ~/.aws/credentials files
Python
2
star
32

threema-web-desktop-app

Threema Standalone Web App with Dark and Light Mode Support
JavaScript
2
star
33

userscript-jira-dependency-indicators

JavaScript
2
star
34

kotlin-examples

Kotlin
2
star
35

userscript-aws-visual-account-indicator

This userscript reads the aws-userInfo cookie and adds account name and color indicator
JavaScript
2
star
36

aws-lambda-gitlab-webhook-to-datadog

JavaScript
2
star
37

userscript-jira-colored-labels

JavaScript
2
star
38

maven-enforcer-rules

maven-enforcer-rules
Java
2
star
39

chrome-tab-toggle-extension

This extension will add a shortcut to toggle through recent active tabs.
JavaScript
2
star
40

.github

1
star
41

chrome-new-tab-extension

Open neat blank page as 'New Tab' Page
HTML
1
star
42

chrome-search-engine-blocker-extension

Prevents Chrome from adding new search engines by opensearch link and search auto detection
JavaScript
1
star
43

diceware-webapp

HTML
1
star
44

userscript-disable-open-search

JavaScript
1
star
45

yolo-secret

TypeScript
1
star
46

chrome-show-password-extension

JavaScript
1
star
47

actions--set-env

TypeScript
1
star
48

cdn

cdn
JavaScript
1
star
49

self-signed-https-proxy

Shell
1
star
50

passphrase-generator

dice passphrase generator
Shell
1
star
51

google-chrome-launcher

Shell
1
star
52

chrome-tab-duplicate-extension

This extension will add a shortcut to duplicate tab.
JavaScript
1
star