UNPKG

bun-git-hooks

Version:

A modern, zero dependency tool for managing git hooks in Bun projects.

64 lines (62 loc) 2.91 kB
import type { GitHooksConfig, SetHooksFromConfigOptions, StagedLintConfig } from './types'; declare const execAsync: unknown; export declare const VALID_GIT_HOOKS: Array< 'applypatch-msg' | 'pre-applypatch' | 'post-applypatch' | 'pre-commit' | 'pre-merge-commit' | 'prepare-commit-msg' | 'commit-msg' | 'post-commit' | 'pre-rebase' | 'post-checkout' | 'post-merge' | 'pre-push' | 'pre-receive' | 'update' | 'proc-receive' | 'post-receive' | 'post-update' | 'reference-transaction' | 'push-to-checkout' | 'pre-auto-gc' | 'post-rewrite' | 'sendemail-validate' | 'fsmonitor-watchman' | 'p4-changelist' | 'p4-prepare-changelist' | 'p4-post-changelist' | 'p4-pre-submit' | 'post-index-change' >; export declare const VALID_OPTIONS: Array<'preserveUnused' | 'verbose' | 'staged-lint'>; export declare const PREPEND_SCRIPT: unknown; export declare function getGitProjectRoot(directory?: string): string | undefined; export declare function checkBunGitHooksInDependencies(projectRootPath: string): boolean; declare function _getPackageJson(projectPath?: any): void; export declare function setHooksFromConfig(projectRootPath?: string, options?: SetHooksFromConfigOptions): void; declare function getStagedFiles(projectRoot?: string): Promise<string[]>; declare function expandBracePattern(pattern: string): string[]; declare const results: string[]; declare function matchesGlob(file: string, pattern: string): boolean; declare function filterFilesByPattern(files: string[], pattern: string): string[]; declare function runCommandOnStagedFiles(command: string | string[], files: string[], projectRoot?: string, verbose?: boolean): Promise<boolean>; declare function processStagedLint(stagedLintConfig: StagedLintConfig, projectRoot: string, verbose?: boolean): Promise<boolean>; declare function _setHook(hook: string, commandOrConfig: string | { stagedLint?: StagedLintConfig; 'staged-lint'?: StagedLintConfig }, projectRoot: string = process.cwd()): void; export declare function removeHooks(projectRoot?: string, verbose?: boolean): void; declare function _removeHook(hook: string, projectRoot?: any, verbose?: boolean): void; export declare function runStagedLint(hook: string): Promise<boolean>; declare function _validateHooks(config: Record<string, any>): boolean; declare function _validateStagedLintConfig(config: GitHooksConfig): void; declare const gitHooks: { PREPEND_SCRIPT: typeof PREPEND_SCRIPT setHooksFromConfig: typeof setHooksFromConfig removeHooks: typeof removeHooks checkBunGitHooksInDependencies: typeof checkBunGitHooksInDependencies getProjectRootDirectoryFromNodeModules: typeof getProjectRootDirectoryFromNodeModules getGitProjectRoot: typeof getGitProjectRoot runStagedLint: typeof runStagedLint getStagedFiles: typeof getStagedFiles }; export default gitHooks;