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

chore: code review feedback for #3195 #3203

Merged
merged 1 commit into from
Jan 11, 2022
Merged

chore: code review feedback for #3195 #3203

merged 1 commit into from
Jan 11, 2022

Conversation

alexeagle
Copy link
Collaborator

Copy link

@sluongng sluongng left a comment

Choose a reason for hiding this comment

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

There is a small logic flaw I spot. The rest looks good to me.

# Can't tell from documentation if Yarn Berry has any replacement for the --mutex
# flag. We'll have to assume it's safe to run concurrently.
pass
yarn_args.extend(["--cache-folder", str(repository_ctx.path("_yarn_cache"))])
Copy link

Choose a reason for hiding this comment

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

This unfortunately will add --cache-folder for folks who use Yarn Berry and set user_global_yarn_cache to False.

The flag DOES exist within Yarn Berry, but the behavior is to exit with a deprecation error which is not useful:

https://sourcegraph.com/github.com/yarnpkg/berry/-/blob/packages/plugin-essentials/sources/commands/install.ts?L207-219
https://sourcegraph.com/github.com/yarnpkg/berry@ce1e0c31781e3fc791cfa86a01348c4f0dba9aec/-/blob/packages/gatsby/content/advanced/error-codes.md?L295-301

I suggest ensure that refactor it like this:

 if yarn_version == "classic":
    if repository_ctx.attr.use_global_yarn_cache:
        ...
    else:
        ...

if yarn_version == "berry" and not repository_ctx.attr.use_global_yarn_cache:
    # Using Yarn Berry and non-default option for global_yarn_cache
    fail("Option global_yarn_cache has no effect while using Yarn Berry. Please configure it through a .yarnrc file through 'data' attribute.")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah my intent here was the minimal change. thanks for looking up the yarn sources, if that flag just exits that way then I agree we shouldn't call it

@sluongng
Copy link

Thanks. This revision looks good to me 👍

@alexeagle alexeagle merged commit 7b009e2 into stable Jan 11, 2022
alexeagle added a commit that referenced this pull request Jan 12, 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
Development

Successfully merging this pull request may close these issues.

2 participants