oreshnik-cli 0.1.4 → 0.1.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/dist/cli.js +20 -16
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4009,22 +4009,26 @@ async function preflightCommand(options) {
|
|
|
4009
4009
|
header("ORESHNIK PREFLIGHT", (/* @__PURE__ */ new Date()).toISOString());
|
|
4010
4010
|
try {
|
|
4011
4011
|
const { execSync } = await import("child_process");
|
|
4012
|
-
const
|
|
4013
|
-
const
|
|
4014
|
-
if (
|
|
4015
|
-
const
|
|
4016
|
-
const
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
console.log(` [
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4012
|
+
const treeDirty = git2.statusPorcelain();
|
|
4013
|
+
const isClean = treeDirty.ok && treeDirty.value.length === 0;
|
|
4014
|
+
if (isClean) {
|
|
4015
|
+
const installed = execSync("npm list -g oreshnik-cli --depth=0 --json 2>nul", { encoding: "utf8", timeout: 1e4 });
|
|
4016
|
+
const latest = execSync("npm view oreshnik-cli version 2>nul", { encoding: "utf8", timeout: 1e4 });
|
|
4017
|
+
if (installed && latest) {
|
|
4018
|
+
const installedMatch = installed.match(/"oreshnik-cli":\s*\{[^}]*"version":\s*"([^"]+)"/);
|
|
4019
|
+
const installedVer = installedMatch?.[1];
|
|
4020
|
+
const latestVer = latest.trim();
|
|
4021
|
+
if (installedVer && latestVer && installedVer !== latestVer) {
|
|
4022
|
+
console.log(` [UPDATE] oreshnik-cli ${installedVer} \u2192 ${latestVer} (tree clean, safe to update)`);
|
|
4023
|
+
try {
|
|
4024
|
+
execSync("npm install -g oreshnik-cli@alpha", { encoding: "utf8", timeout: 6e4, stdio: "inherit" });
|
|
4025
|
+
console.log(` [OK] Updated to ${latestVer}. Restarting preflight...`);
|
|
4026
|
+
const { spawnSync: spawnSync4 } = await import("child_process");
|
|
4027
|
+
spawnSync4(process.argv[0], process.argv.slice(1), { stdio: "inherit", shell: true });
|
|
4028
|
+
process.exit(0);
|
|
4029
|
+
} catch {
|
|
4030
|
+
console.log(" [WARN] Update failed. Continuing with current version.");
|
|
4031
|
+
}
|
|
4028
4032
|
}
|
|
4029
4033
|
}
|
|
4030
4034
|
}
|