mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-15 01:18:26 +08:00
Feat: Rewrite wiki template with reui (#16797)
This commit is contained in:
33
web/scripts/prepare.js
Normal file
33
web/scripts/prepare.js
Normal file
@@ -0,0 +1,33 @@
|
||||
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.
|
||||
}
|
||||
Reference in New Issue
Block a user