Skip to content
Snippets Groups Projects
Commit f9dcf36c authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix(yarn): try/catch yarnrc check

parent dd4b97df
No related merge requests found
...@@ -14,14 +14,18 @@ export interface GenerateLockFileResult { ...@@ -14,14 +14,18 @@ export interface GenerateLockFileResult {
} }
export async function hasYarnOfflineMirror(cwd: string): Promise<boolean> { export async function hasYarnOfflineMirror(cwd: string): Promise<boolean> {
const yarnrc = await readFile(`${cwd}/.yarnrc`, 'utf8'); try {
if (is.string(yarnrc)) { const yarnrc = await readFile(`${cwd}/.yarnrc`, 'utf8');
const mirrorLine = yarnrc if (is.string(yarnrc)) {
.split('\n') const mirrorLine = yarnrc
.find((line) => line.startsWith('yarn-offline-mirror ')); .split('\n')
if (mirrorLine) { .find((line) => line.startsWith('yarn-offline-mirror '));
return true; if (mirrorLine) {
return true;
}
} }
} catch (err) /* istanbul ignore next */ {
// not found
} }
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment