UNPKG

@better-builds/lets-version

Version:

A package that reads your conventional commits and git history and recommends (or applies) a SemVer version bump for you

116 lines (115 loc) 4.64 kB
import { GitCommit, GitCommitWithConventionalAndPackageInfo, PackageInfo, PublishTagInfo } from './types.js'; /** * Fetches all tracking information from origin. * Most importantly, this tries to detect whether we're currently * in a shallow clone. */ export declare function gitFetchAll(cwd?: string): Promise<void>; /** * Pulls in all tags from origin and forces local to be updated */ export declare function gitFetchAllTags(cwd?: string): Promise<void>; export interface GitCommitsSinceOpts { commitDateFormat?: string; cwd?: string; since?: string; relPath?: string; } /** * Returns commits since a particular git SHA or tag. * If the "since" parameter isn't provided, all commits * from the dawn of man are returned */ export declare function gitCommitsSince(opts?: GitCommitsSinceOpts): Promise<GitCommit[]>; /** * Grabs the full list of all tags available on upstream */ export declare function gitRemoteTags(cwd?: string): Promise<Array<[string, string]>>; /** * Grabs the full list of all tags available locally */ export declare function gitLocalTags(cwd?: string): Promise<Array<[string, string]>>; /** * Given a package info object, returns a formatted string * that can be safely used as a git version tag */ export declare function formatVersionTagForPackage(packageInfo: PackageInfo): string; /** * Given a javascript package info object, checks to see if there's * a git tag for its current version. If it's found, its SHA is returned. * If one for the current version is not found, all existing tags are scanned * to find the closest match, and that is returned. If one isn't found, null * is returned. */ export declare function gitLastKnownPublishTagInfoForPackage(packageInfo: PackageInfo, cwd?: string): Promise<PublishTagInfo | null>; /** * Checks to see if there is a Git tag used for the last publish for a list of packages */ export declare function getLastKnownPublishTagInfoForAllPackages(packages: PackageInfo[], noFetchTags: boolean, cwd?: string): Promise<PublishTagInfo[]>; /** * Given a specific git sha, finds all files that have been modified * since the sha and returns the absolute filepaths */ export declare function gitAllFilesChangedSinceSha(sha: string, cwd?: string): Promise<string[]>; /** * Given an input of parsed git tag infos, * returns all the files that have changed since any of these git tags * have occured, with duplicates removed */ export declare function getAllFilesChangedSinceTagInfos(filteredPackages: PackageInfo[], tagInfos: PublishTagInfo[], cwd?: string): Promise<string[]>; /** * Given an input of the "main" branch name, * returns all the files that have changed since the current branch was created */ export declare function getAllFilesChangedSinceBranch(filteredPackages: PackageInfo[], branch: string, cwd?: string): Promise<string[]>; interface GitConventionalForPackageOpts extends GitCommitsSinceOpts { noFetchAll?: boolean; packageInfo: PackageInfo; } /** * Gets full git commit, with conventional commits parsed data, * for a single, parsed package info */ export declare function gitConventionalForPackage(opts: GitConventionalForPackageOpts): Promise<GitCommitWithConventionalAndPackageInfo[]>; /** * Gets full git commit, with conventional commits parsed data, * for all provided packages */ export declare function gitConventionalForAllPackages(opts: Omit<GitConventionalForPackageOpts, 'packageInfo'> & { packageInfos: PackageInfo[]; }): Promise<GitCommitWithConventionalAndPackageInfo[]>; /** * Creates a git commit, based on whatever changes are active */ export declare function gitCommit(header: string, body?: string, footer?: string, cwd?: string): Promise<void>; /** * Pushes current local changes to upstream / origin */ export declare function gitPush(cwd?: string): Promise<void>; /** * Git pushes a single tag to upstream / origin */ export declare function gitPushTag(tag: string, cwd?: string): Promise<void>; /** * Git pushes multiple tags at the same time */ export declare function gitPushTags(tags: string[], cwd?: string): Promise<void>; /** * Creates a git tag */ export declare function gitTag(tag: string, cwd?: string): Promise<void>; /** * Checks the current repo to see if there are any outstanding changes * * @param {string} [cwd=appRootPath.toString()] * * @returns {Promise<boolean>} */ export declare function gitWorkdirUnclean(cwd?: string): Promise<boolean>; /** * Gets the current shortened commit SHA * * @param {string} [cwd=appRootPath.toString()] */ export declare function gitCurrentSHA(cwd?: string): Promise<string>; export {};