repowisestage 0.0.16 → 0.0.18
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/bin/repowise.js +6 -4
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -823,7 +823,7 @@ async function removePidFile() {
|
|
|
823
823
|
|
|
824
824
|
// ../listener/dist/lib/auto-updater.js
|
|
825
825
|
import { execFile as execFile2 } from "child_process";
|
|
826
|
-
import { access as access2, constants } from "fs/promises";
|
|
826
|
+
import { access as access2, constants, realpath } from "fs/promises";
|
|
827
827
|
import { dirname as dirname3, join as join9 } from "path";
|
|
828
828
|
import { promisify as promisify2 } from "util";
|
|
829
829
|
var execFileAsync2 = promisify2(execFile2);
|
|
@@ -836,9 +836,11 @@ async function installUpdate(currentVersion, packageName, targetVersion) {
|
|
|
836
836
|
console.log(`[auto-update] ${targetVersion} is not newer than ${currentVersion} \u2014 skipping`);
|
|
837
837
|
return { updated: false };
|
|
838
838
|
}
|
|
839
|
-
const
|
|
839
|
+
const npmWrapper = join9(dirname3(process.execPath), "npm");
|
|
840
|
+
const npmScript = await realpath(npmWrapper);
|
|
841
|
+
const runNpm = (args) => execFileAsync2(process.execPath, [npmScript, ...args], { timeout: 6e4 });
|
|
840
842
|
try {
|
|
841
|
-
const { stdout: prefix } = await
|
|
843
|
+
const { stdout: prefix } = await runNpm(["prefix", "-g"]);
|
|
842
844
|
const npmDir = join9(prefix.trim(), "lib", "node_modules");
|
|
843
845
|
const checkDir = process.platform === "win32" ? prefix.trim() : npmDir;
|
|
844
846
|
await access2(checkDir, constants.W_OK);
|
|
@@ -849,7 +851,7 @@ async function installUpdate(currentVersion, packageName, targetVersion) {
|
|
|
849
851
|
}
|
|
850
852
|
console.log(`[auto-update] Updating ${packageName} from ${currentVersion} to ${targetVersion}...`);
|
|
851
853
|
try {
|
|
852
|
-
await
|
|
854
|
+
await runNpm(["install", "-g", "--ignore-scripts", `${packageName}@${targetVersion}`]);
|
|
853
855
|
console.log(`[auto-update] Successfully updated to ${targetVersion}`);
|
|
854
856
|
return { updated: true, latestVersion: targetVersion };
|
|
855
857
|
} catch (err) {
|