many many fixes
This commit is contained in:
15
scripts/install-hooks.mjs
Normal file
15
scripts/install-hooks.mjs
Normal file
@@ -0,0 +1,15 @@
|
||||
// Points git at the repo's .githooks directory. Runs on `npm install`
|
||||
// (the "prepare" script). Never fails, so installs work without git
|
||||
// (e.g. CI / Nixpacks builds).
|
||||
import { execSync } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
|
||||
try {
|
||||
if (!fs.existsSync('.git')) process.exit(0);
|
||||
execSync('git config core.hooksPath .githooks', { stdio: 'ignore' });
|
||||
// Make sure the hook is executable on macOS/Linux
|
||||
try { fs.chmodSync('.githooks/pre-commit', 0o755); } catch {}
|
||||
console.log('Git hooks installed (.githooks)');
|
||||
} catch {
|
||||
// git not available: skip silently
|
||||
}
|
||||
Reference in New Issue
Block a user