import { Component, TextFile } from "projen"; import { NodeProject } from "projen/lib/javascript"; import { DeepRequired } from "../util/deep-required"; import { Dynamic } from "../util/dynamic"; /** * see https://git-scm.com/docs/githooks */ export declare type HuskyHook = "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"; /** * option to enable or disable husky and commands to run for each hook */ export declare type HuskyOptions = { /** * enable or disable husky * * @default true */ husky?: boolean; huskyHooks?: Partial>; }; /** * adds husky to the project, which manages git hooks * * see https://typicode.github.io/ and https://git-scm.com/docs/githooks */ export declare class Husky extends Component { static defaultOptions: Dynamic, NodeProject>; options: DeepRequired; hooks?: Partial>; /** * adds husky to the project * * @param project the project to add to * @param options - see `HuskyOptions` */ constructor(project: NodeProject, options?: Dynamic); /** * adds husky to the project */ preSynthesize(): void; /** * adds the lines to the specified hook * * @param hook to hook to add to * @param {...any} lines the new lines to add */ addHook(hook: HuskyHook, ...lines: string[]): void; /** * replaces the specified hook * * @param hook the hook to override * @param {...any} lines the new lines */ overrideHook(hook: HuskyHook, ...lines: string[]): void; /** * removes the specified hook * * @param hook the hook to delete */ deleteHook(hook: HuskyHook): void; /** * get the list of all the hook names * * @returns the hook names */ getHookNames(): string[]; }