From ed27b5f9f8a7fcc59dd2095e2452ec4183638679 Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Mon, 13 Jul 2026 13:01:33 +0800 Subject: [PATCH] uv tool install lefthook (#16842) --- Dockerfile | 4 - README.md | 4 +- README_ar.md | 2 + README_fr.md | 2 + README_id.md | 2 + README_ja.md | 2 + README_ko.md | 2 + README_pt_br.md | 2 + README_tr.md | 2 + README_tzh.md | 2 + README_zh.md | 2 + web/package-lock.json | 164 ----------------------------------------- web/package.json | 2 - web/scripts/prepare.js | 33 --------- 14 files changed, 21 insertions(+), 204 deletions(-) delete mode 100644 web/scripts/prepare.js diff --git a/Dockerfile b/Dockerfile index aba74318a9..27cd035f82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 260462e458..fcc4101200 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/README_ar.md b/README_ar.md index 1bb0106f2b..451aeaa690 100644 --- a/README_ar.md +++ b/README_ar.md @@ -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: diff --git a/README_fr.md b/README_fr.md index 1a4e8370ff..a5043260e8 100644 --- a/README_fr.md +++ b/README_fr.md @@ -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 : diff --git a/README_id.md b/README_id.md index f3d55b2615..5043f98eef 100644 --- a/README_id.md +++ b/README_id.md @@ -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: diff --git a/README_ja.md b/README_ja.md index b727d5e0c5..e9aef30ab6 100644 --- a/README_ja.md +++ b/README_ja.md @@ -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)を起動する: diff --git a/README_ko.md b/README_ko.md index 05063e4f95..a975ed5113 100644 --- a/README_ko.md +++ b/README_ko.md @@ -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 ``` diff --git a/README_pt_br.md b/README_pt_br.md index e08177edfc..4eb06c4511 100644 --- a/README_pt_br.md +++ b/README_pt_br.md @@ -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: diff --git a/README_tr.md b/README_tr.md index a53514b1ec..51a6273fb2 100644 --- a/README_tr.md +++ b/README_tr.md @@ -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: diff --git a/README_tzh.md b/README_tzh.md index b6cc830bcc..164cf95e7e 100644 --- a/README_tzh.md +++ b/README_tzh.md @@ -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): diff --git a/README_zh.md b/README_zh.md index bfc23deb73..015d2f819b 100644 --- a/README_zh.md +++ b/README_zh.md @@ -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 ``` diff --git a/web/package-lock.json b/web/package-lock.json index d993e77f10..2d642bcede 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -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", diff --git a/web/package.json b/web/package.json index ae3dee7983..3a3a6ba849 100644 --- a/web/package.json +++ b/web/package.json @@ -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", diff --git a/web/scripts/prepare.js b/web/scripts/prepare.js deleted file mode 100644 index 2d679a8cd4..0000000000 --- a/web/scripts/prepare.js +++ /dev/null @@ -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. -}