agenttop 0.10.3 → 0.10.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/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -364,9 +364,14 @@ var getPackageVersion = async () => {
|
|
|
364
364
|
return "0.0.0";
|
|
365
365
|
}
|
|
366
366
|
};
|
|
367
|
+
var getNpmPath = () => {
|
|
368
|
+
const nodeDir = dirname(process.execPath);
|
|
369
|
+
return join(nodeDir, "npm");
|
|
370
|
+
};
|
|
367
371
|
var checkForUpdate = () => new Promise((resolve) => {
|
|
372
|
+
const npm = getNpmPath();
|
|
368
373
|
getPackageVersion().then((current) => {
|
|
369
|
-
execFile(
|
|
374
|
+
execFile(npm, ["view", "agenttop", "version"], { encoding: "utf-8", timeout: 5e3 }, (err, stdout) => {
|
|
370
375
|
if (err || !stdout) {
|
|
371
376
|
resolve({ current, latest: current, available: false });
|
|
372
377
|
return;
|
|
@@ -381,8 +386,9 @@ var checkForUpdate = () => new Promise((resolve) => {
|
|
|
381
386
|
});
|
|
382
387
|
});
|
|
383
388
|
var installUpdate = () => {
|
|
389
|
+
const npm = getNpmPath();
|
|
384
390
|
return new Promise((resolve, reject) => {
|
|
385
|
-
exec(
|
|
391
|
+
exec(`${npm} install -g agenttop@latest`, { timeout: 6e4 }, (err, stdout) => {
|
|
386
392
|
if (err) {
|
|
387
393
|
reject(err);
|
|
388
394
|
} else {
|