@pipelab/core-node 1.0.0-beta.26 → 1.0.0-beta.27
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/CHANGELOG.md +6 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/utils/remote.ts +4 -18
package/package.json
CHANGED
package/src/utils/remote.ts
CHANGED
|
@@ -490,17 +490,10 @@ async function installDependencies(packageDir: string, packageName: string, opti
|
|
|
490
490
|
return;
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
// To prevent other processes from seeing a partially populated node_modules,
|
|
494
|
-
// we can create a temp directory next to packageDir, run pnpm there, and rename node_modules
|
|
495
|
-
const tempDir = `${packageDir}.tmp-deps-${Math.random().toString(36).slice(2)}`;
|
|
496
|
-
await mkdir(tempDir, { recursive: true });
|
|
497
493
|
try {
|
|
498
|
-
// Copy package.json to tempDir so pnpm can install dependencies
|
|
499
|
-
await cp(join(packageDir, "package.json"), join(tempDir, "package.json"));
|
|
500
|
-
|
|
501
494
|
console.log(`[Fetcher] ${packageName}: Ensuring dependencies are installed...`);
|
|
502
495
|
const pnpmStart = Date.now();
|
|
503
|
-
const { all } = await runPnpm(
|
|
496
|
+
const { all } = await runPnpm(packageDir, {
|
|
504
497
|
signal: options.signal,
|
|
505
498
|
context: options.context,
|
|
506
499
|
});
|
|
@@ -508,24 +501,17 @@ async function installDependencies(packageDir: string, packageName: string, opti
|
|
|
508
501
|
|
|
509
502
|
if (all) console.log(`[Fetcher] ${packageName}: Installation trace:\n${all}`);
|
|
510
503
|
|
|
511
|
-
// Atomically rename node_modules from tempDir to packageDir/node_modules
|
|
512
|
-
const tempNodeModules = join(tempDir, "node_modules");
|
|
513
|
-
if (existsSync(nodeModulesPath)) {
|
|
514
|
-
await rm(nodeModulesPath, { recursive: true, force: true }).catch(() => {});
|
|
515
|
-
}
|
|
516
|
-
const renameStart = Date.now();
|
|
517
|
-
await rename(tempNodeModules, nodeModulesPath);
|
|
518
504
|
console.log(
|
|
519
|
-
`[Fetcher] ${packageName}: Dependencies installed successfully (
|
|
505
|
+
`[Fetcher] ${packageName}: Dependencies installed successfully (total installDependencies took ${Date.now() - start}ms).`,
|
|
520
506
|
);
|
|
521
507
|
} catch (err: any) {
|
|
522
508
|
console.error(
|
|
523
509
|
`[Fetcher] ${packageName}: CRITICAL ERROR during dependency installation: ${err.message}`,
|
|
524
510
|
);
|
|
525
511
|
if (err.all) console.error(`[Fetcher] ${packageName}: Error details:\n${err.all}`);
|
|
512
|
+
// Clean up node_modules on error to allow retries
|
|
513
|
+
await rm(nodeModulesPath, { recursive: true, force: true }).catch(() => {});
|
|
526
514
|
throw new Error(`Failed to install dependencies for ${packageName}. See logs for details.`);
|
|
527
|
-
} finally {
|
|
528
|
-
await rm(tempDir, { recursive: true, force: true }).catch(() => {});
|
|
529
515
|
}
|
|
530
516
|
}
|
|
531
517
|
|