@wix/evalforge-evaluator 0.193.0 → 0.195.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 +55 -10
- package/build/index.js.map +2 -2
- package/build/index.mjs +55 -10
- package/build/index.mjs.map +2 -2
- package/package.json +2 -2
package/build/index.mjs
CHANGED
|
@@ -7402,6 +7402,7 @@ import { createHash } from "crypto";
|
|
|
7402
7402
|
import path from "path";
|
|
7403
7403
|
import { spawn, execFileSync } from "child_process";
|
|
7404
7404
|
var INSTALL_TIMEOUT_MS = 1e5;
|
|
7405
|
+
var PNPM_BOOTSTRAP_TIMEOUT_MS = 6e4;
|
|
7405
7406
|
var HEARTBEAT_INTERVAL_MS = 5e3;
|
|
7406
7407
|
function reportRegistry(workDir, onProgress) {
|
|
7407
7408
|
try {
|
|
@@ -7490,36 +7491,80 @@ function cloneDirectory(src, dest) {
|
|
|
7490
7491
|
cpSync(src, dest, { recursive: true });
|
|
7491
7492
|
}
|
|
7492
7493
|
}
|
|
7493
|
-
async function
|
|
7494
|
-
|
|
7495
|
-
onProgress(`[diag] npm install starting: ${pm.cmd} ${pm.args.join(" ")}`);
|
|
7494
|
+
async function runCommand(exec, cmd, args, workDir, onProgress, label, timeoutMs) {
|
|
7495
|
+
onProgress(`[diag] ${label} starting: ${cmd} ${args.join(" ")}`);
|
|
7496
7496
|
const startedAt = Date.now();
|
|
7497
7497
|
const heartbeat = setInterval(() => {
|
|
7498
7498
|
onProgress(
|
|
7499
|
-
`[diag]
|
|
7499
|
+
`[diag] ${label} still running: ${Math.round(
|
|
7500
7500
|
(Date.now() - startedAt) / 1e3
|
|
7501
7501
|
)}s elapsed`
|
|
7502
7502
|
);
|
|
7503
7503
|
}, HEARTBEAT_INTERVAL_MS);
|
|
7504
7504
|
try {
|
|
7505
|
-
await exec(
|
|
7505
|
+
await exec(cmd, args, {
|
|
7506
7506
|
cwd: workDir,
|
|
7507
|
-
timeoutMs
|
|
7507
|
+
timeoutMs,
|
|
7508
7508
|
env: { ...process.env, NODE_ENV: "development" }
|
|
7509
7509
|
});
|
|
7510
|
-
onProgress(`[diag]
|
|
7511
|
-
reportNodeModules(workDir, onProgress);
|
|
7510
|
+
onProgress(`[diag] ${label} finished in ${Date.now() - startedAt}ms`);
|
|
7512
7511
|
return true;
|
|
7513
7512
|
} catch (err) {
|
|
7514
7513
|
onProgress(
|
|
7515
|
-
`[diag]
|
|
7514
|
+
`[diag] ${label} FAILED after ${Date.now() - startedAt}ms: ${err instanceof Error ? err.message : String(err)}`
|
|
7516
7515
|
);
|
|
7517
|
-
reportNodeModules(workDir, onProgress);
|
|
7518
7516
|
return false;
|
|
7519
7517
|
} finally {
|
|
7520
7518
|
clearInterval(heartbeat);
|
|
7521
7519
|
}
|
|
7522
7520
|
}
|
|
7521
|
+
var PNPM_INSTALL_ARGS = [
|
|
7522
|
+
"install",
|
|
7523
|
+
"--shamefully-hoist",
|
|
7524
|
+
"--ignore-scripts",
|
|
7525
|
+
"--network-concurrency=8"
|
|
7526
|
+
];
|
|
7527
|
+
async function runInstall(exec, pm, workDir, onProgress) {
|
|
7528
|
+
reportRegistry(workDir, onProgress);
|
|
7529
|
+
const pnpmReady = await runCommand(
|
|
7530
|
+
exec,
|
|
7531
|
+
"npm",
|
|
7532
|
+
["install", "-g", "pnpm"],
|
|
7533
|
+
workDir,
|
|
7534
|
+
onProgress,
|
|
7535
|
+
"pnpm bootstrap",
|
|
7536
|
+
PNPM_BOOTSTRAP_TIMEOUT_MS
|
|
7537
|
+
);
|
|
7538
|
+
if (pnpmReady) {
|
|
7539
|
+
const pnpmOk = await runCommand(
|
|
7540
|
+
exec,
|
|
7541
|
+
"pnpm",
|
|
7542
|
+
PNPM_INSTALL_ARGS,
|
|
7543
|
+
workDir,
|
|
7544
|
+
onProgress,
|
|
7545
|
+
"pnpm install",
|
|
7546
|
+
INSTALL_TIMEOUT_MS
|
|
7547
|
+
);
|
|
7548
|
+
if (pnpmOk) {
|
|
7549
|
+
reportNodeModules(workDir, onProgress);
|
|
7550
|
+
return true;
|
|
7551
|
+
}
|
|
7552
|
+
onProgress("[diag] pnpm install failed \u2014 falling back to npm");
|
|
7553
|
+
} else {
|
|
7554
|
+
onProgress("[diag] pnpm bootstrap failed \u2014 falling back to npm");
|
|
7555
|
+
}
|
|
7556
|
+
const ok = await runCommand(
|
|
7557
|
+
exec,
|
|
7558
|
+
pm.cmd,
|
|
7559
|
+
pm.args,
|
|
7560
|
+
workDir,
|
|
7561
|
+
onProgress,
|
|
7562
|
+
"npm install",
|
|
7563
|
+
INSTALL_TIMEOUT_MS
|
|
7564
|
+
);
|
|
7565
|
+
reportNodeModules(workDir, onProgress);
|
|
7566
|
+
return ok;
|
|
7567
|
+
}
|
|
7523
7568
|
async function installWithCache(workDir, exec, cacheBase, pm, onProgress) {
|
|
7524
7569
|
const sourceContent = readFileSync(
|
|
7525
7570
|
path.join(workDir, pm.cacheSourceFile),
|