Skip to content

Commit 789981f

Browse files
authored
Integrate wizardoc to the project (#6)
* [Feat::hooks] config husky to get commit message before send commit * [Feat] integrate wizardoc convention
1 parent 30a1a8c commit 789981f

File tree

6 files changed

+51
-0
lines changed

6 files changed

+51
-0
lines changed

.husky/_/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/_/husky.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
if [ -z "$husky_skip_init" ]; then
3+
debug () {
4+
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
5+
}
6+
7+
readonly hook_name="$(basename "$0")"
8+
debug "starting $hook_name..."
9+
10+
if [ "$HUSKY" = "0" ]; then
11+
debug "HUSKY env variable is set to 0, skipping hook"
12+
exit 0
13+
fi
14+
15+
if [ -f ~/.huskyrc ]; then
16+
debug "sourcing ~/.huskyrc"
17+
. ~/.huskyrc
18+
fi
19+
20+
export readonly husky_skip_init=1
21+
sh -e "$0" "$@"
22+
exitCode="$?"
23+
24+
if [ $exitCode != 0 ]; then
25+
echo "husky - $hook_name hook exited with code $exitCode (error)"
26+
exit $exitCode
27+
fi
28+
29+
exit 0
30+
fi

.husky/commit-msg

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

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: 'wizardoc'
3+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@commitlint/config-conventional": "^12.1.4",
1515
"@commitlint/types": "^12.1.4",
1616
"@types/jest": "^26.0.23",
17+
"commitlint-config-wizardoc": "^1.0.0",
1718
"jest": "^27.0.1",
1819
"jest-config": "^27.0.1",
1920
"lerna": "^4.0.0",

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,6 +2224,18 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6:
22242224
dependencies:
22252225
delayed-stream "~1.0.0"
22262226

2227+
commitlint-config-wizardoc@^1.0.0:
2228+
version "1.0.0"
2229+
resolved "https://registry.npmjs.org/commitlint-config-wizardoc/-/commitlint-config-wizardoc-1.0.0.tgz#d8f4372b75667ee8b553f1b6fa6eed9553e42a93"
2230+
integrity sha512-ecOER5XBrTZVVIzRyXfGQMoe8C4OQevP4lYFK/HwB5jhFgCAX1TXiASYQLwgq4iU1hQcHMBc2inHVitVqRadHA==
2231+
dependencies:
2232+
commitlint-plugin-wizardoc-rules "^1.0.0"
2233+
2234+
commitlint-plugin-wizardoc-rules@^1.0.0:
2235+
version "1.0.0"
2236+
resolved "https://registry.npmjs.org/commitlint-plugin-wizardoc-rules/-/commitlint-plugin-wizardoc-rules-1.0.0.tgz#3f6e8a42d42b31c7897a91bc224b85132768324b"
2237+
integrity sha512-V7NT3egc4LXBYeNtKnYYFtCAb8/3vlea9xNlky4r41HUHC9mx5w6mnKe7NQAucllkLGyYDL/FRt51UiyujrYPg==
2238+
22272239
compare-func@^2.0.0:
22282240
version "2.0.0"
22292241
resolved "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz"

0 commit comments

Comments
 (0)