mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 04:58:17 +00:00
Ignore non-version branches, reset diagnostics between tests
This commit is contained in:
parent
cfbfddabdd
commit
ec20cad99a
17 changed files with 2358 additions and 1307 deletions
172
dist/index.js
vendored
172
dist/index.js
vendored
|
|
@ -43,8 +43,8 @@ exports.cmd = void 0;
|
||||||
// Using require instead of import to support integration testing
|
// Using require instead of import to support integration testing
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
const DebugManager_1 = __nccwpck_require__(1823);
|
const DebugManager_1 = __nccwpck_require__(1823);
|
||||||
const debugManager = DebugManager_1.DebugManager.getInstance();
|
|
||||||
const cmd = (command, ...args) => __awaiter(void 0, void 0, void 0, function* () {
|
const cmd = (command, ...args) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
const debugManager = DebugManager_1.DebugManager.getInstance();
|
||||||
if (debugManager.isReplayMode()) {
|
if (debugManager.isReplayMode()) {
|
||||||
return debugManager.replayCommand(command, args);
|
return debugManager.replayCommand(command, args);
|
||||||
}
|
}
|
||||||
|
|
@ -147,6 +147,10 @@ class DebugManager {
|
||||||
}
|
}
|
||||||
return DebugManager.instance;
|
return DebugManager.instance;
|
||||||
}
|
}
|
||||||
|
/** Clears the singleton instance of the DebugManager (used for testing) */
|
||||||
|
static clearState() {
|
||||||
|
DebugManager.instance = new DebugManager();
|
||||||
|
}
|
||||||
/** Returns true if debug mode is enabled */
|
/** Returns true if debug mode is enabled */
|
||||||
isDebugEnabled() {
|
isDebugEnabled() {
|
||||||
return this.debugEnabled;
|
return this.debugEnabled;
|
||||||
|
|
@ -361,11 +365,15 @@ class BranchVersioningTagFormatter extends DefaultTagFormatter_1.DefaultTagForma
|
||||||
}
|
}
|
||||||
constructor(config, branchName) {
|
constructor(config, branchName) {
|
||||||
super(config);
|
super(config);
|
||||||
this.branchName = branchName;
|
|
||||||
const pattern = config.versionFromBranch === true ?
|
const pattern = config.versionFromBranch === true ?
|
||||||
new RegExp("[0-9]+.[0-9]+$|[0-9]+$") :
|
new RegExp("[0-9]+.[0-9]+$|[0-9]+$") :
|
||||||
this.getRegex(config.versionFromBranch);
|
this.getRegex(config.versionFromBranch);
|
||||||
const result = pattern.exec(branchName);
|
const result = pattern.exec(branchName);
|
||||||
|
if (result === null) {
|
||||||
|
this.major = NaN;
|
||||||
|
this.onVersionBranch = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
let branchVersion;
|
let branchVersion;
|
||||||
switch (result === null || result === void 0 ? void 0 : result.length) {
|
switch (result === null || result === void 0 ? void 0 : result.length) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
@ -377,6 +385,7 @@ class BranchVersioningTagFormatter extends DefaultTagFormatter_1.DefaultTagForma
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unable to parse version from branch named '${branchName}' using pattern '${pattern}'`);
|
throw new Error(`Unable to parse version from branch named '${branchName}' using pattern '${pattern}'`);
|
||||||
}
|
}
|
||||||
|
this.onVersionBranch = true;
|
||||||
const versionValues = branchVersion.split('.');
|
const versionValues = branchVersion.split('.');
|
||||||
if (versionValues.length > 2) {
|
if (versionValues.length > 2) {
|
||||||
throw new Error(`The version string '${branchVersion}' parsed from branch '${branchName}' is invalid. It must be in the format 'major.minor' or 'major'`);
|
throw new Error(`The version string '${branchVersion}' parsed from branch '${branchName}' is invalid. It must be in the format 'major.minor' or 'major'`);
|
||||||
|
|
@ -392,7 +401,20 @@ class BranchVersioningTagFormatter extends DefaultTagFormatter_1.DefaultTagForma
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GetPattern() {
|
||||||
|
let pattern = super.GetPattern();
|
||||||
|
if (!this.onVersionBranch) {
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
if (this.minor === undefined) {
|
||||||
|
return pattern.replace('*[0-9].*[0-9].*[0-9]', `${this.major}.*[0-9].*[0-9]`);
|
||||||
|
}
|
||||||
|
return pattern.replace('*[0-9].*[0-9].*[0-9]', `${this.major}.${this.minor}.*[0-9]`);
|
||||||
|
}
|
||||||
IsValid(tag) {
|
IsValid(tag) {
|
||||||
|
if (!this.onVersionBranch) {
|
||||||
|
return super.IsValid(tag);
|
||||||
|
}
|
||||||
if (!super.IsValid(tag)) {
|
if (!super.IsValid(tag)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -406,6 +428,9 @@ class BranchVersioningTagFormatter extends DefaultTagFormatter_1.DefaultTagForma
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Parse(tag) {
|
Parse(tag) {
|
||||||
|
if (!this.onVersionBranch) {
|
||||||
|
return super.Parse(tag);
|
||||||
|
}
|
||||||
const parsed = super.Parse(tag);
|
const parsed = super.Parse(tag);
|
||||||
return [this.major, this.minor || parsed[1], parsed[2]];
|
return [this.major, this.minor || parsed[1], parsed[2]];
|
||||||
}
|
}
|
||||||
|
|
@ -721,15 +746,12 @@ class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVers
|
||||||
else if (this.minorPattern(commit)) {
|
else if (this.minorPattern(commit)) {
|
||||||
type = VersionType_1.VersionType.Minor;
|
type = VersionType_1.VersionType.Minor;
|
||||||
}
|
}
|
||||||
|
else if (this.patchPattern(commit) ||
|
||||||
|
(major === 0 && minor === 0 && patch === 0 && commitSet.commits.length > 0)) {
|
||||||
|
type = VersionType_1.VersionType.Patch;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (this.patchPattern(commit) ||
|
type = VersionType_1.VersionType.None;
|
||||||
(major === 0 && minor === 0 && patch === 0 && commitSet.commits.length > 0)) {
|
|
||||||
type = VersionType_1.VersionType.Patch;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
type = VersionType_1.VersionType.None;
|
|
||||||
increment++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (this.enablePrereleaseMode && major === 0) {
|
if (this.enablePrereleaseMode && major === 0) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
@ -743,7 +765,9 @@ class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVers
|
||||||
patch += 1;
|
patch += 1;
|
||||||
increment = 0;
|
increment = 0;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
increment++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -762,7 +786,9 @@ class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVers
|
||||||
patch += 1;
|
patch += 1;
|
||||||
increment = 0;
|
increment = 0;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
increment++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -959,7 +985,7 @@ class DefaultCurrentCommitResolver {
|
||||||
ResolveBranchNameAsync() {
|
ResolveBranchNameAsync() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const branchName = this.branch == 'HEAD' ?
|
const branchName = this.branch == 'HEAD' ?
|
||||||
process.env.GITHUB_REF_NAME || (yield (0, CommandRunner_1.cmd)('git', 'rev-parse', '--abbrev-ref', 'HEAD'))
|
process.env.GITHUB_REF_NAME || (yield (0, CommandRunner_1.cmd)('git', 'branch', '--show-current'))
|
||||||
: this.branch;
|
: this.branch;
|
||||||
return branchName.trim();
|
return branchName.trim();
|
||||||
});
|
});
|
||||||
|
|
@ -1179,8 +1205,8 @@ class DefaultVersionClassifier {
|
||||||
// - commit 3 was tagged v2.0.0 - v2.0.0+0
|
// - commit 3 was tagged v2.0.0 - v2.0.0+0
|
||||||
// - commit 4 - v2.0.1+0
|
// - commit 4 - v2.0.1+0
|
||||||
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
||||||
const currentIncremement = versionsMatch ? increment : 0;
|
const currentIncrement = 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(VersionType_1.VersionType.None, currentIncrement, false, lastRelease.currentMajor, lastRelease.currentMinor, lastRelease.currentPatch);
|
||||||
}
|
}
|
||||||
return new VersionClassification_1.VersionClassification(type, increment, changed, major, minor, patch);
|
return new VersionClassification_1.VersionClassification(type, increment, changed, major, minor, patch);
|
||||||
});
|
});
|
||||||
|
|
@ -1342,7 +1368,7 @@ var VersionType;
|
||||||
VersionType["Patch"] = "Patch";
|
VersionType["Patch"] = "Patch";
|
||||||
/** Indicates no change--generally this means that the current commit is already tagged with a version */
|
/** Indicates no change--generally this means that the current commit is already tagged with a version */
|
||||||
VersionType["None"] = "None";
|
VersionType["None"] = "None";
|
||||||
})(VersionType = exports.VersionType || (exports.VersionType = {}));
|
})(VersionType || (exports.VersionType = VersionType = {}));
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
@ -1904,7 +1930,7 @@ class OidcClient {
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
throw new Error(`Failed to get ID Token. \n
|
throw new Error(`Failed to get ID Token. \n
|
||||||
Error Code : ${error.statusCode}\n
|
Error Code : ${error.statusCode}\n
|
||||||
Error Message: ${error.result.message}`);
|
Error Message: ${error.message}`);
|
||||||
});
|
});
|
||||||
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
|
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
|
||||||
if (!id_token) {
|
if (!id_token) {
|
||||||
|
|
@ -3292,6 +3318,19 @@ class HttpClientResponse {
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
readBodyBuffer() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const chunks = [];
|
||||||
|
this.message.on('data', (chunk) => {
|
||||||
|
chunks.push(chunk);
|
||||||
|
});
|
||||||
|
this.message.on('end', () => {
|
||||||
|
resolve(Buffer.concat(chunks));
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.HttpClientResponse = HttpClientResponse;
|
exports.HttpClientResponse = HttpClientResponse;
|
||||||
function isHttps(requestUrl) {
|
function isHttps(requestUrl) {
|
||||||
|
|
@ -3796,7 +3835,13 @@ function getProxyUrl(reqUrl) {
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
if (proxyVar) {
|
if (proxyVar) {
|
||||||
return new URL(proxyVar);
|
try {
|
||||||
|
return new URL(proxyVar);
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
|
||||||
|
return new URL(`http://${proxyVar}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
@ -3807,6 +3852,10 @@ function checkBypass(reqUrl) {
|
||||||
if (!reqUrl.hostname) {
|
if (!reqUrl.hostname) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const reqHost = reqUrl.hostname;
|
||||||
|
if (isLoopbackAddress(reqHost)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
||||||
if (!noProxy) {
|
if (!noProxy) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -3832,13 +3881,24 @@ function checkBypass(reqUrl) {
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(x => x.trim().toUpperCase())
|
.map(x => x.trim().toUpperCase())
|
||||||
.filter(x => x)) {
|
.filter(x => x)) {
|
||||||
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
if (upperNoProxyItem === '*' ||
|
||||||
|
upperReqHosts.some(x => x === upperNoProxyItem ||
|
||||||
|
x.endsWith(`.${upperNoProxyItem}`) ||
|
||||||
|
(upperNoProxyItem.startsWith('.') &&
|
||||||
|
x.endsWith(`${upperNoProxyItem}`)))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.checkBypass = checkBypass;
|
exports.checkBypass = checkBypass;
|
||||||
|
function isLoopbackAddress(host) {
|
||||||
|
const hostLower = host.toLowerCase();
|
||||||
|
return (hostLower === 'localhost' ||
|
||||||
|
hostLower.startsWith('127.') ||
|
||||||
|
hostLower.startsWith('[::1]') ||
|
||||||
|
hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
|
||||||
|
}
|
||||||
//# sourceMappingURL=proxy.js.map
|
//# sourceMappingURL=proxy.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
@ -3878,11 +3938,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
};
|
};
|
||||||
var _a;
|
var _a;
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
||||||
const fs = __importStar(__nccwpck_require__(7147));
|
const fs = __importStar(__nccwpck_require__(7147));
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
_a = fs.promises
|
||||||
|
// export const {open} = 'fs'
|
||||||
|
, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||||
|
// export const {open} = 'fs'
|
||||||
exports.IS_WINDOWS = process.platform === 'win32';
|
exports.IS_WINDOWS = process.platform === 'win32';
|
||||||
|
// See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
|
||||||
|
exports.UV_FS_O_EXLOCK = 0x10000000;
|
||||||
|
exports.READONLY = fs.constants.O_RDONLY;
|
||||||
function exists(fsPath) {
|
function exists(fsPath) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
|
|
@ -4063,12 +4129,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
||||||
const assert_1 = __nccwpck_require__(9491);
|
const assert_1 = __nccwpck_require__(9491);
|
||||||
const childProcess = __importStar(__nccwpck_require__(2081));
|
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const util_1 = __nccwpck_require__(3837);
|
|
||||||
const ioUtil = __importStar(__nccwpck_require__(1962));
|
const ioUtil = __importStar(__nccwpck_require__(1962));
|
||||||
const exec = util_1.promisify(childProcess.exec);
|
|
||||||
const execFile = util_1.promisify(childProcess.execFile);
|
|
||||||
/**
|
/**
|
||||||
* Copies a file or folder.
|
* Copies a file or folder.
|
||||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||||
|
|
@ -4149,61 +4211,23 @@ exports.mv = mv;
|
||||||
function rmRF(inputPath) {
|
function rmRF(inputPath) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (ioUtil.IS_WINDOWS) {
|
if (ioUtil.IS_WINDOWS) {
|
||||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
|
||||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
|
||||||
// Check for invalid characters
|
// Check for invalid characters
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
||||||
if (/[*"<>|]/.test(inputPath)) {
|
if (/[*"<>|]/.test(inputPath)) {
|
||||||
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const cmdPath = ioUtil.getCmdPath();
|
|
||||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
|
||||||
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
|
||||||
env: { inputPath }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
|
||||||
env: { inputPath }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
|
||||||
try {
|
|
||||||
yield ioUtil.unlink(inputPath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
try {
|
||||||
let isDir = false;
|
// note if path does not exist, error is silent
|
||||||
try {
|
yield ioUtil.rm(inputPath, {
|
||||||
isDir = yield ioUtil.isDirectory(inputPath);
|
force: true,
|
||||||
}
|
maxRetries: 3,
|
||||||
catch (err) {
|
recursive: true,
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
retryDelay: 300
|
||||||
// other errors are valid
|
});
|
||||||
if (err.code !== 'ENOENT')
|
}
|
||||||
throw err;
|
catch (err) {
|
||||||
return;
|
throw new Error(`File was unable to be removed ${err}`);
|
||||||
}
|
|
||||||
if (isDir) {
|
|
||||||
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield ioUtil.unlink(inputPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -36,8 +36,8 @@ exports.cmd = void 0;
|
||||||
// Using require instead of import to support integration testing
|
// Using require instead of import to support integration testing
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
const DebugManager_1 = require("./DebugManager");
|
const DebugManager_1 = require("./DebugManager");
|
||||||
const debugManager = DebugManager_1.DebugManager.getInstance();
|
|
||||||
const cmd = (command, ...args) => __awaiter(void 0, void 0, void 0, function* () {
|
const cmd = (command, ...args) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
const debugManager = DebugManager_1.DebugManager.getInstance();
|
||||||
if (debugManager.isReplayMode()) {
|
if (debugManager.isReplayMode()) {
|
||||||
return debugManager.replayCommand(command, args);
|
return debugManager.replayCommand(command, args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ class DebugManager {
|
||||||
}
|
}
|
||||||
return DebugManager.instance;
|
return DebugManager.instance;
|
||||||
}
|
}
|
||||||
|
/** Clears the singleton instance of the DebugManager (used for testing) */
|
||||||
|
static clearState() {
|
||||||
|
DebugManager.instance = new DebugManager();
|
||||||
|
}
|
||||||
/** Returns true if debug mode is enabled */
|
/** Returns true if debug mode is enabled */
|
||||||
isDebugEnabled() {
|
isDebugEnabled() {
|
||||||
return this.debugEnabled;
|
return this.debugEnabled;
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,15 @@ class BranchVersioningTagFormatter extends DefaultTagFormatter_1.DefaultTagForma
|
||||||
}
|
}
|
||||||
constructor(config, branchName) {
|
constructor(config, branchName) {
|
||||||
super(config);
|
super(config);
|
||||||
this.branchName = branchName;
|
|
||||||
const pattern = config.versionFromBranch === true ?
|
const pattern = config.versionFromBranch === true ?
|
||||||
new RegExp("[0-9]+.[0-9]+$|[0-9]+$") :
|
new RegExp("[0-9]+.[0-9]+$|[0-9]+$") :
|
||||||
this.getRegex(config.versionFromBranch);
|
this.getRegex(config.versionFromBranch);
|
||||||
const result = pattern.exec(branchName);
|
const result = pattern.exec(branchName);
|
||||||
|
if (result === null) {
|
||||||
|
this.major = NaN;
|
||||||
|
this.onVersionBranch = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
let branchVersion;
|
let branchVersion;
|
||||||
switch (result === null || result === void 0 ? void 0 : result.length) {
|
switch (result === null || result === void 0 ? void 0 : result.length) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
@ -30,6 +34,7 @@ class BranchVersioningTagFormatter extends DefaultTagFormatter_1.DefaultTagForma
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unable to parse version from branch named '${branchName}' using pattern '${pattern}'`);
|
throw new Error(`Unable to parse version from branch named '${branchName}' using pattern '${pattern}'`);
|
||||||
}
|
}
|
||||||
|
this.onVersionBranch = true;
|
||||||
const versionValues = branchVersion.split('.');
|
const versionValues = branchVersion.split('.');
|
||||||
if (versionValues.length > 2) {
|
if (versionValues.length > 2) {
|
||||||
throw new Error(`The version string '${branchVersion}' parsed from branch '${branchName}' is invalid. It must be in the format 'major.minor' or 'major'`);
|
throw new Error(`The version string '${branchVersion}' parsed from branch '${branchName}' is invalid. It must be in the format 'major.minor' or 'major'`);
|
||||||
|
|
@ -45,7 +50,20 @@ class BranchVersioningTagFormatter extends DefaultTagFormatter_1.DefaultTagForma
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GetPattern() {
|
||||||
|
let pattern = super.GetPattern();
|
||||||
|
if (!this.onVersionBranch) {
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
if (this.minor === undefined) {
|
||||||
|
return pattern.replace('*[0-9].*[0-9].*[0-9]', `${this.major}.*[0-9].*[0-9]`);
|
||||||
|
}
|
||||||
|
return pattern.replace('*[0-9].*[0-9].*[0-9]', `${this.major}.${this.minor}.*[0-9]`);
|
||||||
|
}
|
||||||
IsValid(tag) {
|
IsValid(tag) {
|
||||||
|
if (!this.onVersionBranch) {
|
||||||
|
return super.IsValid(tag);
|
||||||
|
}
|
||||||
if (!super.IsValid(tag)) {
|
if (!super.IsValid(tag)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -59,6 +77,9 @@ class BranchVersioningTagFormatter extends DefaultTagFormatter_1.DefaultTagForma
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Parse(tag) {
|
Parse(tag) {
|
||||||
|
if (!this.onVersionBranch) {
|
||||||
|
return super.Parse(tag);
|
||||||
|
}
|
||||||
const parsed = super.Parse(tag);
|
const parsed = super.Parse(tag);
|
||||||
return [this.major, this.minor || parsed[1], parsed[2]];
|
return [this.major, this.minor || parsed[1], parsed[2]];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,12 @@ class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVers
|
||||||
else if (this.minorPattern(commit)) {
|
else if (this.minorPattern(commit)) {
|
||||||
type = VersionType_1.VersionType.Minor;
|
type = VersionType_1.VersionType.Minor;
|
||||||
}
|
}
|
||||||
|
else if (this.patchPattern(commit) ||
|
||||||
|
(major === 0 && minor === 0 && patch === 0 && commitSet.commits.length > 0)) {
|
||||||
|
type = VersionType_1.VersionType.Patch;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (this.patchPattern(commit) ||
|
type = VersionType_1.VersionType.None;
|
||||||
(major === 0 && minor === 0 && patch === 0 && commitSet.commits.length > 0)) {
|
|
||||||
type = VersionType_1.VersionType.Patch;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
type = VersionType_1.VersionType.None;
|
|
||||||
increment++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (this.enablePrereleaseMode && major === 0) {
|
if (this.enablePrereleaseMode && major === 0) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
@ -61,7 +58,9 @@ class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVers
|
||||||
patch += 1;
|
patch += 1;
|
||||||
increment = 0;
|
increment = 0;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
increment++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -80,7 +79,9 @@ class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVers
|
||||||
patch += 1;
|
patch += 1;
|
||||||
increment = 0;
|
increment = 0;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
increment++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class DefaultCurrentCommitResolver {
|
||||||
ResolveBranchNameAsync() {
|
ResolveBranchNameAsync() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const branchName = this.branch == 'HEAD' ?
|
const branchName = this.branch == 'HEAD' ?
|
||||||
process.env.GITHUB_REF_NAME || (yield (0, CommandRunner_1.cmd)('git', 'rev-parse', '--abbrev-ref', 'HEAD'))
|
process.env.GITHUB_REF_NAME || (yield (0, CommandRunner_1.cmd)('git', 'branch', '--show-current'))
|
||||||
: this.branch;
|
: this.branch;
|
||||||
return branchName.trim();
|
return branchName.trim();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,8 @@ class DefaultVersionClassifier {
|
||||||
// - commit 3 was tagged v2.0.0 - v2.0.0+0
|
// - commit 3 was tagged v2.0.0 - v2.0.0+0
|
||||||
// - commit 4 - v2.0.1+0
|
// - commit 4 - v2.0.1+0
|
||||||
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
||||||
const currentIncremement = versionsMatch ? increment : 0;
|
const currentIncrement = 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(VersionType_1.VersionType.None, currentIncrement, false, lastRelease.currentMajor, lastRelease.currentMinor, lastRelease.currentPatch);
|
||||||
}
|
}
|
||||||
return new VersionClassification_1.VersionClassification(type, increment, changed, major, minor, patch);
|
return new VersionClassification_1.VersionClassification(type, increment, changed, major, minor, patch);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,4 @@ var VersionType;
|
||||||
VersionType["Patch"] = "Patch";
|
VersionType["Patch"] = "Patch";
|
||||||
/** Indicates no change--generally this means that the current commit is already tagged with a version */
|
/** Indicates no change--generally this means that the current commit is already tagged with a version */
|
||||||
VersionType["None"] = "None";
|
VersionType["None"] = "None";
|
||||||
})(VersionType = exports.VersionType || (exports.VersionType = {}));
|
})(VersionType || (exports.VersionType = VersionType = {}));
|
||||||
|
|
|
||||||
3312
package-lock.json
generated
3312
package-lock.json
generated
File diff suppressed because it is too large
Load diff
22
package.json
22
package.json
|
|
@ -28,20 +28,20 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/paulhatch/semantic-version#readme",
|
"homepage": "https://github.com/paulhatch/semantic-version#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1"
|
"@actions/exec": "^1.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.11.9",
|
"@types/node": "^20.7.1",
|
||||||
"@typescript-eslint/parser": "^5.17.0",
|
"@typescript-eslint/parser": "^6.7.3",
|
||||||
"@vercel/ncc": "^0.34.0",
|
"@vercel/ncc": "^0.38.0",
|
||||||
"eslint": "^8.12.0",
|
"eslint": "^8.50.0",
|
||||||
"eslint-plugin-github": "^4.3.6",
|
"eslint-plugin-github": "^4.10.1",
|
||||||
"eslint-plugin-jest": "^27.1.3",
|
"eslint-plugin-jest": "^27.4.0",
|
||||||
"jest": "^29.2.2",
|
"jest": "^29.7.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"prettier": "^2.6.1",
|
"prettier": "^3.0.3",
|
||||||
"ts-jest": "^29.0.3",
|
"ts-jest": "^29.1.1",
|
||||||
"typescript": "^4.6.3"
|
"typescript": "^5.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import { DebugManager } from './DebugManager';
|
import { DebugManager } from './DebugManager';
|
||||||
|
|
||||||
const debugManager = DebugManager.getInstance();
|
|
||||||
|
|
||||||
export const cmd = async (command: string, ...args: any): Promise<string> => {
|
export const cmd = async (command: string, ...args: any): Promise<string> => {
|
||||||
|
|
||||||
|
const debugManager = DebugManager.getInstance();
|
||||||
|
|
||||||
if (debugManager.isReplayMode()) {
|
if (debugManager.isReplayMode()) {
|
||||||
return debugManager.replayCommand(command, args);
|
return debugManager.replayCommand(command, args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
import exp from "constants";
|
|
||||||
import { ActionConfig } from "./ActionConfig";
|
import { ActionConfig } from "./ActionConfig";
|
||||||
|
|
||||||
|
|
||||||
/** Utility class for managing debug mode and diagnostic information */
|
/** Utility class for managing debug mode and diagnostic information */
|
||||||
export class DebugManager {
|
export class DebugManager {
|
||||||
|
|
||||||
private constructor() { }
|
private constructor() { }
|
||||||
|
|
||||||
private static instance: DebugManager;
|
private static instance: DebugManager;
|
||||||
|
|
@ -16,6 +14,12 @@ export class DebugManager {
|
||||||
return DebugManager.instance;
|
return DebugManager.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Clears the singleton instance of the DebugManager (used for testing) */
|
||||||
|
public static clearState() {
|
||||||
|
DebugManager.instance = new DebugManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private debugEnabled: boolean = false;
|
private debugEnabled: boolean = false;
|
||||||
private replayMode: boolean = false;
|
private replayMode: boolean = false;
|
||||||
private diagnosticInfo: DiagnosticInfo | null = null;
|
private diagnosticInfo: DiagnosticInfo | null = null;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { DefaultTagFormatter } from './DefaultTagFormatter';
|
||||||
/** Default tag formatter which allows a prefix to be specified */
|
/** Default tag formatter which allows a prefix to be specified */
|
||||||
export class BranchVersioningTagFormatter extends DefaultTagFormatter {
|
export class BranchVersioningTagFormatter extends DefaultTagFormatter {
|
||||||
|
|
||||||
|
private onVersionBranch: boolean;
|
||||||
private major: number;
|
private major: number;
|
||||||
private minor?: number;
|
private minor?: number;
|
||||||
|
|
||||||
|
|
@ -17,13 +18,19 @@ export class BranchVersioningTagFormatter extends DefaultTagFormatter {
|
||||||
return new RegExp(pattern);
|
return new RegExp(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(config: ActionConfig, private branchName: string) {
|
constructor(config: ActionConfig, branchName: string) {
|
||||||
super(config);
|
super(config);
|
||||||
const pattern = config.versionFromBranch === true ?
|
const pattern = config.versionFromBranch === true ?
|
||||||
new RegExp("[0-9]+.[0-9]+$|[0-9]+$") :
|
new RegExp("[0-9]+.[0-9]+$|[0-9]+$") :
|
||||||
this.getRegex(config.versionFromBranch as string);
|
this.getRegex(config.versionFromBranch as string);
|
||||||
const result = pattern.exec(branchName);
|
const result = pattern.exec(branchName);
|
||||||
|
|
||||||
|
if (result === null) {
|
||||||
|
this.major = NaN;
|
||||||
|
this.onVersionBranch = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let branchVersion: string;
|
let branchVersion: string;
|
||||||
switch (result?.length) {
|
switch (result?.length) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
@ -36,6 +43,8 @@ export class BranchVersioningTagFormatter extends DefaultTagFormatter {
|
||||||
throw new Error(`Unable to parse version from branch named '${branchName}' using pattern '${pattern}'`);
|
throw new Error(`Unable to parse version from branch named '${branchName}' using pattern '${pattern}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.onVersionBranch = true;
|
||||||
|
|
||||||
const versionValues = branchVersion.split('.');
|
const versionValues = branchVersion.split('.');
|
||||||
if (versionValues.length > 2) {
|
if (versionValues.length > 2) {
|
||||||
throw new Error(`The version string '${branchVersion}' parsed from branch '${branchName}' is invalid. It must be in the format 'major.minor' or 'major'`);
|
throw new Error(`The version string '${branchVersion}' parsed from branch '${branchName}' is invalid. It must be in the format 'major.minor' or 'major'`);
|
||||||
|
|
@ -52,7 +61,24 @@ export class BranchVersioningTagFormatter extends DefaultTagFormatter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override GetPattern(): string {
|
||||||
|
let pattern = super.GetPattern();
|
||||||
|
if (!this.onVersionBranch) {
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.minor === undefined) {
|
||||||
|
return pattern.replace('*[0-9].*[0-9].*[0-9]', `${this.major}.*[0-9].*[0-9]`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pattern.replace('*[0-9].*[0-9].*[0-9]', `${this.major}.${this.minor}.*[0-9]`);
|
||||||
|
}
|
||||||
|
|
||||||
override IsValid(tag: string): boolean {
|
override IsValid(tag: string): boolean {
|
||||||
|
if (!this.onVersionBranch) {
|
||||||
|
return super.IsValid(tag);
|
||||||
|
}
|
||||||
|
|
||||||
if (!super.IsValid(tag)) {
|
if (!super.IsValid(tag)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -66,8 +92,12 @@ export class BranchVersioningTagFormatter extends DefaultTagFormatter {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
override Parse(tag: string): [major: number, minor: number, patch: number] {
|
override Parse(tag: string): [major: number, minor: number, patch: number] {
|
||||||
|
if (!this.onVersionBranch) {
|
||||||
|
return super.Parse(tag);
|
||||||
|
}
|
||||||
|
|
||||||
const parsed = super.Parse(tag);
|
const parsed = super.Parse(tag);
|
||||||
return [this.major, this.minor || parsed[1], parsed[2]];
|
return [this.major, this.minor || parsed[1], parsed[2]];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { expect, test } from '@jest/globals'
|
||||||
import { runAction } from '../src/action';
|
import { runAction } from '../src/action';
|
||||||
import { ConfigurationProvider } from './ConfigurationProvider';
|
import { ConfigurationProvider } from './ConfigurationProvider';
|
||||||
import { ActionConfig } from './ActionConfig';
|
import { ActionConfig } from './ActionConfig';
|
||||||
import exp from 'constants';
|
import { DebugManager } from './DebugManager';
|
||||||
|
|
||||||
const windows = process.platform === "win32";
|
const windows = process.platform === "win32";
|
||||||
const timeout = 30000;
|
const timeout = 30000;
|
||||||
|
|
@ -42,6 +42,7 @@ const createTestRepo = (repoDefaultConfig?: Partial<ActionConfig>) => {
|
||||||
run(`git merge ${branch}`);
|
run(`git merge ${branch}`);
|
||||||
},
|
},
|
||||||
runAction: async (inputs?: Partial<ActionConfig>) => {
|
runAction: async (inputs?: Partial<ActionConfig>) => {
|
||||||
|
DebugManager.clearState();
|
||||||
let config = new ActionConfig();
|
let config = new ActionConfig();
|
||||||
config = { ...config, ...{ versionFormat: "${major}.${minor}.${patch}+${increment}" }, ...repoDefaultConfig, ...inputs };
|
config = { ...config, ...{ versionFormat: "${major}.${minor}.${patch}+${increment}" }, ...repoDefaultConfig, ...inputs };
|
||||||
process.chdir(repoDirectory);
|
process.chdir(repoDirectory);
|
||||||
|
|
@ -187,32 +188,6 @@ test('Version pulled from last release branch', async () => {
|
||||||
expect(result.formattedVersion).toBe('5.6.8+0');
|
expect(result.formattedVersion).toBe('5.6.8+0');
|
||||||
}, timeout);
|
}, timeout);
|
||||||
|
|
||||||
/* Removed for now
|
|
||||||
test('Tags on branches are used', async () => {
|
|
||||||
|
|
||||||
// This test checks that tags are counted correctly even if they are not on
|
|
||||||
// the main branch:
|
|
||||||
// master o--o--o--o <- expecting v0.0.2
|
|
||||||
// \
|
|
||||||
// release o--o <- taged v0.0.1
|
|
||||||
|
|
||||||
|
|
||||||
const repo = createTestRepo(); // 0.0.0+0
|
|
||||||
|
|
||||||
repo.makeCommit('Initial Commit'); // 0.0.1+0
|
|
||||||
repo.makeCommit('Second Commit'); // 0.0.1+1
|
|
||||||
repo.makeCommit('Third Commit'); // 0.1.1+2
|
|
||||||
repo.exec('git checkout -b release/0.0.1')
|
|
||||||
repo.makeCommit('Fourth Commit'); // 0.1.1+3
|
|
||||||
repo.exec('git tag v0.0.1');
|
|
||||||
repo.exec('git checkout master');
|
|
||||||
repo.makeCommit('Fifth Commit'); // 0.0.2.0
|
|
||||||
const result = await repo.runAction();
|
|
||||||
|
|
||||||
expect(result.formattedVersion).toBe('0.0.2+0');
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
test('Merged tags do not affect version', async () => {
|
test('Merged tags do not affect version', async () => {
|
||||||
|
|
||||||
// This test checks that merges don't override tags
|
// This test checks that merges don't override tags
|
||||||
|
|
|
||||||
|
|
@ -40,16 +40,14 @@ export class BumpAlwaysVersionClassifier extends DefaultVersionClassifier {
|
||||||
type = VersionType.Major;
|
type = VersionType.Major;
|
||||||
} else if (this.minorPattern(commit)) {
|
} else if (this.minorPattern(commit)) {
|
||||||
type = VersionType.Minor;
|
type = VersionType.Minor;
|
||||||
|
} else if (this.patchPattern(commit) ||
|
||||||
|
(major === 0 && minor === 0 && patch === 0 && commitSet.commits.length > 0)) {
|
||||||
|
type = VersionType.Patch;
|
||||||
} else {
|
} else {
|
||||||
if (this.patchPattern(commit) ||
|
type = VersionType.None;
|
||||||
(major === 0 && minor === 0 && patch === 0 && commitSet.commits.length > 0)) {
|
|
||||||
type = VersionType.Patch;
|
|
||||||
} else {
|
|
||||||
type = VersionType.None;
|
|
||||||
increment++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.enablePrereleaseMode && major === 0) {
|
if (this.enablePrereleaseMode && major === 0) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VersionType.Major:
|
case VersionType.Major:
|
||||||
|
|
@ -62,7 +60,9 @@ export class BumpAlwaysVersionClassifier extends DefaultVersionClassifier {
|
||||||
patch += 1;
|
patch += 1;
|
||||||
increment = 0;
|
increment = 0;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
increment++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
@ -80,7 +80,9 @@ export class BumpAlwaysVersionClassifier extends DefaultVersionClassifier {
|
||||||
patch += 1;
|
patch += 1;
|
||||||
increment = 0;
|
increment = 0;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
increment++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,8 +107,8 @@ export class DefaultVersionClassifier implements VersionClassifier {
|
||||||
// - commit 4 - v2.0.1+0
|
// - commit 4 - v2.0.1+0
|
||||||
|
|
||||||
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
||||||
const currentIncremement = versionsMatch ? increment : 0;
|
const currentIncrement = versionsMatch ? increment : 0;
|
||||||
return new VersionClassification(VersionType.None, currentIncremement, 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