Conventional Commit 강제하기
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Conventional Commits . . . features, fixes, breaking changes SemVer(Semantic Version ) .
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.
MAJOR.MINOR.PATCH .
1. API MAJOR ,
2. MINOR
3. PATCH .
MAJOR.MINOR.PATCH .
. . ( )
In the world of software management there exists a dreaded place called dependency hell. The bigger your system grows and the more packages you integrate into your software, the more likely you are to find yourself, one day, in this pit of despair.
husky + commitlint + commitizen
Conventional Commitgit-hook
webpack/webpack angular/angular angular/angular-cli angular/components vercel/hyper blitz-js/blitz facebook/docusaurus typescript-eslint/typescript-eslint 11ty/eleventy stylelint/stylelint rollup/rollup tauri-apps/tauri NativeScript/NativeScript formatjs/formatjs react-bootstrap/react-bootstrap react-dnd/react-dnd react-grid-layout/react-grid-layout snabbdom/snabbdom logaretm/vee-validate zenorocha/clipboard.js NodeBB/NodeBB ant-design/ant-design And more
husky commit message
commit message
npm i -D husky @commitlint/cli @commitlint/config-conventional
package.json
Life Cycle scripts postinstall
npm i
husky
"script": {
"postinstall": "husky install"
}
commitlint.config.ts
import type { UserConfig } from '@commitlint/types'
const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
}
module.exports = Configuration
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit "$1"
package.json
scripts commit
( )"scripts": {
"commit": "npx cz-customizable"
}
.cz-config.js
typeEnumconst typeEnums = {
feat: ' ',
fix: ' / ',
docs: ' ',
markup: ' ',
revert: ' ',
style: ' ',
remove: ' ',
perf: ' ',
ci: 'CI ',
event: ' ',
config: ' / ',
}
const maxSpaceLength = Object.keys(typeEnums).reduce(
(acc, { length }) => (length > acc ? length : acc),
0,
)
const commitizenConfig = {
types: Object.entries(typeEnums).map(([type, description]) => ({
value: type,
name: `${type}: ${' '.repeat(maxSpaceLength - type.length)}` + description,
})),
}
module.exports = commitizenConfig
.cz-config.js
import type { UserConfig } from '@commitlint/types'
import commitizenConfig from './.cz-config.js'
const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', commitizenConfig.types.map(({ value }) => value)],
'type-case': [2, 'always', 'lower-case'],
'scope-empty': [2, 'never'],
},
}
module.exports = Configuration
github-actions semantic-release
CI - CD .