npm-git-version
Version:
NPM utility that gets next version of application according git branch and tags
136 lines (135 loc) • 3.21 kB
TypeScript
/**
* Description of help parameters
*/
export interface IHelpObject {
help?: boolean;
branchName?: string;
buildNumber?: number;
tagPrefix?: string;
ignoreBranchPrefix?: string;
pre?: boolean;
suffix?: string;
currentVersion?: string;
noIncrement?: boolean;
workingDirectory?: string;
noStdOut?: boolean;
config: string;
execute?: string;
}
/**
* Updates build number, handling special build number -1
* @param args Arguments that are being processed
*/
export declare function updateBuildNumber(args: IHelpObject): void;
/**
* Process arguments and returns parsed object
*/
export declare function processArguments(): IHelpObject;
/**
* Extractor that extracts version number for current git repository
*/
export declare class VersionsExtractor {
private _config;
/**
* Instance of git wrapper
*/
private _git;
/**
* Resolve method for process method
*/
private _processResolve;
/**
* Reject method for process method
*/
private _processReject;
/**
* Name of current branch
*/
private _branchName;
/**
* Name of current branch stripped only to version
*/
private _branchVersion;
/**
* Stripped branch prefix from branch name
*/
private _branchPrefix;
/**
* Number of last matching version
*/
private _lastMatchingVersion;
/**
* Indication that tag is on current HEAD
*/
private _currentTag;
/**
* Indication that version is new for this branch
*/
private _startingVersion;
/**
* Computed version for next build
*/
private _version;
/**
* Gets stripped branch prefix from branch name
*/
get branchPrefix(): string;
/**
* Gets name of current branch
*/
get branchName(): string;
/**
* Gets name of current branch stripped only to version
*/
get branchVersion(): string;
/**
* Gets computed version for next build
*/
get version(): string;
/**
* Gets number of last matching version
*/
get lastMatchingVersion(): string;
/**
* Command that should be executed after version is computed
*/
get executeCommand(): string | undefined;
/**
* Gets prerelease suffix
*/
private get prereleaseSuffix();
constructor(_config: IHelpObject);
/**
* Process extraction of version
*/
process(): Promise<VersionsExtractor>;
/**
* Runs internal git processing
*/
private _runProcessing;
/**
* Applies specified build number for prerelease version
*/
private _applyBuildNumber;
/**
* Computes next version for build
*/
private _computeVersion;
/**
* Processes branch name and extracts prefix and pure version number
*/
private _processBranchName;
/**
* Gets last matching tag
*/
private _getLastMatchingTag;
/**
* Gets requested branch name
*/
private _getBranchName;
/**
* Creates handle function with automatic error handling
* @param callback Callback called if result was success
*/
private _errorHandle;
}