Skip to content

Commit

Permalink
chore: add husky & commitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
lingbopro committed Dec 7, 2024
1 parent 991a3ce commit 8154d2d
Show file tree
Hide file tree
Showing 4 changed files with 772 additions and 1 deletion.
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
24 changes: 24 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export default {
// NOTE: we follow the Conventional Commits specification
// view full specification on https://www.conventionalcommits.org/en/v1.0.0
extends: ['@commitlint/config-conventional'],
rules: {
// types declared in Conventional Commits specification & @commitlint/config-conventional
// see: https://www.conventionalcommits.org/en/v1.0.0/#summary
'type-enum': [2, 'always', ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test']],
'scope-enum': [
2,
'always',
// scopes
// see: https://www.conventionalcommits.org/en/v1.0.0/#specification
[
// folder name in src/
'core',
'utils',
// component names
// add component name here when adding new component
'page',
],
],
},
};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"./utils/*": "./dist/utils/*.js"
},
"scripts": {
"build": "node dev/build.js"
"build": "node dev/build.js",
"prepare": "husky"
},
"author": {
"name": "lingbopro",
Expand All @@ -30,8 +31,11 @@
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-terser": "^0.4.4",
"husky": "^9.1.7",
"rollup": "^4.27.4",
"rollup-plugin-string": "^3.0.0",
"typescript": "^5.7.2"
Expand Down
Loading

0 comments on commit 8154d2d

Please sign in to comment.