cnagent 2.0.3 → 2.0.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/bin/cn +15 -1
- package/package.json +1 -1
package/bin/cn
CHANGED
|
@@ -11,7 +11,7 @@ const { execSync, spawn } = require('child_process');
|
|
|
11
11
|
const path = require('path');
|
|
12
12
|
const fs = require('fs');
|
|
13
13
|
|
|
14
|
-
const VERSION = '2.0.
|
|
14
|
+
const VERSION = '2.0.4';
|
|
15
15
|
|
|
16
16
|
// Colors (respects NO_COLOR)
|
|
17
17
|
const noColor = process.env.NO_COLOR !== undefined;
|
|
@@ -44,6 +44,7 @@ Commands:
|
|
|
44
44
|
flush Execute decisions
|
|
45
45
|
peer Manage peers
|
|
46
46
|
doctor Check system health
|
|
47
|
+
update Update cn to latest version
|
|
47
48
|
|
|
48
49
|
Aliases:
|
|
49
50
|
i = inbox, s = status, d = doctor
|
|
@@ -241,6 +242,19 @@ if (command === 'init') {
|
|
|
241
242
|
process.exit(1);
|
|
242
243
|
}
|
|
243
244
|
|
|
245
|
+
if (command === 'update') {
|
|
246
|
+
info('Updating cnagent...');
|
|
247
|
+
try {
|
|
248
|
+
execSync('npm install -g cnagent@latest', { stdio: 'inherit' });
|
|
249
|
+
ok('Updated to latest version.');
|
|
250
|
+
execSync('cn --version', { stdio: 'inherit' });
|
|
251
|
+
} catch (e) {
|
|
252
|
+
fail('Update failed. Try: npm install -g cnagent@latest');
|
|
253
|
+
process.exit(1);
|
|
254
|
+
}
|
|
255
|
+
process.exit(0);
|
|
256
|
+
}
|
|
257
|
+
|
|
244
258
|
// Find hub
|
|
245
259
|
const hubPath = findHubPath();
|
|
246
260
|
if (!hubPath) {
|