(build)添加git提交前执行pre-commit钩子的husky和lint-staged工具

This commit is contained in:
wangchangqi 2022-11-07 09:14:01 +08:00
parent f83d35cf64
commit 1a0698b47b
3 changed files with 18 additions and 4 deletions

6
.husky/pre-commit Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
yarn lint-staged
yarn build
yarn build:vite

View File

@ -19,16 +19,24 @@
"format": "npm run format:prettier",
"format:prettier": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --write"
},
"lint-staged": {
"*.{cjs,html,js,json,md,ts}": [
"prettier --write",
"git add"
]
},
"dependencies": {
"lit": "^2.2.7"
},
"devDependencies": {
"prettier": "^2.7.1",
"vite": "^3.0.0",
"esbuild": "^0.15.8",
"fast-glob": "^3.2.12",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"tslib": "^2.4.0",
"typescript": "^4.8.3"
"typescript": "^4.8.3",
"vite": "^3.0.0"
},
"workspaces": [
"src/components/*",

View File

@ -32,7 +32,7 @@ export class IconControlBar extends LitElement {
@property({type: Boolean}) active = false
@property({type: Boolean}) longPress = false
@property({type: Boolean}) isNameShown = false
@state({}) timer!: NodeJS.Timeout
@state({}) timer!: number
@query('.more-info-icon') moreInfoIcon!: HTMLDivElement
@query('.icon-button') iconBtn!: HTMLDivElement