bun-git-hooks 0.2.12 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -10
- package/dist/bin/cli.js +5152 -594
- package/dist/bin/git-hooks.d.ts +13 -4
- package/dist/bin/types.d.ts +10 -37
- package/dist/git-hooks.d.ts +13 -4
- package/dist/index.js +4704 -507
- package/dist/types.d.ts +10 -37
- package/package.json +6 -17
package/dist/bin/git-hooks.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { SetHooksFromConfigOptions } from './types';
|
|
1
|
+
import type { SetHooksFromConfigOptions, StagedLintConfig } from './types';
|
|
2
2
|
|
|
3
|
+
declare const execAsync: unknown;
|
|
3
4
|
export declare const VALID_GIT_HOOKS: Array<
|
|
4
5
|
'applypatch-msg' |
|
|
5
6
|
'pre-applypatch' |
|
|
@@ -30,16 +31,22 @@ export declare const VALID_GIT_HOOKS: Array<
|
|
|
30
31
|
'p4-pre-submit' |
|
|
31
32
|
'post-index-change'
|
|
32
33
|
>;
|
|
33
|
-
export declare const VALID_OPTIONS: Array<'preserveUnused'>;
|
|
34
|
+
export declare const VALID_OPTIONS: Array<'preserveUnused' | 'verbose' | 'staged-lint'>;
|
|
34
35
|
export declare const PREPEND_SCRIPT: unknown;
|
|
35
36
|
export declare function getGitProjectRoot(directory: string): string | undefined;
|
|
36
37
|
export declare function checkBunGitHooksInDependencies(projectRootPath: string): boolean;
|
|
37
38
|
declare function _getPackageJson(projectPath): void;
|
|
38
39
|
export declare function setHooksFromConfig(projectRootPath: string, options?: SetHooksFromConfigOptions): void;
|
|
39
|
-
declare function
|
|
40
|
+
declare function getStagedFiles(projectRoot: string): Promise<string[]>;
|
|
41
|
+
declare function matchesGlob(file: string, pattern: string): boolean;
|
|
42
|
+
declare function filterFilesByPattern(files: string[], pattern: string): string[];
|
|
43
|
+
declare function runCommandOnStagedFiles(command: string | string[], files: string[], projectRoot: string, verbose): Promise<boolean>;
|
|
44
|
+
declare function processStagedLint(stagedLintConfig: StagedLintConfig, projectRoot: string, verbose): Promise<boolean>;
|
|
45
|
+
declare function _setHook(hook: string, commandOrConfig: string | { stagedLint?: StagedLintConfig; 'staged-lint'?: StagedLintConfig }, projectRoot: string): void;
|
|
40
46
|
export declare function removeHooks(projectRoot: string, verbose): void;
|
|
41
47
|
declare function _removeHook(hook: string, projectRoot, verbose): void;
|
|
42
|
-
declare function
|
|
48
|
+
export declare function runStagedLint(hook: string): Promise<boolean>;
|
|
49
|
+
declare function _validateHooks(config: Record<string, any>): boolean;
|
|
43
50
|
declare const gitHooks: {
|
|
44
51
|
PREPEND_SCRIPT: typeof PREPEND_SCRIPT
|
|
45
52
|
setHooksFromConfig: typeof setHooksFromConfig
|
|
@@ -47,6 +54,8 @@ declare const gitHooks: {
|
|
|
47
54
|
checkBunGitHooksInDependencies: typeof checkBunGitHooksInDependencies
|
|
48
55
|
getProjectRootDirectoryFromNodeModules: typeof getProjectRootDirectoryFromNodeModules
|
|
49
56
|
getGitProjectRoot: typeof getGitProjectRoot
|
|
57
|
+
runStagedLint: typeof runStagedLint
|
|
58
|
+
getStagedFiles: typeof getStagedFiles
|
|
50
59
|
};
|
|
51
60
|
|
|
52
61
|
export default gitHooks;
|
package/dist/bin/types.d.ts
CHANGED
|
@@ -1,45 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
export declare type StagedLintTask = string | string[]
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
height: number
|
|
6
|
-
data: T
|
|
7
|
-
}
|
|
8
|
-
export declare interface BufferRet {
|
|
9
|
-
data: Buffer | Uint8ClampedArray
|
|
10
|
-
width: number
|
|
11
|
-
height: number
|
|
12
|
-
exifBuffer?: ArrayBuffer
|
|
13
|
-
comments?: string[]
|
|
14
|
-
}
|
|
15
|
-
export declare type UintArrRet = ImageData & {
|
|
16
|
-
exifBuffer?: ArrayBuffer
|
|
17
|
-
comments?: string[]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ImageData {
|
|
21
|
-
width: number
|
|
22
|
-
height: number
|
|
23
|
-
data: Uint8ClampedArray | Buffer
|
|
24
|
-
colorSpace?: 'srgb'
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type BufferLike = Buffer | Uint8Array | ArrayLike<number> | Iterable<number> | ArrayBuffer
|
|
28
|
-
|
|
29
|
-
export interface DecoderOptions {
|
|
30
|
-
useTArray: boolean
|
|
31
|
-
colorTransform?: boolean
|
|
32
|
-
formatAsRGBA?: boolean
|
|
33
|
-
tolerantDecoding?: boolean
|
|
34
|
-
maxResolutionInMP?: number
|
|
35
|
-
maxMemoryUsageInMB?: number
|
|
3
|
+
export interface StagedLintConfig {
|
|
4
|
+
[pattern: string]: StagedLintTask
|
|
36
5
|
}
|
|
37
6
|
|
|
38
7
|
export type GitHooksConfig = {
|
|
39
|
-
[K in typeof VALID_GIT_HOOKS[number]]?: string
|
|
8
|
+
[K in typeof VALID_GIT_HOOKS[number]]?: string | {
|
|
9
|
+
'stagedLint'?: StagedLintConfig
|
|
10
|
+
'staged-lint'?: StagedLintConfig
|
|
11
|
+
}
|
|
40
12
|
} & {
|
|
41
|
-
preserveUnused?: boolean | typeof VALID_GIT_HOOKS[number][]
|
|
42
|
-
verbose?: boolean
|
|
13
|
+
'preserveUnused'?: boolean | typeof VALID_GIT_HOOKS[number][]
|
|
14
|
+
'verbose'?: boolean
|
|
15
|
+
'staged-lint'?: StagedLintConfig
|
|
43
16
|
}
|
|
44
17
|
|
|
45
18
|
export interface SetHooksFromConfigOptions {
|
package/dist/git-hooks.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { SetHooksFromConfigOptions } from './types';
|
|
1
|
+
import type { SetHooksFromConfigOptions, StagedLintConfig } from './types';
|
|
2
2
|
|
|
3
|
+
declare const execAsync: unknown;
|
|
3
4
|
export declare const VALID_GIT_HOOKS: Array<
|
|
4
5
|
'applypatch-msg' |
|
|
5
6
|
'pre-applypatch' |
|
|
@@ -30,16 +31,22 @@ export declare const VALID_GIT_HOOKS: Array<
|
|
|
30
31
|
'p4-pre-submit' |
|
|
31
32
|
'post-index-change'
|
|
32
33
|
>;
|
|
33
|
-
export declare const VALID_OPTIONS: Array<'preserveUnused'>;
|
|
34
|
+
export declare const VALID_OPTIONS: Array<'preserveUnused' | 'verbose' | 'staged-lint'>;
|
|
34
35
|
export declare const PREPEND_SCRIPT: unknown;
|
|
35
36
|
export declare function getGitProjectRoot(directory: string): string | undefined;
|
|
36
37
|
export declare function checkBunGitHooksInDependencies(projectRootPath: string): boolean;
|
|
37
38
|
declare function _getPackageJson(projectPath): void;
|
|
38
39
|
export declare function setHooksFromConfig(projectRootPath: string, options?: SetHooksFromConfigOptions): void;
|
|
39
|
-
declare function
|
|
40
|
+
declare function getStagedFiles(projectRoot: string): Promise<string[]>;
|
|
41
|
+
declare function matchesGlob(file: string, pattern: string): boolean;
|
|
42
|
+
declare function filterFilesByPattern(files: string[], pattern: string): string[];
|
|
43
|
+
declare function runCommandOnStagedFiles(command: string | string[], files: string[], projectRoot: string, verbose): Promise<boolean>;
|
|
44
|
+
declare function processStagedLint(stagedLintConfig: StagedLintConfig, projectRoot: string, verbose): Promise<boolean>;
|
|
45
|
+
declare function _setHook(hook: string, commandOrConfig: string | { stagedLint?: StagedLintConfig; 'staged-lint'?: StagedLintConfig }, projectRoot: string): void;
|
|
40
46
|
export declare function removeHooks(projectRoot: string, verbose): void;
|
|
41
47
|
declare function _removeHook(hook: string, projectRoot, verbose): void;
|
|
42
|
-
declare function
|
|
48
|
+
export declare function runStagedLint(hook: string): Promise<boolean>;
|
|
49
|
+
declare function _validateHooks(config: Record<string, any>): boolean;
|
|
43
50
|
declare const gitHooks: {
|
|
44
51
|
PREPEND_SCRIPT: typeof PREPEND_SCRIPT
|
|
45
52
|
setHooksFromConfig: typeof setHooksFromConfig
|
|
@@ -47,6 +54,8 @@ declare const gitHooks: {
|
|
|
47
54
|
checkBunGitHooksInDependencies: typeof checkBunGitHooksInDependencies
|
|
48
55
|
getProjectRootDirectoryFromNodeModules: typeof getProjectRootDirectoryFromNodeModules
|
|
49
56
|
getGitProjectRoot: typeof getGitProjectRoot
|
|
57
|
+
runStagedLint: typeof runStagedLint
|
|
58
|
+
getStagedFiles: typeof getStagedFiles
|
|
50
59
|
};
|
|
51
60
|
|
|
52
61
|
export default gitHooks;
|