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

Function getYarnPathFromConfigurationIfPresent

ng-dev/utils/resolve-yarn-bin.ts:128–140  ·  view source on GitHub ↗

Gets the Yarn path from the Yarn configuration if present.

(projectDir: string)

Source from the content-addressed store, hash-verified

126
127/** Gets the Yarn path from the Yarn configuration if present. */
128async function getYarnPathFromConfigurationIfPresent(projectDir: string): Promise<string | null> {
129 const yarnRc = await findAndParseYarnConfiguration(projectDir);
130 if (yarnRc === null) {
131 return null;
132 }
133
134 const yarnPath = yarnRc['yarn-path'] ?? yarnRc['yarnPath'];
135 if (yarnPath === undefined) {
136 return null;
137 }
138
139 return path.resolve(projectDir, yarnPath);
140}
141
142async function getYarnVersion(info: YarnCommandInfo): Promise<string | null> {
143 try {

Callers 1

Calls 1

Tested by

no test coverage detected