2
.husky/_/applypatch-msg
Normal file
2
.husky/_/applypatch-msg
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/commit-msg
Normal file
2
.husky/_/commit-msg
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
22
.husky/_/h
Normal file
22
.husky/_/h
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env sh
|
||||
[ "$HUSKY" = "2" ] && set -x
|
||||
n=$(basename "$0")
|
||||
s=$(dirname "$(dirname "$0")")/$n
|
||||
|
||||
[ ! -f "$s" ] && exit 0
|
||||
|
||||
if [ -f "$HOME/.huskyrc" ]; then
|
||||
echo "husky - '~/.huskyrc' is DEPRECATED, please move your code to ~/.config/husky/init.sh"
|
||||
fi
|
||||
i="${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
|
||||
[ -f "$i" ] && . "$i"
|
||||
|
||||
[ "${HUSKY-}" = "0" ] && exit 0
|
||||
|
||||
export PATH="node_modules/.bin:$PATH"
|
||||
sh -e "$s" "$@"
|
||||
c=$?
|
||||
|
||||
[ $c != 0 ] && echo "husky - $n script failed (code $c)"
|
||||
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
|
||||
exit $c
|
||||
9
.husky/_/husky.sh
Normal file
9
.husky/_/husky.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
echo "husky - DEPRECATED
|
||||
|
||||
Please remove the following two lines from $0:
|
||||
|
||||
#!/usr/bin/env sh
|
||||
. \"\$(dirname -- \"\$0\")/_/husky.sh\"
|
||||
|
||||
They WILL FAIL in v10.0.0
|
||||
"
|
||||
2
.husky/_/post-applypatch
Normal file
2
.husky/_/post-applypatch
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/post-checkout
Normal file
2
.husky/_/post-checkout
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/post-commit
Normal file
2
.husky/_/post-commit
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/post-merge
Normal file
2
.husky/_/post-merge
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/post-rewrite
Normal file
2
.husky/_/post-rewrite
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/pre-applypatch
Normal file
2
.husky/_/pre-applypatch
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/pre-auto-gc
Normal file
2
.husky/_/pre-auto-gc
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/pre-commit
Normal file
2
.husky/_/pre-commit
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/pre-merge-commit
Normal file
2
.husky/_/pre-merge-commit
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/pre-push
Normal file
2
.husky/_/pre-push
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/pre-rebase
Normal file
2
.husky/_/pre-rebase
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
2
.husky/_/prepare-commit-msg
Normal file
2
.husky/_/prepare-commit-msg
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/h"
|
||||
52
.husky/pre-push
Normal file
52
.husky/pre-push
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
# 读取 stdin 中的所有内容
|
||||
while read local_ref local_sha remote_ref remote_sha; do
|
||||
# 检查是否是 tag 推送
|
||||
case "$remote_ref" in
|
||||
refs/tags/*)
|
||||
# 提取 tag 名称
|
||||
TAG="${remote_ref#refs/tags/}"
|
||||
|
||||
# 只校验以 "v" 开头的 tag
|
||||
if [[ $TAG == v* ]]; then
|
||||
echo "🏷️ 检查推送的 tag: $TAG"
|
||||
node .husky/scripts/verifyTagVersion.js "$TAG"
|
||||
else
|
||||
echo "ℹ️ 非版本 tag ($TAG),跳过校验"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# 对于普通分支推送,检查最新 tag
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
# 只校验以 "v" 开头的 tag
|
||||
if [[ $LATEST_TAG == v* ]]; then
|
||||
echo "🏷️ 检查最新的 tag: $LATEST_TAG"
|
||||
node .husky/scripts/verifyTagVersion.js "$LATEST_TAG"
|
||||
else
|
||||
echo "ℹ️ 最新 tag ($LATEST_TAG) 不是版本 tag,跳过校验"
|
||||
fi
|
||||
else
|
||||
echo "⚠️ 没有找到任何 tag,跳过版本校验"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# 如果 stdin 为空(没有推送任何引用),也检查最新 tag
|
||||
if [ -t 0 ]; then
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
# 只校验以 "v" 开头的 tag
|
||||
if [[ $LATEST_TAG == v* ]]; then
|
||||
echo "🏷️ 检查最新的 tag: $LATEST_TAG"
|
||||
node .husky/scripts/verifyTagVersion.js "$LATEST_TAG"
|
||||
else
|
||||
echo "ℹ️ 最新 tag ($LATEST_TAG) 不是版本 tag,跳过校验"
|
||||
fi
|
||||
else
|
||||
echo "⚠️ 没有找到任何 tag,跳过版本校验"
|
||||
fi
|
||||
fi
|
||||
30
.husky/scripts/verifyTagVersion.js
Normal file
30
.husky/scripts/verifyTagVersion.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import fs from 'fs';
|
||||
|
||||
try {
|
||||
// 读取 package.json 中的版本号
|
||||
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
|
||||
const packageVersion = packageJson.version;
|
||||
|
||||
// 获取命令行参数中的 tag 名称
|
||||
const tag = process.argv[2];
|
||||
|
||||
if (!tag) {
|
||||
console.log('⚠️ 未提供 tag 参数,跳过版本校验');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// 检查 tag 是否与 package.json 版本匹配
|
||||
const validTags = [`v${packageVersion}`, packageVersion];
|
||||
|
||||
if (!validTags.includes(tag)) {
|
||||
console.log('🏷️ Git tag 版本校验不通过');
|
||||
console.error(`当前 package.json 版本为: ${packageVersion}`);
|
||||
console.error(`提供的 tag 为: ${tag}`);
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log('✅ Git tag 版本校验通过');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ 校验过程中发生错误:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import antfu from '@antfu/eslint-config'
|
||||
|
||||
export default antfu(
|
||||
{
|
||||
ignores: ['**/node_modules', '**/build', '**/public', '**/dist', '**/package.json', '**/*.yaml', '**/.gitignore', '**/.env*', '**/tsconfig*', '**/*.config.js'],
|
||||
ignores: ['**/node_modules', '**/build', '**/.husky', '**/public', '**/dist', '**/package.json', '**/*.yaml', '**/.gitignore', '**/.env*', '**/tsconfig*', '**/*.config.js'],
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
"test:ui": "vitest --ui",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint ./src",
|
||||
"lint:fix": "eslint ./src --fix"
|
||||
"lint:fix": "eslint ./src --fix",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tweenjs/tween.js": "^23.1.2",
|
||||
@@ -68,6 +69,7 @@
|
||||
"@vue/tsconfig": "^0.8.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"baseline-browser-mapping": "^2.8.32",
|
||||
"child_process": "^1.0.2",
|
||||
"daisyui": "^5.1.13",
|
||||
"eslint": "^9.15.0",
|
||||
"eslint-plugin-vue": "^10.4.0",
|
||||
|
||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@@ -156,6 +156,9 @@ importers:
|
||||
baseline-browser-mapping:
|
||||
specifier: ^2.8.32
|
||||
version: 2.8.32
|
||||
child_process:
|
||||
specifier: ^1.0.2
|
||||
version: 1.0.2
|
||||
daisyui:
|
||||
specifier: ^5.1.13
|
||||
version: 5.1.13
|
||||
@@ -2554,6 +2557,9 @@ packages:
|
||||
character-entities@2.0.2:
|
||||
resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==}
|
||||
|
||||
child_process@1.0.2:
|
||||
resolution: {integrity: sha512-Wmza/JzL0SiWz7kl6MhIKT5ceIlnFPJX+lwUGj7Clhy5MMldsSoJR0+uvRzOS5Kv45Mq7t1PoE8TsOA9bzvb6g==}
|
||||
|
||||
chokidar@4.0.1:
|
||||
resolution: {integrity: sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==}
|
||||
engines: {node: '>= 14.16.0'}
|
||||
@@ -8235,6 +8241,8 @@ snapshots:
|
||||
|
||||
character-entities@2.0.2: {}
|
||||
|
||||
child_process@1.0.2: {}
|
||||
|
||||
chokidar@4.0.1:
|
||||
dependencies:
|
||||
readdirp: 4.0.2
|
||||
|
||||
Reference in New Issue
Block a user