@wix/evalforge-evaluator 0.193.0 → 0.194.0
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/build/index.js +49 -10
- package/build/index.js.map +2 -2
- package/build/index.mjs +49 -10
- package/build/index.mjs.map +2 -2
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -7373,6 +7373,7 @@ var import_crypto = require("crypto");
|
|
|
7373
7373
|
var import_path2 = __toESM(require("path"));
|
|
7374
7374
|
var import_child_process = require("child_process");
|
|
7375
7375
|
var INSTALL_TIMEOUT_MS = 1e5;
|
|
7376
|
+
var BUN_BOOTSTRAP_TIMEOUT_MS = 6e4;
|
|
7376
7377
|
var HEARTBEAT_INTERVAL_MS = 5e3;
|
|
7377
7378
|
function reportRegistry(workDir, onProgress) {
|
|
7378
7379
|
try {
|
|
@@ -7461,36 +7462,74 @@ function cloneDirectory(src, dest) {
|
|
|
7461
7462
|
(0, import_fs.cpSync)(src, dest, { recursive: true });
|
|
7462
7463
|
}
|
|
7463
7464
|
}
|
|
7464
|
-
async function
|
|
7465
|
-
|
|
7466
|
-
onProgress(`[diag] npm install starting: ${pm.cmd} ${pm.args.join(" ")}`);
|
|
7465
|
+
async function runCommand(exec, cmd, args, workDir, onProgress, label, timeoutMs) {
|
|
7466
|
+
onProgress(`[diag] ${label} starting: ${cmd} ${args.join(" ")}`);
|
|
7467
7467
|
const startedAt = Date.now();
|
|
7468
7468
|
const heartbeat = setInterval(() => {
|
|
7469
7469
|
onProgress(
|
|
7470
|
-
`[diag]
|
|
7470
|
+
`[diag] ${label} still running: ${Math.round(
|
|
7471
7471
|
(Date.now() - startedAt) / 1e3
|
|
7472
7472
|
)}s elapsed`
|
|
7473
7473
|
);
|
|
7474
7474
|
}, HEARTBEAT_INTERVAL_MS);
|
|
7475
7475
|
try {
|
|
7476
|
-
await exec(
|
|
7476
|
+
await exec(cmd, args, {
|
|
7477
7477
|
cwd: workDir,
|
|
7478
|
-
timeoutMs
|
|
7478
|
+
timeoutMs,
|
|
7479
7479
|
env: { ...process.env, NODE_ENV: "development" }
|
|
7480
7480
|
});
|
|
7481
|
-
onProgress(`[diag]
|
|
7482
|
-
reportNodeModules(workDir, onProgress);
|
|
7481
|
+
onProgress(`[diag] ${label} finished in ${Date.now() - startedAt}ms`);
|
|
7483
7482
|
return true;
|
|
7484
7483
|
} catch (err) {
|
|
7485
7484
|
onProgress(
|
|
7486
|
-
`[diag]
|
|
7485
|
+
`[diag] ${label} FAILED after ${Date.now() - startedAt}ms: ${err instanceof Error ? err.message : String(err)}`
|
|
7487
7486
|
);
|
|
7488
|
-
reportNodeModules(workDir, onProgress);
|
|
7489
7487
|
return false;
|
|
7490
7488
|
} finally {
|
|
7491
7489
|
clearInterval(heartbeat);
|
|
7492
7490
|
}
|
|
7493
7491
|
}
|
|
7492
|
+
async function runInstall(exec, pm, workDir, onProgress) {
|
|
7493
|
+
reportRegistry(workDir, onProgress);
|
|
7494
|
+
const bunReady = await runCommand(
|
|
7495
|
+
exec,
|
|
7496
|
+
"npm",
|
|
7497
|
+
["install", "-g", "bun"],
|
|
7498
|
+
workDir,
|
|
7499
|
+
onProgress,
|
|
7500
|
+
"bun bootstrap",
|
|
7501
|
+
BUN_BOOTSTRAP_TIMEOUT_MS
|
|
7502
|
+
);
|
|
7503
|
+
if (bunReady) {
|
|
7504
|
+
const bunOk = await runCommand(
|
|
7505
|
+
exec,
|
|
7506
|
+
"bun",
|
|
7507
|
+
["install", "--ignore-scripts"],
|
|
7508
|
+
workDir,
|
|
7509
|
+
onProgress,
|
|
7510
|
+
"bun install",
|
|
7511
|
+
INSTALL_TIMEOUT_MS
|
|
7512
|
+
);
|
|
7513
|
+
if (bunOk) {
|
|
7514
|
+
reportNodeModules(workDir, onProgress);
|
|
7515
|
+
return true;
|
|
7516
|
+
}
|
|
7517
|
+
onProgress("[diag] bun install failed \u2014 falling back to npm");
|
|
7518
|
+
} else {
|
|
7519
|
+
onProgress("[diag] bun bootstrap failed \u2014 falling back to npm");
|
|
7520
|
+
}
|
|
7521
|
+
const ok = await runCommand(
|
|
7522
|
+
exec,
|
|
7523
|
+
pm.cmd,
|
|
7524
|
+
pm.args,
|
|
7525
|
+
workDir,
|
|
7526
|
+
onProgress,
|
|
7527
|
+
"npm install",
|
|
7528
|
+
INSTALL_TIMEOUT_MS
|
|
7529
|
+
);
|
|
7530
|
+
reportNodeModules(workDir, onProgress);
|
|
7531
|
+
return ok;
|
|
7532
|
+
}
|
|
7494
7533
|
async function installWithCache(workDir, exec, cacheBase, pm, onProgress) {
|
|
7495
7534
|
const sourceContent = (0, import_fs.readFileSync)(
|
|
7496
7535
|
import_path2.default.join(workDir, pm.cacheSourceFile),
|