New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added caching for compiler's dependencies #3
Conversation
src/cache-utils.ts
Outdated
for (let command of packageManagerInfo.cacheFolderCommandList) { | ||
pathList.push(await getCommandOutput(command)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be better to use this snippet:
pathList = packageManagerInfo.cacheFolderCommandList.map(command => getCommandOutput(command));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, review again, please.
src/cache-utils.ts
Outdated
for (let path of pathList) { | ||
if (!path) { | ||
throw new Error(`Could not get cache folder paths.`); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can filter values:
const emptyFolders = pathList.filter(item => !item);
if(emptyFolders.length) {
throw new Error(`Could not get cache folder paths.`);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, review again, please.
src/cache-save.ts
Outdated
for (let path of cachePaths) { | ||
if (!fs.existsSync(path)) { | ||
logWarning( | ||
`Cache folder path is retrieved but doesn't exist on disk: ${path}` | ||
); | ||
pathsCounter--; | ||
} | ||
} | ||
|
||
if (!pathsCounter) { | ||
throw new Error(`No cache folders exist on disk`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const nonExistingPaths = cachePaths.filter(cachePath => !fs.existsSync(cachePath));
if (nonExistingPaths.length === cachePaths.length) {
throw new Error(`No cache folders exist on disk`);
}
if (nonExistingPath.length) {
`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPath.join(', ')}`
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant, thank you!
Added caching for compiler's dependencies
Fixed unit-tests for supporting new functionality