Comparing version 3.3.3 to 3.3.4
@@ -0,1 +1,13 @@ | ||
# v3.3.4 (Tue Apr 07 2020) | ||
#### 🐛 Bug Fix | ||
- fix files type [#48](https://github.com/domharrington/node-gitlog/pull/48) ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
#### Authors: 1 | ||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
--- | ||
# v3.3.3 (Tue Apr 07 2020) | ||
@@ -2,0 +14,0 @@ |
@@ -87,14 +87,18 @@ /// <reference types="node" /> | ||
declare type GitlogError = ExecException | string | null; | ||
declare type CommitBase<Field extends string> = Record<Field, string>; | ||
declare type CommitBaseWithFiles<Field extends string> = Record<Field | "status", string> & { | ||
files: string[]; | ||
}; | ||
declare function gitlog<Fields extends readonly CommitField[] = DefaultField[]>(userOptions: GitlogOptions<Fields> & { | ||
nameStatus: false; | ||
}, cb: (err: GitlogError, commits: Record<Fields[number], string>[]) => void): void; | ||
declare function gitlog<Fields extends readonly CommitField[] = DefaultField[]>(userOptions: GitlogOptions<Fields>, cb: (err: GitlogError, commits: Record<Fields[number] | "files" | "status", string>[]) => void): void; | ||
}, cb: (err: GitlogError, commits: CommitBase<Fields[number]>[]) => void): void; | ||
declare function gitlog<Fields extends readonly CommitField[] = DefaultField[]>(userOptions: GitlogOptions<Fields>, cb: (err: GitlogError, commits: CommitBaseWithFiles<Fields[number]>[]) => void): void; | ||
declare function gitlog<Fields extends readonly CommitField[] = DefaultField[]>(userOptions: GitlogOptions<Fields> & { | ||
nameStatus: false; | ||
}): Record<Fields[number], string>[]; | ||
declare function gitlog<Fields extends readonly CommitField[] = DefaultField[]>(userOptions: GitlogOptions<Fields>): Record<Fields[number] | "files" | "status", string>[]; | ||
export declare function gitlogPromise<Fields extends readonly CommitField[] = DefaultField[], Commit extends Record<Fields[number], string> = Record<Fields[number], string>>(options: GitlogOptions<Fields> & { | ||
}): CommitBase<Fields[number]>[]; | ||
declare function gitlog<Fields extends readonly CommitField[] = DefaultField[]>(userOptions: GitlogOptions<Fields>): CommitBaseWithFiles<Fields[number]>[]; | ||
export declare function gitlogPromise<Fields extends readonly CommitField[] = DefaultField[]>(options: GitlogOptions<Fields> & { | ||
nameStatus: false; | ||
}): Promise<Commit[]>; | ||
export declare function gitlogPromise<Fields extends readonly CommitField[] = DefaultField[], Commit extends Record<Fields[number] | "files" | "status", string> = Record<Fields[number] | "files" | "status", string>>(options: GitlogOptions<Fields>): Promise<Commit[]>; | ||
}): Promise<CommitBase<Fields[number]>[]>; | ||
export declare function gitlogPromise<Fields extends readonly CommitField[] = DefaultField[]>(options: GitlogOptions<Fields>): Promise<CommitBaseWithFiles<Fields[number]>[]>; | ||
export default gitlog; |
{ | ||
"name": "gitlog", | ||
"version": "3.3.3", | ||
"version": "3.3.4", | ||
"description": "Git log parser for Node.JS", | ||
@@ -5,0 +5,0 @@ "module": "dist/gitlog.esm.js", |
@@ -138,3 +138,3 @@ import { exec, execSync, ExecSyncOptions, ExecException } from "child_process"; | ||
) => { | ||
type Commit = Partial<Record<T | NotOptField, any>>; | ||
type Commit = Record<T | NotOptField, any>; | ||
@@ -182,3 +182,3 @@ return commits.map((rawCommit) => { | ||
const parsed: Commit = {}; | ||
const parsed: Partial<Commit> = {}; | ||
@@ -214,3 +214,3 @@ if (nameStatus) { | ||
return parsed; | ||
return parsed as Commit; | ||
}); | ||
@@ -278,5 +278,11 @@ }; | ||
type CommitBase<Field extends string> = Record<Field, string>; | ||
type CommitBaseWithFiles<Field extends string> = Record< | ||
Field | "status", | ||
string | ||
> & { files: string[] }; | ||
function gitlog<Fields extends readonly CommitField[] = DefaultField[]>( | ||
userOptions: GitlogOptions<Fields> & { nameStatus: false }, | ||
cb: (err: GitlogError, commits: Record<Fields[number], string>[]) => void | ||
cb: (err: GitlogError, commits: CommitBase<Fields[number]>[]) => void | ||
): void; | ||
@@ -286,6 +292,3 @@ | ||
userOptions: GitlogOptions<Fields>, | ||
cb: ( | ||
err: GitlogError, | ||
commits: Record<Fields[number] | "files" | "status", string>[] | ||
) => void | ||
cb: (err: GitlogError, commits: CommitBaseWithFiles<Fields[number]>[]) => void | ||
): void; | ||
@@ -295,12 +298,17 @@ | ||
userOptions: GitlogOptions<Fields> & { nameStatus: false } | ||
): Record<Fields[number], string>[]; | ||
): CommitBase<Fields[number]>[]; | ||
function gitlog<Fields extends readonly CommitField[] = DefaultField[]>( | ||
userOptions: GitlogOptions<Fields> | ||
): Record<Fields[number] | "files" | "status", string>[]; | ||
): CommitBaseWithFiles<Fields[number]>[]; | ||
function gitlog<Fields extends readonly CommitField[] = DefaultField[]>( | ||
userOptions: GitlogOptions<Fields>, | ||
cb?: (err: GitlogError, commits: Record<Fields[number], string>[]) => void | ||
): Record<Fields[number], string>[] | void { | ||
cb?: | ||
| ((err: GitlogError, commits: CommitBase<Fields[number]>[]) => void) | ||
| (( | ||
err: GitlogError, | ||
commits: CommitBaseWithFiles<Fields[number]>[] | ||
) => void) | ||
): CommitBase<Fields[number]>[] | CommitBaseWithFiles<Fields[number]>[] | void { | ||
if (!userOptions.repo) { | ||
@@ -352,18 +360,17 @@ throw new Error("Repo required!"); | ||
export function gitlogPromise< | ||
Fields extends readonly CommitField[] = DefaultField[], | ||
Commit extends Record<Fields[number], string> = Record<Fields[number], string> | ||
>(options: GitlogOptions<Fields> & { nameStatus: false }): Promise<Commit[]>; | ||
Fields extends readonly CommitField[] = DefaultField[] | ||
>( | ||
options: GitlogOptions<Fields> & { nameStatus: false } | ||
): Promise<CommitBase<Fields[number]>[]>; | ||
export function gitlogPromise< | ||
Fields extends readonly CommitField[] = DefaultField[], | ||
Commit extends Record<Fields[number] | "files" | "status", string> = Record< | ||
Fields[number] | "files" | "status", | ||
string | ||
> | ||
>(options: GitlogOptions<Fields>): Promise<Commit[]>; | ||
Fields extends readonly CommitField[] = DefaultField[] | ||
>( | ||
options: GitlogOptions<Fields> | ||
): Promise<CommitBaseWithFiles<Fields[number]>[]>; | ||
export function gitlogPromise< | ||
Fields extends readonly CommitField[] = DefaultField[], | ||
Commit extends Record<Fields[number], string> = Record<Fields[number], string> | ||
>(options: GitlogOptions<Fields>): Promise<Commit[]> { | ||
return new Promise<Commit[]>((resolve, reject) => { | ||
Fields extends readonly CommitField[] = DefaultField[] | ||
>(options: GitlogOptions<Fields>): Promise<CommitBase<Fields[number]>[]> { | ||
return new Promise((resolve, reject) => { | ||
gitlog(options, (err, commits) => { | ||
@@ -373,3 +380,3 @@ if (err) { | ||
} else { | ||
resolve(commits as Commit[]); | ||
resolve(commits); | ||
} | ||
@@ -376,0 +383,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109979
1120