zarro 1.170.16 → 1.170.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gulp-tasks/modules/version.js +26 -4
- package/package.json +1 -1
- package/types.d.ts +1 -0
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
const ver = other instanceof Version
|
|
68
68
|
? other
|
|
69
69
|
: new Version(other);
|
|
70
|
-
return
|
|
70
|
+
return compareVersions(this.version, this.tag, ver.version, ver.tag);
|
|
71
71
|
}
|
|
72
72
|
toString() {
|
|
73
73
|
const ver = this.version.join(".");
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
: ver;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function compareVersions(x, xTag, y, yTag) {
|
|
80
80
|
const shortest = Math.min(x.length, y.length), compare = [];
|
|
81
81
|
for (let i = 0; i < shortest; i++) {
|
|
82
82
|
if (x[i] > y[i]) {
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
if (compare.length === 0) {
|
|
93
|
-
return
|
|
93
|
+
return compareTags(xTag, yTag);
|
|
94
94
|
}
|
|
95
95
|
const allZero = compare.reduce((acc, cur) => acc && (cur === "0"), true);
|
|
96
96
|
if (allZero) {
|
|
97
|
-
return
|
|
97
|
+
return compareTags(xTag, yTag);
|
|
98
98
|
}
|
|
99
99
|
for (const s of compare) {
|
|
100
100
|
if (s === ">") {
|
|
@@ -104,7 +104,29 @@
|
|
|
104
104
|
return -1;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
return compareTags(xTag, yTag);
|
|
108
|
+
}
|
|
109
|
+
function compareTags(xTag, yTag) {
|
|
110
|
+
if (xTag && yTag) {
|
|
111
|
+
return compareStrings(xTag, yTag);
|
|
112
|
+
}
|
|
113
|
+
if (xTag) {
|
|
114
|
+
// assume x is the beta for y
|
|
115
|
+
return -1;
|
|
116
|
+
}
|
|
117
|
+
if (yTag) {
|
|
118
|
+
// assume y is the beta for x
|
|
119
|
+
return 1;
|
|
120
|
+
}
|
|
107
121
|
return 0;
|
|
108
122
|
}
|
|
123
|
+
function compareStrings(s1, s2) {
|
|
124
|
+
if (s1 === s2) {
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
return s1 < s2
|
|
128
|
+
? -1
|
|
129
|
+
: 1;
|
|
130
|
+
}
|
|
109
131
|
module.exports = Version;
|
|
110
132
|
})();
|
package/package.json
CHANGED