MCPcopy Create free account
hub / github.com/angular/dev-infra / installDependenciesForCurrentBranch

Function installDependenciesForCurrentBranch

ng-dev/release/publish/actions.ts:401–426  ·  view source on GitHub ↗

Installs all Yarn dependencies in the current branch.

()

Source from the content-addressed store, hash-verified

399
400 /** Installs all Yarn dependencies in the current branch. */
401 protected async installDependenciesForCurrentBranch() {
402 if (PnpmVersioning.isUsingPnpm(this.projectDir)) {
403 // Note: We delate all contents of `node_modules` before installing dependencies. We do
404 // this because if a pnpm workspace package exists at one ref and not another, it can
405 // cause the pnpm install from within Bazel to errantly attempt to install a package that
406 // does not exist.
407 try {
408 this.git.run(['clean', '-qdfX', '**/node_modules']);
409 } catch {}
410 await ExternalCommands.invokeNvmInstall(this.projectDir);
411 await ExternalCommands.invokePnpmInstall(this.projectDir);
412 return;
413 }
414
415 // Note: We delete all contents of the `node_modules` first. This is necessary
416 // because Yarn could preserve extraneous/outdated nested modules that will cause
417 // unexpected build failures with the NodeJS Bazel `@npm` workspace generation.
418 // This is a workaround for: https://github.com/yarnpkg/yarn/issues/8146. Even though
419 // we might be able to fix this with Yarn 2+, it is reasonable ensuring clean node modules.
420 // TODO: Remove this when we use Yarn 2+ in all Angular repositories.
421 try {
422 this.git.run(['clean', '-qdfX', '**/node_modules']);
423 } catch {}
424 await ExternalCommands.invokeNvmInstall(this.projectDir);
425 await ExternalCommands.invokeYarnInstall(this.projectDir);
426 }
427
428 /**
429 * Creates a commit for the specified files with the given message.

Callers

nothing calls this directly

Calls 2

isUsingPnpmMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected