chore: 更新 pre-commit 针对 Node 环境的检查和 lint-staged 执行
- 增加 Node 环境检查,确保在提交前 Node 可用 - 更新 lint-staged 执行方式以适应新的环境设置 - 清理 index.tsx 文件中的多余空行
This commit is contained in:
@@ -1,3 +1,23 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
set -e
|
set -e
|
||||||
yarn lint-staged
|
cd "$(dirname "$0")/.." || exit 1
|
||||||
|
|
||||||
|
# SourceTree 等 GUI 的 PATH 通常没有 node;先补常见安装位置
|
||||||
|
export PATH="/usr/local/bin:/opt/homebrew/bin:$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
|
if [ -s "$HOME/.nvm/nvm.sh" ]; then
|
||||||
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
. "$HOME/.nvm/nvm.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v fnm >/dev/null 2>&1; then
|
||||||
|
eval "$(fnm env)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v node >/dev/null 2>&1; then
|
||||||
|
echo "pre-commit: 找不到 node,请安装 Node 或在 ~/.husky/pre-commit 里为 PATH 增加 node 所在目录。" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec node ./node_modules/lint-staged/bin/lint-staged.js
|
||||||
|
|||||||
@@ -179,7 +179,6 @@ export default function HomePage() {
|
|||||||
>
|
>
|
||||||
{sidebarContent}
|
{sidebarContent}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user