MCPcopy
hub / github.com/neomjs/neo / installDependencies

Function installDependencies

ai/scripts/migrations/bootstrapWorktree.mjs:529–550  ·  view source on GitHub ↗
({projectRoot, log = console.log, exec = execFileAsync})

Source from the content-addressed store, hash-verified

527 * @returns {Promise<'already-installed'|'installed'>} Action taken.
528 */
529export async function installDependencies({projectRoot, log = console.log, exec = execFileAsync}) {
530 const nodeModulesPath = path.join(projectRoot, 'node_modules');
531 let action;
532
533 if (await exists(nodeModulesPath)) {
534 log(`install skip (exists): node_modules`);
535 action = 'already-installed';
536 } else {
537 log(`installing dependencies (npm install)...`);
538 const start = Date.now();
539 await exec('npm', ['install'], {cwd: projectRoot});
540 log(`installed dependencies in ${Math.round((Date.now() - start) / 1000)}s`);
541 action = 'installed';
542 }
543
544 log(`bundling parse5 (test-runner prerequisite)...`);
545 const bundleStart = Date.now();
546 await exec('npm', ['run', 'bundle-parse5'], {cwd: projectRoot});
547 log(`bundled parse5 in ${Math.round((Date.now() - bundleStart) / 1000)}s`);
548
549 return action;
550}
551
552/**
553 * @summary Runs the full `npm run build-all` after ensuring dependencies are installed.

Callers 2

runBuildAllFunction · 0.85

Calls 3

existsFunction · 0.70
logFunction · 0.50
execFunction · 0.50

Tested by

no test coverage detected