@dev-build-deploy/commit-it
Version:
(Conventional) Commits library
85 lines (84 loc) • 2.06 kB
TypeScript
/**
* String data source options
* @interface IStringDataSourceOptions
* @member hash The commit hash
* @member author The commit author and date
* @member commiter The commit commiter and date
* @member message The commit message
*/
export interface IStringDataSourceOptions {
hash: string;
author?: {
name: string;
date: Date;
};
committer?: {
name: string;
date: Date;
};
message: string;
}
/**
* Name and Date type
*/
export type NameAndDateType = {
name: string;
date: Date;
};
/**
* Git Commit
* @class Commit
* @member author The commit author and date
* @member commiter The commit commiter and date
* @member hash The commit hash
* @member subject The commit subject
* @member body The commit body
* @member footer The commit footer
* @member raw The commit message
*/
export declare class Commit {
private _commit;
private constructor();
/**
* Retrieves the commit information from git using the provided hash
* @param props The commit hash and root path
* @returns The commit object
*/
static fromHash(props: {
hash: string;
rootPath?: string;
}): Commit;
/**
* Creates a Commit object from the provided string
* @param props The commit hash, author, committer and message
* @returns The commit object
*/
static fromString(props: {
hash: string;
message: string;
author?: {
name: string;
date: Date;
};
committer?: {
name: string;
date: Date;
};
}): Commit;
get author(): {
name: string;
date: Date;
} | undefined;
get committer(): {
name: string;
date: Date;
} | undefined;
get hash(): string;
get subject(): string;
get body(): string | undefined;
get footer(): Record<string, string> | undefined;
get raw(): string;
get isFixupCommit(): boolean;
get isMergeCommit(): boolean;
toJSON(): ICommit;
}