@topgroup/diginext
Version:
A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.
51 lines • 2.06 kB
TypeScript
import type { GitRepoData, PullOrCloneRepoURLOptions } from "./git-interfaces";
/**
* Get current git branch
*/
export declare const getCurrentGitBranch: (dir?: string) => Promise<string>;
/**
* Get latest tag of the git repository
*/
export declare function getLatestTagOfGitRepo(dir?: string): Promise<string>;
interface GitStageOptions {
directory?: string;
message?: string;
}
export declare function isUnstagedFiles(dir?: string): Promise<boolean>;
/**
* Stage all files, commit them & push to git origin.
*/
export declare function stageCommitAndPushAll(options: GitStageOptions): Promise<{
currentBranch: string;
currentBranchKebab: string;
}>;
/**
* Read git data in a repo SSH url
* @param {string} repoSSH - Example: `git@bitbucket.org:organization-name/git-repo-slug.git`
*/
export declare function parseGitRepoDataFromRepoSSH(repoSSH: string): GitRepoData;
/**
* Read git data in a git repo url
* @param {string} repoURL - Example: `https://bitbucket.org/organization-name/git-repo-slug`
*/
export declare function parseGitRepoDataFromRepoURL(repoURL: string): GitRepoData;
/**
* Generate git repo SSH url from a git repo URL
* @example "git@github.com:digitopvn/diginext.git" -> "https://github.com/digitopvn/diginext"
*/
export declare function repoSshToRepoURL(repoSSH: string): string;
/**
* Generate git repo URL from a git repo SSH url
* @example "https://github.com/digitopvn/diginext" -> "git@github.com:digitopvn/diginext.git"
*/
export declare function repoUrlToRepoSSH(repoURL: string): string;
export declare function validateRepoURL(url: string): void;
export declare function isValidRepoURL(url: string): boolean;
export declare function isValidBase64(str: string): boolean;
export declare function injectAuthToRepoURL(url: string, options: {
type: "Bearer" | "Basic";
token: string;
}): string;
export declare const pullOrCloneGitRepoHTTP: (repoURL: string, dir: string, branch: string, options: PullOrCloneRepoURLOptions) => Promise<boolean>;
export {};
//# sourceMappingURL=git-utils.d.ts.map