cc-connect 1.2.2-beta.2 → 1.2.2-beta.4
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/install.js +10 -5
- package/package.json +1 -1
- package/run.js +10 -6
package/install.js
CHANGED
|
@@ -122,12 +122,14 @@ function extractZip(buffer, destDir, binaryName) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
// parseVersion splits "1.2.3-beta.1" into { nums: [1,2,3],
|
|
125
|
+
// parseVersion splits "1.2.3-beta.1" into { nums: [1,2,3], preTag: "beta", preNum: 1 }
|
|
126
126
|
function parseVersion(v) {
|
|
127
127
|
v = v.replace(/^v/, "").trim();
|
|
128
128
|
const [base, ...rest] = v.split("-");
|
|
129
129
|
const nums = base.split(".").map(Number);
|
|
130
|
-
|
|
130
|
+
const pre = rest.join("-");
|
|
131
|
+
const m = pre.match(/^([a-zA-Z]+)\.?(\d+)?$/);
|
|
132
|
+
return { nums, preTag: m ? m[1] : pre, preNum: m && m[2] ? parseInt(m[2], 10) : 0, hasPre: pre !== "" };
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
// isNewerOrEqual returns true if installed >= expected
|
|
@@ -141,9 +143,12 @@ function isNewerOrEqual(installed, expected) {
|
|
|
141
143
|
if (av > bv) return true;
|
|
142
144
|
if (av < bv) return false;
|
|
143
145
|
}
|
|
144
|
-
if (!a.
|
|
145
|
-
if (a.
|
|
146
|
-
|
|
146
|
+
if (!a.hasPre && b.hasPre) return true;
|
|
147
|
+
if (a.hasPre && !b.hasPre) return false;
|
|
148
|
+
if (!a.hasPre && !b.hasPre) return true;
|
|
149
|
+
// Both pre-release: compare tag then number (rc > beta, beta.10 > beta.9)
|
|
150
|
+
if (a.preTag !== b.preTag) return a.preTag > b.preTag;
|
|
151
|
+
return a.preNum >= b.preNum;
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
async function main() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-connect",
|
|
3
|
-
"version": "1.2.2-beta.
|
|
3
|
+
"version": "1.2.2-beta.4",
|
|
4
4
|
"description": "Bridge local AI coding agents (Claude Code, Cursor, Gemini CLI) to messaging platforms (Feishu, DingTalk, Slack, Telegram, Discord, LINE, WeChat Work)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
package/run.js
CHANGED
|
@@ -13,12 +13,14 @@ const binDir = path.join(__dirname, "bin");
|
|
|
13
13
|
const ext = process.platform === "win32" ? ".exe" : "";
|
|
14
14
|
const binaryPath = path.join(binDir, NAME + ext);
|
|
15
15
|
|
|
16
|
-
// parseVersion splits "1.2.3-beta.1" into { nums: [1,2,3],
|
|
16
|
+
// parseVersion splits "1.2.3-beta.1" into { nums: [1,2,3], preTag: "beta", preNum: 1 }
|
|
17
17
|
function parseVersion(v) {
|
|
18
18
|
v = v.replace(/^v/, "").trim();
|
|
19
19
|
const [base, ...rest] = v.split("-");
|
|
20
20
|
const nums = base.split(".").map(Number);
|
|
21
|
-
|
|
21
|
+
const pre = rest.join("-");
|
|
22
|
+
const m = pre.match(/^([a-zA-Z]+)\.?(\d+)?$/);
|
|
23
|
+
return { nums, preTag: m ? m[1] : pre, preNum: m && m[2] ? parseInt(m[2], 10) : 0, hasPre: pre !== "" };
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
// isNewerOrEqual returns true if installed >= expected
|
|
@@ -33,10 +35,12 @@ function isNewerOrEqual(installed, expected) {
|
|
|
33
35
|
if (av < bv) return false;
|
|
34
36
|
}
|
|
35
37
|
// Same base: no pre-release >= any pre-release (1.2.3 >= 1.2.3-beta.1)
|
|
36
|
-
if (!a.
|
|
37
|
-
if (a.
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
if (!a.hasPre && b.hasPre) return true;
|
|
39
|
+
if (a.hasPre && !b.hasPre) return false;
|
|
40
|
+
if (!a.hasPre && !b.hasPre) return true;
|
|
41
|
+
// Both pre-release: compare tag then number (rc > beta, beta.10 > beta.9)
|
|
42
|
+
if (a.preTag !== b.preTag) return a.preTag > b.preTag;
|
|
43
|
+
return a.preNum >= b.preNum;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
function needsReinstall() {
|