@aerovato/operator-helper 1.1.0 → 1.1.1
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 +18 -5
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35017,7 +35017,7 @@ function resolveAnnotationsKey(schema) {
|
|
|
35017
35017
|
// package.json
|
|
35018
35018
|
var package_default = {
|
|
35019
35019
|
name: "@aerovato/operator-helper",
|
|
35020
|
-
version: "1.1.
|
|
35020
|
+
version: "1.1.1",
|
|
35021
35021
|
description: "Installation and setup CLI for Operator Memory",
|
|
35022
35022
|
license: "BSD-3-Clause",
|
|
35023
35023
|
author: "Aerovato Research",
|
|
@@ -37212,7 +37212,8 @@ var NpmRegistry;
|
|
|
37212
37212
|
|
|
37213
37213
|
// src/update.ts
|
|
37214
37214
|
import { mkdir as mkdir3, readFile as readFile5, writeFile as writeFile4 } from "node:fs/promises";
|
|
37215
|
-
import {
|
|
37215
|
+
import { realpathSync } from "node:fs";
|
|
37216
|
+
import { dirname as dirname2, join as join7, sep as sep2 } from "node:path";
|
|
37216
37217
|
var HELPER_PACKAGE = "@aerovato/operator-helper";
|
|
37217
37218
|
var UPDATE_TIMEOUT = "60 seconds";
|
|
37218
37219
|
var SUCCESS_COOLDOWN = 60 * 60 * 1000;
|
|
@@ -37250,7 +37251,7 @@ var autoUpdate = exports_Effect.fn("autoUpdate")(function* (currentVersion, cont
|
|
|
37250
37251
|
return { status: "current" };
|
|
37251
37252
|
}
|
|
37252
37253
|
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
37253
|
-
const channel = yield* detectInstallationChannel(spawner, context3.cwd);
|
|
37254
|
+
const channel = yield* detectInstallationChannel(spawner, context3.cwd, process.argv[1] ?? process.execPath);
|
|
37254
37255
|
if (channel === "unknown") {
|
|
37255
37256
|
yield* exports_Effect.promise(() => writeUpdateCheck(context3, {
|
|
37256
37257
|
checkedAt: Date.now(),
|
|
@@ -37291,8 +37292,17 @@ async function writeUpdateCheck(context3, check2) {
|
|
|
37291
37292
|
await writeFile4(path, JSON.stringify(check2), { mode: 384 });
|
|
37292
37293
|
} catch {}
|
|
37293
37294
|
}
|
|
37294
|
-
function detectInstallationChannel(spawner, cwd) {
|
|
37295
|
+
function detectInstallationChannel(spawner, cwd, executablePath) {
|
|
37295
37296
|
return exports_Effect.gen(function* () {
|
|
37297
|
+
const executable = realpathSync(executablePath);
|
|
37298
|
+
const [bunBin, npmPrefix] = yield* exports_Effect.all([
|
|
37299
|
+
globalDirectory(spawner, "bun", ["pm", "bin", "--global"], cwd),
|
|
37300
|
+
globalDirectory(spawner, "npm", ["prefix", "--global"], cwd)
|
|
37301
|
+
], { concurrency: "unbounded" });
|
|
37302
|
+
if (bunBin !== null && executable.startsWith(`${bunBin}${sep2}`))
|
|
37303
|
+
return "bun";
|
|
37304
|
+
if (npmPrefix !== null && executable.startsWith(`${npmPrefix}${sep2}`))
|
|
37305
|
+
return "npm";
|
|
37296
37306
|
const [bun, npm] = yield* exports_Effect.all([
|
|
37297
37307
|
hasGlobalPackage(spawner, "bun", ["pm", "ls", "--global"], cwd),
|
|
37298
37308
|
hasGlobalPackage(spawner, "npm", ["list", "--global", HELPER_PACKAGE, "--depth=0", "--json"], cwd)
|
|
@@ -37302,6 +37312,9 @@ function detectInstallationChannel(spawner, cwd) {
|
|
|
37302
37312
|
return bun ? "bun" : "npm";
|
|
37303
37313
|
});
|
|
37304
37314
|
}
|
|
37315
|
+
function globalDirectory(spawner, executable, args2, cwd) {
|
|
37316
|
+
return run3(spawner, exports_ChildProcess.make(executable, args2, { cwd })).pipe(exports_Effect.map((result4) => result4.exitCode === 0 && result4.stdout.trim() !== "" ? result4.stdout.trim() : null), exports_Effect.orElseSucceed(() => null));
|
|
37317
|
+
}
|
|
37305
37318
|
function hasGlobalPackage(spawner, executable, args2, cwd) {
|
|
37306
37319
|
return run3(spawner, exports_ChildProcess.make(executable, args2, { cwd })).pipe(exports_Effect.map((result4) => result4.exitCode === 0 && `${result4.stdout}
|
|
37307
37320
|
${result4.stderr}`.includes(HELPER_PACKAGE)), exports_Effect.orElseSucceed(() => false));
|
|
@@ -37381,4 +37394,4 @@ var main = exports_Effect.gen(function* () {
|
|
|
37381
37394
|
}).pipe(exports_Effect.provide(LiveLayers));
|
|
37382
37395
|
exports_NodeRuntime.runMain(main);
|
|
37383
37396
|
|
|
37384
|
-
//# debugId=
|
|
37397
|
+
//# debugId=1FE33496CAEDF26564756E2164756E21
|