mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
🔨 chore: replace husky with native git hooks (#14941)
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
[ "${HUSKY-}" = "0" ] && exit 0
|
||||||
|
|
||||||
|
export PATH="node_modules/.bin:$PATH"
|
||||||
|
|
||||||
BRANCH=$(git branch --show-current)
|
BRANCH=$(git branch --show-current)
|
||||||
if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "main" ]; then
|
if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "main" ]; then
|
||||||
npm run type-check
|
npm run type-check
|
||||||
fi
|
fi
|
||||||
npx --no-install lint-staged
|
|
||||||
|
lint-staged
|
||||||
+1
-1
@@ -96,7 +96,7 @@ sitemap*.xml
|
|||||||
robots.txt
|
robots.txt
|
||||||
|
|
||||||
# Git hooks
|
# Git hooks
|
||||||
.husky/prepare-commit-msg
|
.githooks/prepare-commit-msg
|
||||||
|
|
||||||
# Documents and media
|
# Documents and media
|
||||||
*.pdf
|
*.pdf
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
.history
|
.history
|
||||||
.temp
|
.temp
|
||||||
.env.local
|
.env.local
|
||||||
.husky
|
.githooks
|
||||||
.npmrc
|
.npmrc
|
||||||
.gitkeep
|
.gitkeep
|
||||||
venv
|
venv
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ We utilize stylelint to standardize the style of our CSS code. In the configurat
|
|||||||
|
|
||||||
### Style Checking
|
### Style Checking
|
||||||
|
|
||||||
You don't need to manually run these checks. The project is configured with husky to automatically run lint-staged when you commit code, which will check if your committed files comply with the above standards.
|
You don't need to manually run these checks. The project is configured with Git hooks to automatically run lint-staged when you commit code, which will check if your committed files comply with the above standards.
|
||||||
|
|
||||||
## Contribution Process
|
## Contribution Process
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ Prettier 负责代码格式化,以保证代码的一致性。您可以在 `.pr
|
|||||||
|
|
||||||
### 风格检查
|
### 风格检查
|
||||||
|
|
||||||
你不需要手动运行这些检查,项目配置了 husky 会在您提交代码时自动运行 lint-staged 检查你提交的文件是否符合以上规范。
|
你不需要手动运行这些检查,项目配置了 Git hooks 会在您提交代码时自动运行 lint-staged 检查你提交的文件是否符合以上规范。
|
||||||
|
|
||||||
## 贡献流程
|
## 贡献流程
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -89,7 +89,7 @@
|
|||||||
"lint:style": "stylelint \"{src,tests}/**/*.{js,jsx,ts,tsx}\" --fix",
|
"lint:style": "stylelint \"{src,tests}/**/*.{js,jsx,ts,tsx}\" --fix",
|
||||||
"lint:ts": "eslint src/ tests/ --concurrency=auto",
|
"lint:ts": "eslint src/ tests/ --concurrency=auto",
|
||||||
"lint:unused": "knip --include files,exports,types,enumMembers,duplicates",
|
"lint:unused": "knip --include files,exports,types,enumMembers,duplicates",
|
||||||
"prepare": "husky",
|
"prepare": "git config core.hooksPath .githooks",
|
||||||
"prettier": "prettier -c --write \"**/**\"",
|
"prettier": "prettier -c --write \"**/**\"",
|
||||||
"pull": "git pull",
|
"pull": "git pull",
|
||||||
"qstash": "pnpx @upstash/qstash-cli@latest dev",
|
"qstash": "pnpx @upstash/qstash-cli@latest dev",
|
||||||
@@ -509,7 +509,6 @@
|
|||||||
"fs-extra": "^11.3.3",
|
"fs-extra": "^11.3.3",
|
||||||
"glob": "^13.0.0",
|
"glob": "^13.0.0",
|
||||||
"happy-dom": "^20.3.7",
|
"happy-dom": "^20.3.7",
|
||||||
"husky": "^9.1.7",
|
|
||||||
"import-in-the-middle": "^2.0.5",
|
"import-in-the-middle": "^2.0.5",
|
||||||
"just-diff": "^6.0.2",
|
"just-diff": "^6.0.2",
|
||||||
"knip": "^5.82.1",
|
"knip": "^5.82.1",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ function shouldProceedBuild() {
|
|||||||
":!./*.md" \
|
":!./*.md" \
|
||||||
":!./Dockerfile" \
|
":!./Dockerfile" \
|
||||||
":!./.github" \
|
":!./.github" \
|
||||||
":!./.husky" \
|
":!./.githooks" \
|
||||||
":!./scripts"';
|
":!./scripts"';
|
||||||
|
|
||||||
execSync(diffCommand);
|
execSync(diffCommand);
|
||||||
|
|||||||
Reference in New Issue
Block a user