mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 13:08:17 +00:00
WIP
This commit is contained in:
parent
c4f3793c16
commit
5c6220ef79
2 changed files with 14 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ export async function runAction(configurationProvider: ConfigurationProvider): P
|
||||||
|
|
||||||
if (await currentCommitResolver.IsEmptyRepoAsync()) {
|
if (await currentCommitResolver.IsEmptyRepoAsync()) {
|
||||||
|
|
||||||
|
console.log("VAGO REPO WAS EMPTY, returning default version information");
|
||||||
const versionInfo = new VersionInformation(0, 0, 0, 0, VersionType.None, [], false, false);
|
const versionInfo = new VersionInformation(0, 0, 0, 0, VersionType.None, [], false, false);
|
||||||
return new VersionResult(
|
return new VersionResult(
|
||||||
versionInfo.major,
|
versionInfo.major,
|
||||||
|
|
@ -39,9 +40,14 @@ export async function runAction(configurationProvider: ConfigurationProvider): P
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentCommit = await currentCommitResolver.ResolveAsync();
|
const currentCommit = await currentCommitResolver.ResolveAsync();
|
||||||
|
console.log("VAGO CURRENT COMMIT: " + currentCommit);
|
||||||
const lastRelease = await lastReleaseResolver.ResolveAsync(currentCommit, tagFormatter);
|
const lastRelease = await lastReleaseResolver.ResolveAsync(currentCommit, tagFormatter);
|
||||||
|
console.log("VAGO LAST RELEASE: " + lastRelease.hash + " " + lastRelease.major + "." + lastRelease.minor + "." + lastRelease.patch);
|
||||||
const commitSet = await commitsProvider.GetCommitsAsync(lastRelease.hash, currentCommit);
|
const commitSet = await commitsProvider.GetCommitsAsync(lastRelease.hash, currentCommit);
|
||||||
|
console.log("VAGO commit set le:" + commitSet.commits.length)
|
||||||
|
console.log("VAGO commit set changed: " + commitSet.changed.toString());
|
||||||
const classification = await versionClassifier.ClassifyAsync(lastRelease, commitSet);
|
const classification = await versionClassifier.ClassifyAsync(lastRelease, commitSet);
|
||||||
|
console.log("VAGO classification: " + JSON.stringify(classification));
|
||||||
|
|
||||||
const { isTagged } = lastRelease;
|
const { isTagged } = lastRelease;
|
||||||
const { major, minor, patch, increment, type, changed } = classification;
|
const { major, minor, patch, increment, type, changed } = classification;
|
||||||
|
|
|
||||||
|
|
@ -91,12 +91,15 @@ export class DefaultVersionClassifier implements VersionClassifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ClassifyAsync(lastRelease: ReleaseInformation, commitSet: CommitInfoSet): Promise<VersionClassification> {
|
public async ClassifyAsync(lastRelease: ReleaseInformation, commitSet: CommitInfoSet): Promise<VersionClassification> {
|
||||||
|
console.log("VAGO DefaultVersionClassifier.ClassifyAsync called");
|
||||||
const { type, increment, changed } = this.resolveCommitType(commitSet);
|
const { type, increment, changed } = this.resolveCommitType(commitSet);
|
||||||
|
console.log("VAGO DefaultVersionClassifier.ClassifyAsync: type: " + VersionType[type] + ", increment: " + increment + ", changed: " + changed);
|
||||||
|
|
||||||
const { major, minor, patch } = this.getNextVersion(lastRelease, type);
|
const { major, minor, patch } = this.getNextVersion(lastRelease, type);
|
||||||
|
console.log("VAGO DefaultVersionClassifier.ClassifyAsync: major: " + major + ", minor: " + minor + ", patch: " + patch);
|
||||||
|
|
||||||
if (lastRelease.currentPatch !== null) {
|
if (lastRelease.currentPatch !== null) {
|
||||||
|
console.log("VAGO DefaultVersionClassifier.ClassifyAsync: lastRelease.currentPatch is not null, using it to determine version classification");
|
||||||
// If the current commit is tagged, we must use that version. Here we check if the version we have resolved from the
|
// If the current commit is tagged, we must use that version. Here we check if the version we have resolved from the
|
||||||
// previous commits is the same as the current version. If it is, we will use the increment value, otherwise we reset
|
// previous commits is the same as the current version. If it is, we will use the increment value, otherwise we reset
|
||||||
// to zero. For example:
|
// to zero. For example:
|
||||||
|
|
@ -108,6 +111,10 @@ export class DefaultVersionClassifier implements VersionClassifier {
|
||||||
|
|
||||||
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
||||||
const currentIncrement = versionsMatch ? increment : 0;
|
const currentIncrement = versionsMatch ? increment : 0;
|
||||||
|
console.log("VAGO DefaultVersionClassifier.ClassifyAsync: versionsMatch: " + versionsMatch + ", currentIncrement: " + currentIncrement);
|
||||||
|
console.log("VAGO DefaultVersionClassifier.ClassifyAsync: lastRelease.currentMajor: " + <number>lastRelease.currentMajor);
|
||||||
|
console.log("VAGO DefaultVersionClassifier.ClassifyAsync: lastRelease.currentMinor: " + <number>lastRelease.currentMinor);
|
||||||
|
console.log("VAGO DefaultVersionClassifier.ClassifyAsync: lastRelease.currentPatch: " + <number>lastRelease.currentPatch);
|
||||||
return new VersionClassification(VersionType.None, currentIncrement, false, <number>lastRelease.currentMajor, <number>lastRelease.currentMinor, <number>lastRelease.currentPatch);
|
return new VersionClassification(VersionType.None, currentIncrement, false, <number>lastRelease.currentMajor, <number>lastRelease.currentMinor, <number>lastRelease.currentPatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue