chore(config): add commit constraint

This commit is contained in:
John Zhao
2018-12-20 09:13:57 +08:00
parent 3ead1a0c07
commit 827b313378
6 changed files with 1731 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
# _VERBOSE_=1
# _INIT_LINTER_=1
# _INIT_COMMITIZEN_=1
# _FORCE_INSRALL_=1
_INSTALL_OPTIONS_=$@

View File

@@ -15,6 +15,7 @@
_INIT_BUILD_=1
# _INIT_LINTER_=1
# _INIT_COMMITIZEN_=1
# _FORCE_INSRALL_=1
# _INSTALL_OPTIONS_=-y
@@ -146,6 +147,7 @@ else # unexpected
exit 1
fi
## init linter - optional
if [ -n "${_INIT_LINTER_}" ]; then
@@ -217,3 +219,33 @@ else
fi
fi # _INIT_LINTER_
## init commitizen - optional
if [ -n "${_INIT_COMMITIZEN_}" ]; then
if _detect_cmd npm; then
_echo_d "npm install commitizen -g"
npm install commitizen -g
if _detect_cmd node; then
commitizen init cz-conventional-changelog --save-dev --save-exact
npm install --save-dev @commitlint/{config-conventional,cli}
npm install husky --save-dev
else
_echo_en "Skipped commitizen init, as node not found"
fi
else
_echo_en "Skipped npm install packages, as npm not found"
_echo
_echo_e "Download Node.js from https://nodejs.org/, then add to \`~/.bashrc\`."
_echo
_echo_e " export PATH=\"/home/john/node-v10.14.2-linux-x64/bin:\$PATH\""
_echo
_echo_e "p.s. not \"apt-get install npm\", it's too old."
fi
# npm install
fi # _INIT_COMMITIZEN_