@buda-ai/connector 0.1.19 → 0.1.20
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 +24 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -517,7 +517,7 @@ import path2 from "path";
|
|
|
517
517
|
// package.json
|
|
518
518
|
var package_default = {
|
|
519
519
|
name: "@buda-ai/connector",
|
|
520
|
-
version: "0.1.
|
|
520
|
+
version: "0.1.20",
|
|
521
521
|
private: false,
|
|
522
522
|
type: "module",
|
|
523
523
|
publishConfig: {
|
|
@@ -2438,6 +2438,26 @@ var renameStagedRuntime = async (source, destination, options = {}) => {
|
|
|
2438
2438
|
}
|
|
2439
2439
|
};
|
|
2440
2440
|
var exists = async (filePath) => access(filePath).then(() => true).catch(() => false);
|
|
2441
|
+
var resolveNpmInvocation = async (options = {}) => {
|
|
2442
|
+
const platform4 = options.platform ?? process.platform;
|
|
2443
|
+
if (platform4 !== "win32") return { argsPrefix: [], executable: "npm" };
|
|
2444
|
+
const nodeExecutable = options.nodeExecutable ?? process.execPath;
|
|
2445
|
+
const pathApi = options.pathApi ?? path6;
|
|
2446
|
+
const pathExists = options.pathExists ?? exists;
|
|
2447
|
+
const candidates = [
|
|
2448
|
+
options.npmExecPath ?? process.env.npm_execpath,
|
|
2449
|
+
pathApi.join(pathApi.dirname(nodeExecutable), "node_modules", "npm", "bin", "npm-cli.js")
|
|
2450
|
+
];
|
|
2451
|
+
for (const candidate of candidates) {
|
|
2452
|
+
if (!candidate || pathApi.basename(candidate).toLowerCase() !== "npm-cli.js") continue;
|
|
2453
|
+
if (await pathExists(candidate)) {
|
|
2454
|
+
return { argsPrefix: [candidate], executable: nodeExecutable };
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
throw new Error(
|
|
2458
|
+
`Unable to locate npm-cli.js for the stable Connector runtime installation (node=${JSON.stringify(nodeExecutable)}, npm_execpath=${JSON.stringify(options.npmExecPath ?? process.env.npm_execpath ?? "")})`
|
|
2459
|
+
);
|
|
2460
|
+
};
|
|
2441
2461
|
var runtimeRoot = () => process.env.BUDA_CONNECTOR_RUNTIME_ROOT || path6.join(homedir3(), ".buda", "runtime");
|
|
2442
2462
|
var runtimePlatformKey = `${process.platform}-${process.arch}-node${process.versions.modules}`;
|
|
2443
2463
|
var versionDirectory = () => path6.join(runtimeRoot(), runtimePlatformKey, CONNECTOR_RUNTIME_VERSION);
|
|
@@ -2471,9 +2491,11 @@ var validateRuntime = async (runtime) => {
|
|
|
2471
2491
|
};
|
|
2472
2492
|
var installFromNpm = async (directory) => {
|
|
2473
2493
|
await mkdir5(directory, { recursive: true, mode: 448 });
|
|
2494
|
+
const npm = await resolveNpmInvocation();
|
|
2474
2495
|
await execFileAsync(
|
|
2475
|
-
|
|
2496
|
+
npm.executable,
|
|
2476
2497
|
[
|
|
2498
|
+
...npm.argsPrefix,
|
|
2477
2499
|
"install",
|
|
2478
2500
|
"--ignore-scripts=false",
|
|
2479
2501
|
"--no-audit",
|