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

11
.commitlintrc.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', [
"feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"
]],
'scope-empty': [2, 'never'],
'subject-full-stop': [0, 'never'],
'subject-case': [0, 'never']
}
};

2
.gitignore vendored
View File

@ -21,6 +21,8 @@ _output/
/*.nsi /*.nsi
/*.exe /*.exe
/node_modules/
# ros # ros
/wrappers/ros/build /wrappers/ros/build

1648
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

37
package.json Normal file
View File

@ -0,0 +1,37 @@
{
"name": "mynt-eye-s-sdk",
"version": "1.0.0",
"description": "MYNT EYE S SDK",
"main": "index.js",
"directories": {
"doc": "doc",
"test": "test"
},
"dependencies": {},
"devDependencies": {
"@commitlint/cli": "^7.2.1",
"@commitlint/config-conventional": "^7.1.2",
"cz-conventional-changelog": "^2.1.0",
"husky": "^1.3.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/slightech/MYNT-EYE-S-SDK.git"
},
"keywords": [],
"author": "",
"license": "Apache-2.0",
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}

View File

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

View File

@ -15,6 +15,7 @@
_INIT_BUILD_=1 _INIT_BUILD_=1
# _INIT_LINTER_=1 # _INIT_LINTER_=1
# _INIT_COMMITIZEN_=1
# _FORCE_INSRALL_=1 # _FORCE_INSRALL_=1
# _INSTALL_OPTIONS_=-y # _INSTALL_OPTIONS_=-y
@ -146,6 +147,7 @@ else # unexpected
exit 1 exit 1
fi fi
## init linter - optional ## init linter - optional
if [ -n "${_INIT_LINTER_}" ]; then if [ -n "${_INIT_LINTER_}" ]; then
@ -217,3 +219,33 @@ else
fi fi
fi # _INIT_LINTER_ 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_