Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Allow to force Yarn usage #440

Merged
merged 4 commits into from
Jul 2, 2020
Merged

Allow to force Yarn usage #440

merged 4 commits into from
Jul 2, 2020

Conversation

Embraser01
Copy link
Contributor

This PR add a new environment variable that allows anyone to force the usage of yarn. It's a simple workaround of #196.

The current workaround for Yarn workspaces (here) only works with Yarn v1, Yarn v2 use yarn.lock to determine the root of the project and so, setting a empty yarn.lock in a specific folder will fail.

I choose the env var USE_YARN but it could be anything really 😄.

@Embraser01 Embraser01 requested a review from a team as a code owner June 18, 2020 15:33
@ehmicky
Copy link
Contributor

ehmicky commented Jun 18, 2020

Hi @Embraser01,

Thanks a lot for working on this!
This makes sense to me.
@mheffner @vbrown608 What do you think?

Note: we would also need to:

  • Update @netlify/build since it runs yarn detecting yarn.lock as well
  • Add to the documentation website

@Embraser01
Copy link
Contributor Author

Note: we would also need to:

  • Update @netlify/build since it runs yarn detecting yarn.lock as well

Looking at the code for @netlify/build, it seems to be a little trickier to make it work with Yarn v2:

Some options have changed, --no-progress and --no-interactive don't exist anymore so this command will fail...

Furthermore, the --cache-folder option is not used anymore (there is actually a special case for Netlify to report it as a warning instead of an error here). The global cache folder used by Yarn 2 is ~/.yarn/berry/cache/ but can be moved with the YARN_GLOBAL_FOLDER env var (ref.).

run-build-functions.sh Outdated Show resolved Hide resolved
@ehmicky
Copy link
Contributor

ehmicky commented Jun 18, 2020

Thanks for all that information! I have summarized it in a separate issue for @netlify/build only at netlify/build#1535. Could you please check it out and confirm I haven't missed anything?

Any help to improve Yarn support in the build-image is really appreciated!

run-build-functions.sh Outdated Show resolved Hide resolved
run-build-functions.sh Outdated Show resolved Hide resolved
Co-authored-by: ehmicky <ehmicky@users.noreply.github.com>
@ehmicky ehmicky self-requested a review June 19, 2020 13:41
@ehmicky
Copy link
Contributor

ehmicky commented Jun 19, 2020

This looks good to me!
@vbrown608 @mheffner What do you think?

@vbrown608
Copy link
Contributor

vbrown608 commented Jun 19, 2020

Looks good. I suggest we prefix the environment variable like NETLIFY_USE_YARN to avoid the kind of collisions we saw with SITE_ID.

(It would be weird if someone has USE_YARN set and doesn't want to use yarn, but we might as well make it a practice going forward.)

run-build-functions.sh Outdated Show resolved Hide resolved
run-build-functions.sh Outdated Show resolved Hide resolved
@ehmicky
Copy link
Contributor

ehmicky commented Jun 19, 2020

Issue to add to documentation: https://github.com/netlify/docs/issues/632

Co-authored-by: ehmicky <ehmicky@users.noreply.github.com>
@ehmicky ehmicky merged commit 35ad865 into netlify:xenial Jul 2, 2020
@Embraser01 Embraser01 deleted the patch-1 branch August 6, 2020 12:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants