Skip to content

Commit

Permalink
fix(yarn): try/catch .yarnrc.yml parsing (#19787)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Jan 11, 2023
1 parent 58a6d64 commit f85ee26
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/modules/manager/npm/extract/yarn.ts
Expand Up @@ -51,14 +51,22 @@ export async function getYarnLock(filePath: string): Promise<LockFile> {
}

export function getZeroInstallPaths(yarnrcYml: string): string[] {
const conf = parseSyml(yarnrcYml);
let conf: any;
try {
conf = parseSyml(yarnrcYml);
} catch (err) /* istanbul ignore next */ {
logger.warn({ err }, 'Error parsing .yarnrc.yml');
}
const paths = [
conf.cacheFolder || './.yarn/cache',
conf?.cacheFolder || './.yarn/cache',
'.pnp.cjs',
'.pnp.js',
'.pnp.loader.mjs',
];
if (miscUtils.tryParseOptionalBoolean(conf.pnpEnableInlining) === false) {
if (
conf &&
miscUtils.tryParseOptionalBoolean(conf.pnpEnableInlining) === false
) {
paths.push(conf.pnpDataPath || './.pnp.data.json');
}
return paths;
Expand Down

0 comments on commit f85ee26

Please sign in to comment.