mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-15 19:39:53 +00:00
Rewrite/refactor for v5, migrate to TypeScript (MAJOR)
Set Jest config file in package script Include module path Include tests in project folders Remove index module exports Hardcode configuration parameters Move parameter binding into main run function Use alias imports Run test sequentially Remove cleanup (async conflict) Revert Jest option Increase test timeout to 15 seconds
This commit is contained in:
parent
dc8f0c5755
commit
31f4e3fdf0
74 changed files with 9422 additions and 4342 deletions
52
lib/providers/BumpAlwaysVersionClassifier.js
Normal file
52
lib/providers/BumpAlwaysVersionClassifier.js
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BumpAlwaysVersionClassifier = void 0;
|
||||
const DefaultVersionClassifier_1 = require("./DefaultVersionClassifier");
|
||||
const VersionClassification_1 = require("./VersionClassification");
|
||||
const VersionType_1 = require("./VersionType");
|
||||
class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVersionClassifier {
|
||||
constructor(config) {
|
||||
super(config);
|
||||
// Placeholder for consistency
|
||||
}
|
||||
ClassifyAsync(lastRelease, commitSet) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (lastRelease.currentPatch !== null) {
|
||||
return new VersionClassification_1.VersionClassification(VersionType_1.VersionType.None, 0, false, lastRelease.currentMajor, lastRelease.currentMinor, lastRelease.currentPatch);
|
||||
}
|
||||
let { major, minor, patch } = lastRelease;
|
||||
let type = VersionType_1.VersionType.None;
|
||||
if (commitSet.commits.length === 0) {
|
||||
return new VersionClassification_1.VersionClassification(type, 0, false, major, minor, patch);
|
||||
}
|
||||
for (let commit of commitSet.commits.reverse()) {
|
||||
if (this.majorPattern(commit)) {
|
||||
major += 1;
|
||||
minor = 0;
|
||||
patch = 0;
|
||||
type = VersionType_1.VersionType.Major;
|
||||
}
|
||||
else if (this.minorPattern(commit)) {
|
||||
minor += 1;
|
||||
patch = 0;
|
||||
type = VersionType_1.VersionType.Minor;
|
||||
}
|
||||
else {
|
||||
patch += 1;
|
||||
type = VersionType_1.VersionType.Patch;
|
||||
}
|
||||
}
|
||||
return new VersionClassification_1.VersionClassification(type, 0, true, major, minor, patch);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.BumpAlwaysVersionClassifier = BumpAlwaysVersionClassifier;
|
||||
32
lib/providers/CommitInfo.js
Normal file
32
lib/providers/CommitInfo.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CommitInfo = void 0;
|
||||
/** Represents information about a commit */
|
||||
class CommitInfo {
|
||||
/**
|
||||
* Creates a new commit information instance
|
||||
* @param hash - The hash of the commit
|
||||
* @param subject - The subject of the commit message
|
||||
* @param body - The body of the commit message
|
||||
* @param author - The author's name
|
||||
* @param authorEmail - The author's email
|
||||
* @param authorDate - The date the commit was authored
|
||||
* @param committer - The committer's name
|
||||
* @param committerEmail - The committer's email
|
||||
* @param committerDate - The date the commit was committed
|
||||
* @param tags - List of any tags associated with this commit
|
||||
*/
|
||||
constructor(hash, subject, body, author, authorEmail, authorDate, committer, committerEmail, committerDate, tags) {
|
||||
this.hash = hash;
|
||||
this.subject = subject;
|
||||
this.body = body;
|
||||
this.author = author;
|
||||
this.authorEmail = authorEmail;
|
||||
this.authorDate = authorDate;
|
||||
this.committer = committer;
|
||||
this.committerEmail = committerEmail;
|
||||
this.committerDate = committerDate;
|
||||
this.tags = tags;
|
||||
}
|
||||
}
|
||||
exports.CommitInfo = CommitInfo;
|
||||
11
lib/providers/CommitInfoSet.js
Normal file
11
lib/providers/CommitInfoSet.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CommitInfoSet = void 0;
|
||||
/** Represents information about a set of commits */
|
||||
class CommitInfoSet {
|
||||
constructor(changed, commits) {
|
||||
this.changed = changed;
|
||||
this.commits = commits;
|
||||
}
|
||||
}
|
||||
exports.CommitInfoSet = CommitInfoSet;
|
||||
2
lib/providers/CommitsProvider.js
Normal file
2
lib/providers/CommitsProvider.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
lib/providers/CurrentCommitResolver.js
Normal file
2
lib/providers/CurrentCommitResolver.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
79
lib/providers/DefaultCommitsProvider.js
Normal file
79
lib/providers/DefaultCommitsProvider.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DefaultCommitsProvider = void 0;
|
||||
const CommandRunner_1 = require("../CommandRunner");
|
||||
const CommitInfo_1 = require("./CommitInfo");
|
||||
const CommitInfoSet_1 = require("./CommitInfoSet");
|
||||
class DefaultCommitsProvider {
|
||||
constructor(config) {
|
||||
this.changePath = config.changePath;
|
||||
}
|
||||
GetCommitsAsync(startHash, endHash) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const logSplitter = `@@@START_RECORD`;
|
||||
const formatPlaceholders = Object.entries({
|
||||
hash: '%H',
|
||||
subject: '%s',
|
||||
body: '%b',
|
||||
author: '%an',
|
||||
authorEmail: '%ae',
|
||||
authorDate: '%aI',
|
||||
committer: '%cn',
|
||||
committerEmail: '%ce',
|
||||
committerDate: '%cI',
|
||||
tags: '%d'
|
||||
});
|
||||
const pretty = logSplitter + '%n' + formatPlaceholders
|
||||
.map(x => `@@@${x[0]}%n${x[1]}`)
|
||||
.join('%n');
|
||||
var logCommand = `git log --pretty="${pretty}" --author-date-order ${(startHash === '' ? endHash : `${startHash}..${endHash}`)}`;
|
||||
if (this.changePath !== '') {
|
||||
logCommand += ` -- ${this.changePath}`;
|
||||
}
|
||||
const log = yield (0, CommandRunner_1.cmd)(logCommand);
|
||||
const entries = log
|
||||
.split(logSplitter)
|
||||
.slice(1);
|
||||
const commits = entries.map(entry => {
|
||||
const fields = entry
|
||||
.split(`@@@`)
|
||||
.slice(1)
|
||||
.reduce((acc, value) => {
|
||||
const firstLine = value.indexOf('\n');
|
||||
const key = value.substring(0, firstLine);
|
||||
acc[key] = value.substring(firstLine + 1).trim();
|
||||
return acc;
|
||||
}, {});
|
||||
const tags = fields.tags
|
||||
.split(',')
|
||||
.map((v) => v.trim())
|
||||
.filter((v) => v.startsWith('tags: '))
|
||||
.map((v) => v.substring(5).trim());
|
||||
return new CommitInfo_1.CommitInfo(fields.hash, fields.subject, fields.body, fields.author, fields.authorEmail, new Date(fields.authorDate), fields.committer, fields.committerEmail, new Date(fields.committerDate), tags);
|
||||
});
|
||||
// check for changes
|
||||
let changed = true;
|
||||
if (this.changePath !== '') {
|
||||
if (startHash === '') {
|
||||
const changedFiles = yield (0, CommandRunner_1.cmd)(`git log --name-only --oneline ${endHash} -- ${this.changePath}`);
|
||||
changed = changedFiles.length > 0;
|
||||
}
|
||||
else {
|
||||
const changedFiles = yield (0, CommandRunner_1.cmd)(`git diff --name-only ${startHash}..${endHash} -- ${this.changePath}`);
|
||||
changed = changedFiles.length > 0;
|
||||
}
|
||||
}
|
||||
return new CommitInfoSet_1.CommitInfoSet(changed, commits);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.DefaultCommitsProvider = DefaultCommitsProvider;
|
||||
33
lib/providers/DefaultCurrentCommitResolver.js
Normal file
33
lib/providers/DefaultCurrentCommitResolver.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DefaultCurrentCommitResolver = void 0;
|
||||
const CommandRunner_1 = require("../CommandRunner");
|
||||
class DefaultCurrentCommitResolver {
|
||||
constructor(config) {
|
||||
this.branch = config.branch;
|
||||
}
|
||||
ResolveAsync() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.branch === 'HEAD') {
|
||||
return (yield (0, CommandRunner_1.cmd)('git', 'rev-parse', 'HEAD')).trim();
|
||||
}
|
||||
return this.branch;
|
||||
});
|
||||
}
|
||||
IsEmptyRepoAsync() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let lastCommitAll = (yield (0, CommandRunner_1.cmd)('git', 'rev-list', '-n1', '--all')).trim();
|
||||
return lastCommitAll === '';
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.DefaultCurrentCommitResolver = DefaultCurrentCommitResolver;
|
||||
90
lib/providers/DefaultVersionClassifier.js
Normal file
90
lib/providers/DefaultVersionClassifier.js
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DefaultVersionClassifier = void 0;
|
||||
const VersionClassification_1 = require("./VersionClassification");
|
||||
const VersionType_1 = require("./VersionType");
|
||||
class DefaultVersionClassifier {
|
||||
constructor(config) {
|
||||
const searchBody = config.searchCommitBody;
|
||||
this.majorPattern = this.parsePattern(config.majorPattern, searchBody);
|
||||
this.minorPattern = this.parsePattern(config.minorPattern, searchBody);
|
||||
}
|
||||
parsePattern(pattern, searchBody) {
|
||||
if (pattern.startsWith('/') && pattern.endsWith('/')) {
|
||||
var regex = new RegExp(pattern.slice(1, -1));
|
||||
return searchBody ?
|
||||
(commit) => regex.test(commit.subject) || regex.test(commit.body) :
|
||||
(commit) => regex.test(commit.subject);
|
||||
}
|
||||
else {
|
||||
const matchString = pattern;
|
||||
return searchBody ?
|
||||
(commit) => commit.subject.includes(matchString) || commit.body.includes(matchString) :
|
||||
(commit) => commit.subject.includes(matchString);
|
||||
}
|
||||
}
|
||||
getNextVersion(current, type) {
|
||||
switch (type) {
|
||||
case VersionType_1.VersionType.Major:
|
||||
return { major: current.major + 1, minor: 0, patch: 0 };
|
||||
case VersionType_1.VersionType.Minor:
|
||||
return { major: current.major, minor: current.minor + 1, patch: 0 };
|
||||
case VersionType_1.VersionType.Patch:
|
||||
return { major: current.major, minor: current.minor, patch: current.patch + 1 };
|
||||
case VersionType_1.VersionType.None:
|
||||
return { major: current.major, minor: current.minor, patch: current.patch };
|
||||
default:
|
||||
throw new Error(`Unknown change type: ${type}`);
|
||||
}
|
||||
}
|
||||
resolveCommitType(commitsSet) {
|
||||
if (commitsSet.commits.length === 0) {
|
||||
return { type: VersionType_1.VersionType.None, increment: 0, changed: commitsSet.changed };
|
||||
}
|
||||
const commits = commitsSet.commits.reverse();
|
||||
let index = 1;
|
||||
for (let commit of commits) {
|
||||
if (this.majorPattern(commit)) {
|
||||
return { type: VersionType_1.VersionType.Major, increment: commits.length - index, changed: commitsSet.changed };
|
||||
}
|
||||
index++;
|
||||
}
|
||||
index = 1;
|
||||
for (let commit of commits) {
|
||||
if (this.minorPattern(commit)) {
|
||||
return { type: VersionType_1.VersionType.Minor, increment: commits.length - index, changed: commitsSet.changed };
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return { type: VersionType_1.VersionType.Patch, increment: commitsSet.commits.length - 1, changed: true };
|
||||
}
|
||||
ClassifyAsync(lastRelease, commitSet) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { type, increment, changed } = this.resolveCommitType(commitSet);
|
||||
const { major, minor, patch } = this.getNextVersion(lastRelease, type);
|
||||
if (lastRelease.currentPatch !== null) {
|
||||
// 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
|
||||
// to zero. For example:
|
||||
// - commit 1 - v1.0.0+0
|
||||
// - commit 2 - v1.0.0+1
|
||||
// - commit 3 was tagged v2.0.0 - v2.0.0+0
|
||||
// - commit 4 - v2.0.1+0
|
||||
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
||||
const currentIncremement = versionsMatch ? increment : 0;
|
||||
return new VersionClassification_1.VersionClassification(VersionType_1.VersionType.None, currentIncremement, false, lastRelease.currentMajor, lastRelease.currentMinor, lastRelease.currentPatch);
|
||||
}
|
||||
return new VersionClassification_1.VersionClassification(type, increment, changed, major, minor, patch);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.DefaultVersionClassifier = DefaultVersionClassifier;
|
||||
2
lib/providers/LastReleaseResolver.js
Normal file
2
lib/providers/LastReleaseResolver.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
26
lib/providers/ReleaseInformation.js
Normal file
26
lib/providers/ReleaseInformation.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ReleaseInformation = void 0;
|
||||
// Finds the hash of the last commit
|
||||
class ReleaseInformation {
|
||||
/**
|
||||
* Creates a new instance
|
||||
* @param major - the major version number
|
||||
* @param minor - the minor version number
|
||||
* @param patch - the patch version number
|
||||
* @param hash - the hash of commit of the last release
|
||||
* @param currentMajor - the major version number from the current commit
|
||||
* @param currentMinor - the minor version number from the current commit
|
||||
* @param currentPatch - the patch version number from the current commit
|
||||
*/
|
||||
constructor(major, minor, patch, hash, currentMajor, currentMinor, currentPatch) {
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
this.hash = hash;
|
||||
this.currentMajor = currentMajor;
|
||||
this.currentMinor = currentMinor;
|
||||
this.currentPatch = currentPatch;
|
||||
}
|
||||
}
|
||||
exports.ReleaseInformation = ReleaseInformation;
|
||||
72
lib/providers/TagLastReleaseResolver.js
Normal file
72
lib/providers/TagLastReleaseResolver.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TagLastReleaseResolver = void 0;
|
||||
const CommandRunner_1 = require("../CommandRunner");
|
||||
const ReleaseInformation_1 = require("./ReleaseInformation");
|
||||
const core = __importStar(require("@actions/core"));
|
||||
class TagLastReleaseResolver {
|
||||
constructor(config) {
|
||||
this.changePath = config.changePath;
|
||||
}
|
||||
ResolveAsync(current, tagFormatter) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const releasePattern = tagFormatter.GetPattern();
|
||||
let currentTag = (yield (0, CommandRunner_1.cmd)(`git tag --points-at ${current} ${releasePattern}`)).trim();
|
||||
const [currentMajor, currentMinor, currentPatch] = !!currentTag ? tagFormatter.Parse(currentTag) : [null, null, null];
|
||||
let tag = '';
|
||||
try {
|
||||
tag = (yield (0, CommandRunner_1.cmd)('git', `describe`, `--tags`, `--abbrev=0`, `--match=${releasePattern}`, `${current}~1`)).trim();
|
||||
}
|
||||
catch (err) {
|
||||
tag = '';
|
||||
}
|
||||
if (tag === '') {
|
||||
if ((yield (0, CommandRunner_1.cmd)('git', 'remote')) !== '') {
|
||||
// Since there is no remote, we assume that there are no other tags to pull. In
|
||||
// practice this isn't likely to happen, but it keeps the test output from being
|
||||
// polluted with a bunch of warnings.
|
||||
core.warning('No tags are present for this repository. If this is unexpected, check to ensure that tags have been pulled from the remote.');
|
||||
}
|
||||
// no release tags yet, use the initial commit as the root
|
||||
return new ReleaseInformation_1.ReleaseInformation(0, 0, 0, '', currentMajor, currentMinor, currentPatch);
|
||||
}
|
||||
// parse the version tag
|
||||
const [major, minor, patch] = tagFormatter.Parse(tag);
|
||||
const root = yield (0, CommandRunner_1.cmd)('git', `merge-base`, tag, current);
|
||||
return new ReleaseInformation_1.ReleaseInformation(major, minor, patch, root.trim(), currentMajor, currentMinor, currentPatch);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.TagLastReleaseResolver = TagLastReleaseResolver;
|
||||
18
lib/providers/UserInfo.js
Normal file
18
lib/providers/UserInfo.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UserInfo = void 0;
|
||||
/** Represents information about a user (e.g. committer, author, tagger) */
|
||||
class UserInfo {
|
||||
/**
|
||||
* Creates a new instance
|
||||
* @param name - User's name
|
||||
* @param email - User's email
|
||||
* @param commits - Number of commits in the scope evaluated
|
||||
*/
|
||||
constructor(name, email, commits) {
|
||||
this.name = name;
|
||||
this.email = email;
|
||||
this.commits = commits;
|
||||
}
|
||||
}
|
||||
exports.UserInfo = UserInfo;
|
||||
24
lib/providers/VersionClassification.js
Normal file
24
lib/providers/VersionClassification.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VersionClassification = void 0;
|
||||
/** The result of a version classification */
|
||||
class VersionClassification {
|
||||
/**
|
||||
* Creates a new version classification result instance
|
||||
* @param type - The type of change the current range represents
|
||||
* @param increment - The number of commits which have this version, usually zero-based
|
||||
* @param changed - True if the version has changed, false otherwise
|
||||
* @param major - The major version number
|
||||
* @param minor - The minor version number
|
||||
* @param patch - The patch version number
|
||||
*/
|
||||
constructor(type, increment, changed, major, minor, patch) {
|
||||
this.type = type;
|
||||
this.increment = increment;
|
||||
this.changed = changed;
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
}
|
||||
}
|
||||
exports.VersionClassification = VersionClassification;
|
||||
2
lib/providers/VersionClassifier.js
Normal file
2
lib/providers/VersionClassifier.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
29
lib/providers/VersionInformation.js
Normal file
29
lib/providers/VersionInformation.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VersionInformation = void 0;
|
||||
/**
|
||||
* Represents the "resolved" information about a version change, serves
|
||||
* as the input to formatters that produce the final output
|
||||
*/
|
||||
class VersionInformation {
|
||||
/**
|
||||
* Creates a new version information instance
|
||||
* @param major - The major version number
|
||||
* @param minor - The minor version number
|
||||
* @param patch - The patch version number
|
||||
* @param increment - The number of commits for this version
|
||||
* @param type - The type of change the current range represents
|
||||
* @param commits - The list of commits for this version
|
||||
* @param changed - True if the version has changed, false otherwise
|
||||
*/
|
||||
constructor(major, minor, patch, increment, type, commits, changed) {
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
this.increment = increment;
|
||||
this.type = type;
|
||||
this.commits = commits;
|
||||
this.changed = changed;
|
||||
}
|
||||
}
|
||||
exports.VersionInformation = VersionInformation;
|
||||
15
lib/providers/VersionType.js
Normal file
15
lib/providers/VersionType.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VersionType = void 0;
|
||||
/** Indicates the type of change a particular version change represents */
|
||||
var VersionType;
|
||||
(function (VersionType) {
|
||||
/** Indicates a major version change */
|
||||
VersionType[VersionType["Major"] = 0] = "Major";
|
||||
/** Indicates a minor version change */
|
||||
VersionType[VersionType["Minor"] = 1] = "Minor";
|
||||
/** Indicates a patch version change */
|
||||
VersionType[VersionType["Patch"] = 2] = "Patch";
|
||||
/** Indicates no change--generally this means that the current commit is already tagged with a version */
|
||||
VersionType[VersionType["None"] = 3] = "None";
|
||||
})(VersionType = exports.VersionType || (exports.VersionType = {}));
|
||||
23
lib/providers/index.js
Normal file
23
lib/providers/index.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VersionType = exports.VersionInformation = exports.VersionClassification = exports.UserInfo = exports.TagLastReleaseResolver = exports.ReleaseInformation = exports.DefaultVersionClassifier = exports.DefaultCurrentCommitResolver = exports.DefaultCommitsProvider = exports.CommitInfo = void 0;
|
||||
var CommitInfo_1 = require("./CommitInfo");
|
||||
Object.defineProperty(exports, "CommitInfo", { enumerable: true, get: function () { return CommitInfo_1.CommitInfo; } });
|
||||
var DefaultCommitsProvider_1 = require("./DefaultCommitsProvider");
|
||||
Object.defineProperty(exports, "DefaultCommitsProvider", { enumerable: true, get: function () { return DefaultCommitsProvider_1.DefaultCommitsProvider; } });
|
||||
var DefaultCurrentCommitResolver_1 = require("./DefaultCurrentCommitResolver");
|
||||
Object.defineProperty(exports, "DefaultCurrentCommitResolver", { enumerable: true, get: function () { return DefaultCurrentCommitResolver_1.DefaultCurrentCommitResolver; } });
|
||||
var DefaultVersionClassifier_1 = require("./DefaultVersionClassifier");
|
||||
Object.defineProperty(exports, "DefaultVersionClassifier", { enumerable: true, get: function () { return DefaultVersionClassifier_1.DefaultVersionClassifier; } });
|
||||
var ReleaseInformation_1 = require("./ReleaseInformation");
|
||||
Object.defineProperty(exports, "ReleaseInformation", { enumerable: true, get: function () { return ReleaseInformation_1.ReleaseInformation; } });
|
||||
var TagLastReleaseResolver_1 = require("./TagLastReleaseResolver");
|
||||
Object.defineProperty(exports, "TagLastReleaseResolver", { enumerable: true, get: function () { return TagLastReleaseResolver_1.TagLastReleaseResolver; } });
|
||||
var UserInfo_1 = require("./UserInfo");
|
||||
Object.defineProperty(exports, "UserInfo", { enumerable: true, get: function () { return UserInfo_1.UserInfo; } });
|
||||
var VersionClassification_1 = require("./VersionClassification");
|
||||
Object.defineProperty(exports, "VersionClassification", { enumerable: true, get: function () { return VersionClassification_1.VersionClassification; } });
|
||||
var VersionInformation_1 = require("./VersionInformation");
|
||||
Object.defineProperty(exports, "VersionInformation", { enumerable: true, get: function () { return VersionInformation_1.VersionInformation; } });
|
||||
var VersionType_1 = require("./VersionType");
|
||||
Object.defineProperty(exports, "VersionType", { enumerable: true, get: function () { return VersionType_1.VersionType; } });
|
||||
Loading…
Add table
Add a link
Reference in a new issue