feat: add husky & commitlint
Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
This commit is contained in:
parent
609b0c9163
commit
33b135518e
5 changed files with 39 additions and 3 deletions
21
.husky/commit-msg
Executable file
21
.husky/commit-msg
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
NAME=$(git config user.name)
|
||||
EMAIL=$(git config user.email)
|
||||
|
||||
if [ -z "$NAME" ]; then
|
||||
echo "empty git config user.name"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$EMAIL" ]; then
|
||||
echo "empty git config user.email"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git interpret-trailers --if-exists doNothing --trailer \
|
||||
"Signed-off-by: $NAME <$EMAIL>" \
|
||||
--in-place "$1"
|
||||
|
||||
npm exec --no -- commitlint --edit $1
|
||||
4
.husky/pre-push
Executable file
4
.husky/pre-push
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npm exec --no -- lint-staged --no-stash
|
||||
3
commitlint.config.cjs
Normal file
3
commitlint.config.cjs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
extends: ['@commitlint/config-conventional'],
|
||||
};
|
||||
4
lint-staged.config.cjs
Normal file
4
lint-staged.config.cjs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'*.{js,ts}': 'npm run lint:js',
|
||||
'*.{yml}': 'npm run lint:yml',
|
||||
};
|
||||
10
package.json
10
package.json
|
|
@ -8,11 +8,12 @@
|
|||
"scripts": {
|
||||
"test": "mocha test/**.js --timeout 10000",
|
||||
"lint:yml": "yamllint --schema=CORE_SCHEMA *.{yml,yaml}",
|
||||
"lint:js": "npm run lint:prettier",
|
||||
"lint:js:fix": "npm run lint:prettier:fix",
|
||||
"lint:prettier": "prettier --check \"{,!(node_modules|dist|static)/**/}*.{js,ts,cjs,mjs,json}\" --ignore-path .gitignore",
|
||||
"lint:prettier:fix": "prettier --write \"{,!(node_modules|dist|static)/**/}*.{js,ts,cjs,mjs,json}\" --ignore-path .gitignore",
|
||||
"lint": "npm run lint:prettier",
|
||||
"lintfix": "npm run lint:prettier:fix",
|
||||
"docker": "docker build -f Dockerfile . && docker run --rm -i -p 8080:80 $(docker build -q .)"
|
||||
"docker": "docker build -f Dockerfile . && docker run --rm -i -p 8080:80 $(docker build -q .)",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mapbox/glyph-pbf-composite": "0.0.3",
|
||||
|
|
@ -40,7 +41,10 @@
|
|||
"sanitize-filename": "1.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.1.2",
|
||||
"@commitlint/config-conventional": "^17.1.0",
|
||||
"chai": "4.3.6",
|
||||
"husky": "^8.0.1",
|
||||
"mocha": "^10.0.0",
|
||||
"prettier": "^2.7.1",
|
||||
"should": "^13.2.3",
|
||||
|
|
|
|||
Loading…
Reference in a new issue