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

View File

@@ -226,10 +226,6 @@ RUN --mount=type=cache,id=ragflow_uv,target=/root/.cache/uv,sharing=locked \
# Install frontend dependencies — depends only on package manifests so
# web source / docs changes don't invalidate this layer.
COPY web/package.json web/package-lock.json web/.npmrc ./web/
# The `prepare` lifecycle script (npm install) runs `node scripts/prepare.js`,
# so that file must be present before `npm install` or the build fails with
# "Cannot find module '/ragflow/web/scripts/prepare.js'".
COPY web/scripts ./web/scripts
RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked \
cd web && NODE_OPTIONS="--max-old-space-size=8192" npm install

View File

@@ -320,7 +320,7 @@ docker build --platform linux/amd64 \
## 🔨 Launch service from source for development
> [!IMPORTANT]
> After cloning the repository for the first time, run `lefthook install` once from the repo root to enable local Git hooks.
> After cloning the repository for the first time, run `git config --local --unset core.hooksPath`, `uv tool install lefthook` and `lefthook install` once from the repo root to enable local Git hooks.
1. Install `uv`, or skip this step if it is already installed:
@@ -334,6 +334,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # install RAGFlow dependent python modules
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```
3. Launch the dependent services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose:

View File

@@ -331,6 +331,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # install RAGFlow dependent python modules
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```
3. قم بتشغيل الخدمات التابعة (MinIO وElasticsearch وRedis وMySQL) باستخدام Docker Compose:

View File

@@ -322,6 +322,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # install RAGFlow dependent python modules
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```
3. Lancez les services dépendants (MinIO, Elasticsearch, Redis et MySQL) avec Docker Compose :

View File

@@ -303,6 +303,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # install RAGFlow dependent python modules
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```
3. Jalankan aplikasi yang diperlukan (MinIO, Elasticsearch, Redis, dan MySQL) menggunakan Docker Compose:

View File

@@ -304,6 +304,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # install RAGFlow dependent python modules
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```
3. Docker Compose を使用して依存サービスMinIO、Elasticsearch、Redis、MySQLを起動する:

View File

@@ -299,6 +299,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # install RAGFlow dependent python modules
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```

View File

@@ -320,6 +320,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # instala os módulos Python dependentes do RAGFlow
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```
3. Inicie os serviços dependentes (MinIO, Elasticsearch, Redis e MySQL) usando Docker Compose:

View File

@@ -326,6 +326,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # RAGFlow'un bağımlı Python modüllerini yükler
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```
3. Bağımlı hizmetleri (MinIO, Elasticsearch, Redis ve MySQL) Docker Compose kullanarak başlatın:

View File

@@ -331,6 +331,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # install RAGFlow dependent python modules
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```
3. 透過 Docker Compose 啟動依賴的服務MinIO, Elasticsearch, Redis, and MySQL

View File

@@ -331,6 +331,8 @@ docker build --platform linux/amd64 \
cd ragflow/
uv sync --python 3.13 # install RAGFlow dependent python modules
uv run python3 ragflow_deps/download_deps.py
git config --local --unset core.hooksPath
uv tool install lefthook
lefthook install
```

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.
}