nexrall-code 0.5.119 → 0.5.120
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 +27 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19155,7 +19155,7 @@ var require_dist2 = __commonJS({
|
|
|
19155
19155
|
},
|
|
19156
19156
|
{
|
|
19157
19157
|
key: "join",
|
|
19158
|
-
value: function
|
|
19158
|
+
value: function join7(s2) {
|
|
19159
19159
|
if (this.length === 0)
|
|
19160
19160
|
return "";
|
|
19161
19161
|
var p = this.head;
|
|
@@ -42088,7 +42088,7 @@ var require_BufferList = __commonJS({
|
|
|
42088
42088
|
this.head = this.tail = null;
|
|
42089
42089
|
this.length = 0;
|
|
42090
42090
|
};
|
|
42091
|
-
BufferList.prototype.join = function
|
|
42091
|
+
BufferList.prototype.join = function join7(s2) {
|
|
42092
42092
|
if (this.length === 0)
|
|
42093
42093
|
return "";
|
|
42094
42094
|
var p = this.head;
|
|
@@ -51798,7 +51798,7 @@ var require_buffer_list = __commonJS({
|
|
|
51798
51798
|
}
|
|
51799
51799
|
}, {
|
|
51800
51800
|
key: "join",
|
|
51801
|
-
value: function
|
|
51801
|
+
value: function join7(s2) {
|
|
51802
51802
|
if (this.length === 0)
|
|
51803
51803
|
return "";
|
|
51804
51804
|
var p = this.head;
|
|
@@ -146971,10 +146971,22 @@ async function fetchLatestVersion() {
|
|
|
146971
146971
|
const meta = JSON.parse(raw);
|
|
146972
146972
|
return meta.version ?? "0.0.0";
|
|
146973
146973
|
}
|
|
146974
|
-
function
|
|
146974
|
+
function installArgs(version2) {
|
|
146975
|
+
return ["install", "-g", `nexrall-code@${version2}`, "--prefer-online"];
|
|
146976
|
+
}
|
|
146977
|
+
function installedGlobalVersion() {
|
|
146978
|
+
try {
|
|
146979
|
+
const { execFileSync: execFileSync3 } = __require("child_process");
|
|
146980
|
+
const root = execFileSync3("npm", ["root", "-g"], { encoding: "utf-8" }).trim();
|
|
146981
|
+
return JSON.parse(fs4.readFileSync(path4.join(root, "nexrall-code", "package.json"), "utf-8")).version ?? null;
|
|
146982
|
+
} catch {
|
|
146983
|
+
return null;
|
|
146984
|
+
}
|
|
146985
|
+
}
|
|
146986
|
+
function npmInstallGlobal(version2) {
|
|
146975
146987
|
return new Promise((resolve4) => {
|
|
146976
146988
|
const { spawn } = __require("child_process");
|
|
146977
|
-
const child = spawn("npm",
|
|
146989
|
+
const child = spawn("npm", installArgs(version2), { stdio: "pipe" });
|
|
146978
146990
|
let stderr = "";
|
|
146979
146991
|
child.stderr?.on("data", (c) => {
|
|
146980
146992
|
stderr += c.toString();
|
|
@@ -146983,7 +146995,7 @@ function npmInstallGlobal() {
|
|
|
146983
146995
|
if (code === 0)
|
|
146984
146996
|
return resolve4({ ok: true, usedSudo: false });
|
|
146985
146997
|
if (/EACCES|permission denied/i.test(stderr)) {
|
|
146986
|
-
const sudo = spawn("sudo", ["npm",
|
|
146998
|
+
const sudo = spawn("sudo", ["npm", ...installArgs(version2)], { stdio: "inherit" });
|
|
146987
146999
|
sudo.on("close", (sudoCode) => resolve4({ ok: sudoCode === 0, usedSudo: true }));
|
|
146988
147000
|
} else {
|
|
146989
147001
|
console.error(source_default.dim(stderr.trim()));
|
|
@@ -147038,12 +147050,18 @@ async function updateCommand(opts) {
|
|
|
147038
147050
|
}
|
|
147039
147051
|
console.log();
|
|
147040
147052
|
}
|
|
147041
|
-
process.stdout.write(source_default.dim(` \u2192 Running npm install -g nexrall-code\u2026`));
|
|
147042
|
-
const { ok, usedSudo } = await npmInstallGlobal();
|
|
147053
|
+
process.stdout.write(source_default.dim(` \u2192 Running npm install -g nexrall-code@${latest}\u2026`));
|
|
147054
|
+
const { ok, usedSudo } = await npmInstallGlobal(latest);
|
|
147043
147055
|
process.stdout.write("\r\x1B[K");
|
|
147044
147056
|
if (!ok) {
|
|
147045
147057
|
console.error(source_default.red(" \u2717 Update failed. Run manually:"));
|
|
147046
|
-
console.error(source_default.dim(
|
|
147058
|
+
console.error(source_default.dim(` npm install -g nexrall-code@${latest} --prefer-online`));
|
|
147059
|
+
process.exit(1);
|
|
147060
|
+
}
|
|
147061
|
+
const now = installedGlobalVersion();
|
|
147062
|
+
if (now !== null && now !== latest) {
|
|
147063
|
+
console.error(source_default.red(` \u2717 npm finished but v${now} is installed, not v${latest}. Run manually:`));
|
|
147064
|
+
console.error(source_default.dim(` npm install -g nexrall-code@${latest} --prefer-online`));
|
|
147047
147065
|
process.exit(1);
|
|
147048
147066
|
}
|
|
147049
147067
|
console.log(source_default.green(` \u2713 Updated \u2192 v${latest}${usedSudo ? " (via sudo)" : ""}`));
|