You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

@cplace/cli

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cplace/cli - npm Package Compare versions

Comparing version

to
1.0.7

@@ -23,2 +23,3 @@ /**

static getLatestTagOfPattern(repoName: string, repoUrl: string, tagPattern: string, rootDir: string): Promise<string>;
static sortByTagName(repoName: string, result: string, tagPattern: string): string[];
/**

@@ -25,0 +26,0 @@ * Translates the repoUrl to the expected protocol defined by the local root repository to avoid authentication problems.

@@ -100,6 +100,7 @@ "use strict";

if (!tagMatches) {
throw new Error(`[${repoName}]: Resolved latestTagForRelease ${repoProperties.latestTagForRelease} does not match the expected pattern 'version/{major}.{minor}.{patch}'!`);
// tslint:disable-next-line:max-line-length
throw new Error(`[${repoName}]: Resolved latestTagForRelease ${repoProperties.latestTagForRelease} does not match the expected pattern 'version/{major}.{minor}.{patch}(-RC.{counter})?'!`);
}
if (!tagMarkerMatches) {
throw new Error(`[${repoName}]: Configured tagMarker ${repoProperties.tagMarker} does not match the expected pattern 'version/{major}.{minor}.{patch}'!`);
throw new Error(`[${repoName}]: Configured tagMarker ${repoProperties.tagMarker} does not match the expected pattern 'version/{major}.{minor}.{patch}(-RC.{counter})?'!`);
}

@@ -185,8 +186,6 @@ if (tagMatches.groups.major !== tagMarkerMatches.groups.major) {

else {
Global_1.Global.isVerbose() && console.log(`[${repoName}]: result of git ls-remote:\n${result}`);
const lines = result.match(/[^\r\n]+/g);
if (lines) {
const lastLine = lines.slice(-1)[0];
const tagMatch = lastLine.match(tagPattern);
resolve(tagMatch ? tagMatch[0] : null);
const sortedTags = this.sortByTagName(repoName, result, tagPattern);
Global_1.Global.isVerbose() && console.log(`[${repoName}]: found latest versions in remote git repository:\n${sortedTags ? sortedTags.join('\n') : 'no tags found'}`);
if (sortedTags) {
resolve(sortedTags.slice(-1)[0]);
}

@@ -201,2 +200,79 @@ else {

}
static sortByTagName(repoName, result, tagPattern) {
const lines = result.match(/[^\r\n]+/g);
if (lines) {
// 1. prepare all lines - remove hash and non-matching results
const tags = lines.map((line) => {
const tagMatch = line.match(tagPattern);
return tagMatch ? tagMatch[0] : null;
}).filter((tag) => tag);
// 2. sort lines, respecting RC order
return tags.sort((a, b) => {
if (a === b) {
return 0;
}
const aRcMatch = a.match(/^version\/\d+\.\d+\.(\d+)-RC.(\d+)$/);
const bRcMatch = b.match(/^version\/\d+\.\d+\.(\d+)-RC.(\d+)$/);
const aMatch = a.match(/^version\/\d+\.\d+\.(\d+)$/);
const bMatch = b.match(/^version\/\d+\.\d+\.(\d+)$/);
if (aRcMatch && bRcMatch) {
if (parseInt(aRcMatch[1], 10) > parseInt(bRcMatch[1], 10)) {
return 1;
}
if (parseInt(aRcMatch[1], 10) < parseInt(bRcMatch[1], 10)) {
return 1;
}
if (parseInt(aRcMatch[2], 10) === parseInt(bRcMatch[2], 10)) {
return 0;
}
if (parseInt(aRcMatch[2], 10) > parseInt(bRcMatch[2], 10)) {
return 1;
}
return -1;
}
if (aRcMatch && bMatch) {
if (parseInt(aRcMatch[1], 10) > parseInt(bMatch[1], 10)) {
return 1;
}
return -1;
}
if (aMatch && bRcMatch) {
if (parseInt(aMatch[1], 10) >= parseInt(bRcMatch[1], 10)) {
return 1;
}
return -1;
}
if (aMatch && bMatch) {
if (parseInt(aMatch[1], 10) > parseInt(bMatch[1], 10)) {
return 1;
}
return -1;
}
if (aMatch) {
console.log(`[${repoName}]: Unsupported version format [${b}].`);
return 1;
}
if (bMatch) {
console.log(`[${repoName}]: Unsupported version format [${a}].`);
return -1;
}
if (aRcMatch) {
console.log(`[${repoName}]: Unsupported version format [${b}].`);
return 1;
}
if (bRcMatch) {
console.log(`[${repoName}]: Unsupported version format [${a}].`);
return -1;
}
if (a > b) {
console.log(`[${repoName}]: Unsupported version format [${a}] and [${b}].`);
return 1;
}
return -1;
});
}
else {
return null;
}
}
/**

@@ -871,5 +947,5 @@ * Translates the repoUrl to the expected protocol defined by the local root repository to avoid authentication problems.

Repository.REMOTE_BRANCH_PATTERN = new RegExp(/^remotes\/(.+)$/);
Repository.TAG_FORMAT = new RegExp(/^version\/(?<major>\d+).(?<minor>\d+).(?<patch>\d+)$/);
Repository.TAG_FORMAT = new RegExp(/^version\/(?<major>\d+).(?<minor>\d+).(?<patch>\d+)(-RC.(?<counter>\d+))?$/);
Repository.GIT_PROTOCOL = 'git@';
Repository.HTTPS_PROTOCOL = 'https:';
//# sourceMappingURL=Repository.js.map
{
"name": "@cplace/cli",
"version": "1.0.6",
"version": "1.0.7",
"description": "cplace cli tools",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet