UNPKG

changelog-guru

Version:
40 lines (39 loc) 1.38 kB
import { Package } from 'package-json-helper'; import { GitServiceProvider } from '../Config.js'; import { ICommit } from '../entities/Commit.js'; export declare enum Branch { Main = "main", Dev = "dev" } export interface IGitProvider { readonly branch: IGitBranch; readonly package: string; readonly type: GitServiceProvider; getCommits(since: Date): Promise<ICommit[]>; getCurrentPackage(since: Date): Promise<Package>; getLastChangeDate(dev?: boolean): Promise<Date>; getPreviousPackage(since: Date): Promise<Package>; } export interface IGitBranch { [Branch.Dev]: string; [Branch.Main]: string; } export interface IGitProviderOptions { branch?: string; type: GitServiceProvider; url: string; } export default abstract class GitProvider implements IGitProvider { readonly branch: IGitBranch; readonly package = "package.json"; readonly type: GitServiceProvider; protected owner: string; protected repository: string; protected userAgent: string; protected version: string | undefined; constructor({ type, url, branch }: IGitProviderOptions); abstract getCommits(since: Date): Promise<ICommit[]>; abstract getCurrentPackage(since: Date): Promise<Package>; abstract getLastChangeDate(dev?: boolean): Promise<Date>; abstract getPreviousPackage(since: Date): Promise<Package>; }