Skip to content

A project that forces all GIT commits to adhere to the conventional commits

Notifications You must be signed in to change notification settings

jondjones-poc/conventional-commits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forced Conventional Commits - By Jon D Jones

A project that forces all GIT commits to adhere to the conventional commits standard. It uses commitlint and husky

Install Instructions 👾☄️👻👺🕹️

This guide will tell you how to install from scratch, manually:

Create a GIT repo:

git init

Create a new project:

npm init

Create a .gitignore:

echo node_modules  > .gitignore

Install stuff:

npm install @commitlint/cli --save-dev
npm install @commitlint/config-conventional --save-dev
npm install husky --save-dev

Add some config in package.json:

"scripts": {
    "prepare": "husky install"
}

Create a file called commitlint.config.js. Add this config:

module.exports = {
    extends: ['@commitlint/config-conventional'],
};

Add a husky hook. Create a file:

npx add .husky/commit-msg

In the new file `.husky/commit-msg, paste the below config:

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"

Test It Out

Make a commit. Add your files:

git add .

Test a failed commit:

git commit -m "fail"

test a valid commit:

git commit -m "feat(JIRA-1): hi"

Job done! Happy coding 🤘

About

A project that forces all GIT commits to adhere to the conventional commits

Topics

Resources

Stars

Watchers

Forks