cnagent 2.0.4 → 2.0.5
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 +9 -4
- 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.5';
|
|
15
15
|
|
|
16
16
|
// Colors (respects NO_COLOR)
|
|
17
17
|
const noColor = process.env.NO_COLOR !== undefined;
|
|
@@ -243,11 +243,16 @@ if (command === 'init') {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
if (command === 'update') {
|
|
246
|
-
|
|
246
|
+
// Check if already on latest
|
|
247
247
|
try {
|
|
248
|
+
const latest = execSync('npm view cnagent version', { encoding: 'utf8' }).trim();
|
|
249
|
+
if (VERSION === latest) {
|
|
250
|
+
ok(`Already up to date (v${VERSION})`);
|
|
251
|
+
process.exit(0);
|
|
252
|
+
}
|
|
253
|
+
info(`Updating cnagent v${VERSION} → v${latest}...`);
|
|
248
254
|
execSync('npm install -g cnagent@latest', { stdio: 'inherit' });
|
|
249
|
-
ok(
|
|
250
|
-
execSync('cn --version', { stdio: 'inherit' });
|
|
255
|
+
ok(`Updated to v${latest}`);
|
|
251
256
|
} catch (e) {
|
|
252
257
|
fail('Update failed. Try: npm install -g cnagent@latest');
|
|
253
258
|
process.exit(1);
|