@inboxapi/cli 0.2.15 → 0.2.17
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/index.js +0 -46
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -3,45 +3,6 @@
|
|
|
3
3
|
const { spawn } = require('child_process');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const fs = require('fs');
|
|
6
|
-
const https = require('https');
|
|
7
|
-
|
|
8
|
-
function compareVersions(a, b) {
|
|
9
|
-
const pa = a.split('.').map(Number);
|
|
10
|
-
const pb = b.split('.').map(Number);
|
|
11
|
-
for (let i = 0; i < 3; i++) {
|
|
12
|
-
const na = pa[i] || 0;
|
|
13
|
-
const nb = pb[i] || 0;
|
|
14
|
-
if (na < nb) return -1;
|
|
15
|
-
if (na > nb) return 1;
|
|
16
|
-
}
|
|
17
|
-
return 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function checkForUpdates() {
|
|
21
|
-
try {
|
|
22
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
|
|
23
|
-
const localVersion = pkg.version;
|
|
24
|
-
if (!localVersion) return;
|
|
25
|
-
|
|
26
|
-
const req = https.get('https://registry.npmjs.org/@inboxapi/cli/latest', { timeout: 3000 }, (res) => {
|
|
27
|
-
let data = '';
|
|
28
|
-
res.on('data', (chunk) => { data += chunk; });
|
|
29
|
-
res.on('end', () => {
|
|
30
|
-
try {
|
|
31
|
-
const remote = JSON.parse(data);
|
|
32
|
-
const remoteVersion = remote.version;
|
|
33
|
-
if (remoteVersion && compareVersions(localVersion, remoteVersion) < 0) {
|
|
34
|
-
process.stderr.write(
|
|
35
|
-
`[inboxapi] Update available: ${localVersion} → ${remoteVersion}. Run: npm install -g @inboxapi/cli@${remoteVersion}\n`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
} catch {}
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
req.on('error', () => {});
|
|
42
|
-
req.on('timeout', () => { req.destroy(); });
|
|
43
|
-
} catch {}
|
|
44
|
-
}
|
|
45
6
|
|
|
46
7
|
const PLATFORM_PACKAGES = {
|
|
47
8
|
'darwin-arm64': '@inboxapi/cli-darwin-arm64',
|
|
@@ -79,13 +40,6 @@ function findBinary() {
|
|
|
79
40
|
const binPath = findBinary();
|
|
80
41
|
const args = process.argv.slice(2);
|
|
81
42
|
|
|
82
|
-
// Auto-update check for proxy mode only (default, no subcommand, or explicit "proxy")
|
|
83
|
-
const firstArg = args[0];
|
|
84
|
-
const isProxyMode = !firstArg || firstArg === 'proxy' || firstArg.startsWith('--endpoint');
|
|
85
|
-
if (isProxyMode) {
|
|
86
|
-
checkForUpdates();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
43
|
if (binPath) {
|
|
90
44
|
const child = spawn(binPath, args, { stdio: 'inherit' });
|
|
91
45
|
child.on('exit', (code, signal) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inboxapi/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"description": "📧 Email for your AI 🤖",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"test": "cargo test"
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@inboxapi/cli-darwin-arm64": "0.2.
|
|
31
|
-
"@inboxapi/cli-darwin-x64": "0.2.
|
|
32
|
-
"@inboxapi/cli-linux-arm64": "0.2.
|
|
33
|
-
"@inboxapi/cli-linux-x64": "0.2.
|
|
34
|
-
"@inboxapi/cli-win32-x64": "0.2.
|
|
30
|
+
"@inboxapi/cli-darwin-arm64": "0.2.17",
|
|
31
|
+
"@inboxapi/cli-darwin-x64": "0.2.17",
|
|
32
|
+
"@inboxapi/cli-linux-arm64": "0.2.17",
|
|
33
|
+
"@inboxapi/cli-linux-x64": "0.2.17",
|
|
34
|
+
"@inboxapi/cli-win32-x64": "0.2.17"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@inboxapi/cli": "^0.2.15"
|