Skip to content
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

Merged
merged 6 commits into from Apr 20, 2022

Conversation

IvanZosimov
Copy link
Owner

  • Added caching for compiler's dependencies

  • Fixed unit-tests for supporting new functionality

Comment on lines 39 to 41
for (let command of packageManagerInfo.cacheFolderCommandList) {
pathList.push(await getCommandOutput(command));
}

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));

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, review again, please.

Comment on lines 43 to 47
for (let path of pathList) {
if (!path) {
throw new Error(`Could not get cache folder paths.`);
}
}

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.`);
    }

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, review again, please.

Comment on lines 40 to 51
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`);
}

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(', ')}`
}

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant, thank you!

@IvanZosimov IvanZosimov merged commit 3a3f8d0 into modules-caching Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants