uv tool install lefthook (#16842)

This commit is contained in:
Zhichang Yu
2026-07-13 13:01:33 +08:00
committed by GitHub
parent b0cac0ac9d
commit ed27b5f9f8
14 changed files with 21 additions and 204 deletions

164
web/package-lock.json generated
View File

@@ -168,7 +168,6 @@
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lefthook": "^1.13.6",
"less": "^4.4.2",
"postcss": "^8.5.6",
"postcss-loader": "^8.2.0",
@@ -18894,169 +18893,6 @@
"integrity": "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==",
"license": "MIT"
},
"node_modules/lefthook": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook/-/lefthook-1.13.6.tgz",
"integrity": "sha512-ojj4/4IJ29Xn4drd5emqVgilegAPN3Kf0FQM2p/9+lwSTpU+SZ1v4Ig++NF+9MOa99UKY8bElmVrLhnUUNFh5g==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
"lefthook": "bin/index.js"
},
"optionalDependencies": {
"lefthook-darwin-arm64": "1.13.6",
"lefthook-darwin-x64": "1.13.6",
"lefthook-freebsd-arm64": "1.13.6",
"lefthook-freebsd-x64": "1.13.6",
"lefthook-linux-arm64": "1.13.6",
"lefthook-linux-x64": "1.13.6",
"lefthook-openbsd-arm64": "1.13.6",
"lefthook-openbsd-x64": "1.13.6",
"lefthook-windows-arm64": "1.13.6",
"lefthook-windows-x64": "1.13.6"
}
},
"node_modules/lefthook-darwin-arm64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-darwin-arm64/-/lefthook-darwin-arm64-1.13.6.tgz",
"integrity": "sha512-m6Lb77VGc84/Qo21Lhq576pEvcgFCnvloEiP02HbAHcIXD0RTLy9u2yAInrixqZeaz13HYtdDaI7OBYAAdVt8A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/lefthook-darwin-x64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-darwin-x64/-/lefthook-darwin-x64-1.13.6.tgz",
"integrity": "sha512-CoRpdzanu9RK3oXR1vbEJA5LN7iB+c7hP+sONeQJzoOXuq4PNKVtEaN84Gl1BrVtCNLHWFAvCQaZPPiiXSy8qg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/lefthook-freebsd-arm64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.13.6.tgz",
"integrity": "sha512-X4A7yfvAJ68CoHTqP+XvQzdKbyd935sYy0bQT6Ajz7FL1g7hFiro8dqHSdPdkwei9hs8hXeV7feyTXbYmfjKQQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
]
},
"node_modules/lefthook-freebsd-x64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.13.6.tgz",
"integrity": "sha512-ai2m+Sj2kGdY46USfBrCqLKe9GYhzeq01nuyDYCrdGISePeZ6udOlD1k3lQKJGQCHb0bRz4St0r5nKDSh1x/2A==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
]
},
"node_modules/lefthook-linux-arm64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-linux-arm64/-/lefthook-linux-arm64-1.13.6.tgz",
"integrity": "sha512-cbo4Wtdq81GTABvikLORJsAWPKAJXE8Q5RXsICFUVznh5PHigS9dFW/4NXywo0+jfFPCT6SYds2zz4tCx6DA0Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/lefthook-linux-x64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-linux-x64/-/lefthook-linux-x64-1.13.6.tgz",
"integrity": "sha512-uJl9vjCIIBTBvMZkemxCE+3zrZHlRO7Oc+nZJ+o9Oea3fu+W82jwX7a7clw8jqNfaeBS+8+ZEQgiMHWCloTsGw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/lefthook-openbsd-arm64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-openbsd-arm64/-/lefthook-openbsd-arm64-1.13.6.tgz",
"integrity": "sha512-7r153dxrNRQ9ytRs2PmGKKkYdvZYFPre7My7XToSTiRu5jNCq++++eAKVkoyWPduk97dGIA+YWiEr5Noe0TK2A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
]
},
"node_modules/lefthook-openbsd-x64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-openbsd-x64/-/lefthook-openbsd-x64-1.13.6.tgz",
"integrity": "sha512-Z+UhLlcg1xrXOidK3aLLpgH7KrwNyWYE3yb7ITYnzJSEV8qXnePtVu8lvMBHs/myzemjBzeIr/U/+ipjclR06g==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
]
},
"node_modules/lefthook-windows-arm64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-windows-arm64/-/lefthook-windows-arm64-1.13.6.tgz",
"integrity": "sha512-Uxef6qoDxCmUNQwk8eBvddYJKSBFglfwAY9Y9+NnnmiHpWTjjYiObE9gT2mvGVpEgZRJVAatBXc+Ha5oDD/OgQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/lefthook-windows-x64": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/lefthook-windows-x64/-/lefthook-windows-x64-1.13.6.tgz",
"integrity": "sha512-mOZoM3FQh3o08M8PQ/b3IYuL5oo36D9ehczIw1dAgp1Ly+Tr4fJ96A+4SEJrQuYeRD4mex9bR7Ps56I73sBSZA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/less": {
"version": "4.5.1",
"resolved": "https://registry.npmmirror.com/less/-/less-4.5.1.tgz",

View File

@@ -11,7 +11,6 @@
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
"format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
"lint": "eslint src --ext .ts,.tsx --report-unused-disable-directives",
"prepare": "node scripts/prepare.js",
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
"test": "jest --no-cache --coverage",
@@ -185,7 +184,6 @@
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lefthook": "^1.13.6",
"less": "^4.4.2",
"postcss": "^8.5.6",
"postcss-loader": "^8.2.0",

View File

@@ -1,33 +0,0 @@
import { execSync } from 'node:child_process';
import { dirname, join } from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const repoRoot = dirname(__dirname);
const isWindows = process.platform === 'win32';
// Use the locally installed lefthook binary to avoid relying on a global install or PATH.
const lefthookBin = join(
repoRoot,
'node_modules',
'.bin',
`lefthook${isWindows ? '.cmd' : ''}`,
);
try {
// Verify we are inside a Git repository first.
execSync('git rev-parse --git-dir', {
cwd: repoRoot,
stdio: 'ignore',
});
// Install lefthook hooks from the repository root.
execSync(`"${lefthookBin}" install`, {
cwd: repoRoot,
stdio: 'inherit',
});
} catch {
// Silently ignore failures (not a Git repo or lefthook install failed) so npm install is not interrupted.
}