@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
125 lines (124 loc) • 5.63 kB
TypeScript
import { GitCommitsSinceOpts } from './git.js';
import { ChangelogConfig, defineLetsVersionConfig, LetsVersionConfig } from './readUserConfig.js';
import { BumpRecommendation, BumpType, GitCommitWithConventionalAndPackageInfo, PackageInfo, PublishTagInfo, ReleaseAsPresets } from './types.js';
export { defineLetsVersionConfig };
export type { ChangelogConfig, LetsVersionConfig, ReleaseAsPresets };
export interface AllCommandsBaseOpts {
cwd?: string;
}
/**
* Returns all detected packages for this repository
*/
export declare function listPackages(opts: AllCommandsBaseOpts): Promise<PackageInfo[]>;
export interface GetLastVersionTagsByPackageNameOpts {
cwd?: string;
names?: string[];
noFetchTags?: boolean;
}
/**
* Given an optional array of package names, reads the latest
* git tag that was used in a previous version bump operation.
*/
export declare function getLastVersionTagsByPackageName(opts?: GetLastVersionTagsByPackageNameOpts): Promise<PublishTagInfo[]>;
/**
* Gets a list of all files that have changed since the last publish for a specific package or set of packages.
* If no results are returned, it likely means that there was not a previous version tag detected in git.
*/
export declare function getChangedFilesSinceBump(opts?: GetLastVersionTagsByPackageNameOpts): Promise<string[]>;
export interface GetChangedFilesSinceBranchOpts {
cwd?: string;
names?: string[];
branch?: string;
}
/**
* Gets a list of all files that have changed since the current branch was created.
*/
export declare function getChangedFilesSinceBranch(opts?: GetChangedFilesSinceBranchOpts): Promise<string[]>;
/**
* Gets a list of all packages that have changed since the last publish for a specific package or set of packages.
* If no results are returned, it likely means that there was not a previous version tag detected in git.
*/
export declare function getChangedPackagesSinceBump(opts?: GetLastVersionTagsByPackageNameOpts): Promise<PackageInfo[]>;
/**
* Gets a list of all packages that have changed since the current branch was created.
*/
export declare function getChangedPackagesSinceBranch(opts?: GetChangedFilesSinceBranchOpts): Promise<PackageInfo[]>;
export interface GetConventionalCommitsByPackageOpts extends Pick<GitCommitsSinceOpts, 'commitDateFormat'> {
cwd?: string;
names?: string[];
noFetchTags?: boolean;
noFetchAll?: boolean;
}
/**
* Parses commits since last publish for a specific package or set of packages
* and returns them represented as Conventional Commits objects.
*/
export declare function getConventionalCommitsByPackage(opts?: GetConventionalCommitsByPackageOpts): Promise<GitCommitWithConventionalAndPackageInfo[]>;
export interface GetRecommendedBumpsByPackageReturnType {
bumps: BumpRecommendation[];
bumpsByPackageName: Map<string, BumpRecommendation>;
packages: PackageInfo[];
conventional: GitCommitWithConventionalAndPackageInfo[];
}
export interface GetRecommendedBumpsByPackageOpts extends Pick<GitCommitsSinceOpts, 'commitDateFormat'> {
names?: string[];
releaseAs?: ReleaseAsPresets;
preid?: string;
uniqify?: boolean;
saveExact?: boolean;
force?: boolean;
noFetchAll?: boolean;
noFetchTags?: boolean;
updatePeer?: boolean;
updateOptional?: boolean;
cwd?: string;
}
/**
* Given an optional list of package names, parses the git history
* since the last bump operation and suggests a bump.
*
* NOTE: It is possible for your bump recommendation to not change.
* If this is the case, this means that your particular package has never had a version bump by the lets-version library.
*/
export declare function getRecommendedBumpsByPackage(opts?: GetRecommendedBumpsByPackageOpts): Promise<GetRecommendedBumpsByPackageReturnType>;
export declare function getSynchronizedBumpsByPackage(opts: GetRecommendedBumpsByPackageOpts, bumpTypeByPackageName: Map<string, BumpType>, allPackages: PackageInfo[], tagsForPackagesMap: Map<string, PublishTagInfo>, isExactRelease?: boolean): Promise<{
bumps: BumpRecommendation[];
bumpsByPackageName: Map<string, BumpRecommendation>;
packages: PackageInfo[];
}>;
export interface ApplyRecommendedBumpsByPackageOpts {
commitDateFormat?: string;
names?: string[];
releaseAs?: ReleaseAsPresets;
preid?: string;
uniqify?: boolean;
saveExact?: boolean;
force?: boolean;
noCommit?: boolean;
noFetchAll?: boolean;
noFetchTags?: boolean;
noInstall?: boolean;
yes?: boolean;
updatePeer?: boolean;
updateOptional?: boolean;
noPush?: boolean;
rollupChangelog?: boolean;
noChangelog?: boolean;
dryRun?: boolean;
cwd?: string;
allowUncommitted?: boolean;
customConfig?: LetsVersionConfig;
}
/**
* Given an optional list of package names, parses the git history
* since the last bump operation, suggest a bump and applies it, also
* updating any dependent package.json files across your repository.
*
* NOTE: It is possible for your bump recommendation to not change.
* If this is the case, this means that your particular package has never had a version bump by the lets-version library.
*/
export declare function applyRecommendedBumpsByPackage(opts?: ApplyRecommendedBumpsByPackageOpts): Promise<GetRecommendedBumpsByPackageReturnType | null>;
/**
* Builds a local repository-only dependency graph. If you are in a monorepo, this is useful to visualize how the dependencies in said monorepo relate to each other.
*/
export declare function localDepGraph(cwd?: string): Promise<import("./types.js").LocalDependencyGraphNode[]>;