-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasy_git.sh
47 lines (38 loc) · 923 Bytes
/
easy_git.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env sh
# shellcheck disable=SC2181
# install some useful plugins when git init
check() {
# check git
git_status=$(git status)
if [ $? -ne 0 ]; then
echo "$git_status"
exit 0
fi
# check yarn
_=$(yarn -v)
if [ $? -ne 0 ]; then
echo "Not found yarn installed"
exit 0
fi
}
run() {
# commitizen
yarn global add commitizen
commitizen init cz-conventional-changelog --yarn --dev --exact --force
# changelog
yarn global add conventional-changelog-cli
# check manual commit
yarn add @commitlint/config-conventional @commitlint/cli --dev
echo "module.exports = {extends: ['@commitlint/config-conventional']}" >commitlint.config.js
# wrap git hook
yarn add husky --dev
printf '\nInsert the following into package.json:'
printf '\n\033[00;32m
"husky": {"hooks": {"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"}}
\033[0m\n'
}
main() {
check
run
}
main