Skip to content

Commit c80ab34

Browse files
committed
ci: add commitlint and husky
1 parent 409cf70 commit c80ab34

File tree

5 files changed

+39
-3
lines changed

5 files changed

+39
-3
lines changed

.github/workflows/commitlint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Lint Commit Messages
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
commitlint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
- uses: wagoid/commitlint-github-action@v5

.github/workflows/lint.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Lint tests
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
37
jobs:
48
build:
59
name: Lint tests (node latest)

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run eslint
5+
npm run stylelint

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"build": "webpack",
2121
"watch": "webpack --watch",
2222
"stylelint": "stylelint index.scss 'src/**/*.scss'",
23-
"prepublishOnly": "npm run test && rm ./dist/* && NODE_ENV=production npm run build"
23+
"prepublishOnly": "npm run test && rm ./dist/* && NODE_ENV=production npm run build",
24+
"prepare": "husky install"
2425
},
2526
"repository": {
2627
"type": "git",
@@ -38,7 +39,10 @@
3839
"is-plain-object": "^2.0.4"
3940
},
4041
"devDependencies": {
41-
"@osjs/dev-meta": "^2.1.0"
42+
"@commitlint/cli": "^17.1.2",
43+
"@commitlint/config-conventional": "^17.1.0",
44+
"@osjs/dev-meta": "^2.1.0",
45+
"husky": "^8.0.1"
4246
},
4347
"bugs": {
4448
"url": "https://github.com/os-js/osjs-dialogs/issues"
@@ -85,5 +89,10 @@
8589
"name": "esdoc-publish-html-plugin"
8690
}
8791
]
92+
},
93+
"commitlint": {
94+
"extends": [
95+
"@commitlint/config-conventional"
96+
]
8897
}
8998
}

0 commit comments

Comments
 (0)