chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:44:08 +08:00
commit 983960e2dd
1244 changed files with 281996 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import fs from 'node:fs'
import path from 'node:path'
import execa from 'execa'
import { createSetupStatus } from './setup-status'
const GIT_PATH = path.join(process.cwd(), '.git')
const HUSKY_BIN_PATH = path.join(
process.cwd(),
'node_modules',
'.bin',
process.platform === 'win32' ? 'husky.cmd' : 'husky'
)
/**
* Install git hooks through Husky when Leon is inside a git checkout.
*/
export default async function setupGitHooks() {
if (process.env.GITHUB_ACTIONS === 'true' || !fs.existsSync(GIT_PATH)) {
return
}
const status = createSetupStatus('Setting up git hooks...').start()
try {
await execa(HUSKY_BIN_PATH, [], {
stdio: 'ignore'
})
status.succeed('Git hooks: ready')
} catch (error) {
status.fail('Failed to set up git hooks')
throw error
}
}