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

[Feature] Allow environment variables to be set in .yarnrc.yml #2464

Closed
1 of 2 tasks
IanVS opened this issue Feb 11, 2021 · 5 comments
Closed
1 of 2 tasks

[Feature] Allow environment variables to be set in .yarnrc.yml #2464

IanVS opened this issue Feb 11, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@IanVS
Copy link
Contributor

IanVS commented Feb 11, 2021

  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

I am upgrading from yarn 1 to 2, and am having a hard time porting one of the lines of my older .yarnrc file, which is:

puppeteer-skip-chromium-download true

This prevents puppeteer from trying to reach out to the internet and download chromium, which it can't do in my CI server because we disable network access. It seems that the config format has gotten more strict with yarn v2, and I'm no longer able to set this variable in the config file.

Describe the solution you'd like

It is currently possible to read an environment variable in the .yarnrc.yml, which is pretty awesome, but it would be great if we could set them too. Maybe something like:

${PUPPETEER_SKIP_CHROMIUM_DOWNLOAD}: true

Describe the drawbacks of your solution

The yarn config -v validation might get trickier, and honestly I'm not really sure if that syntax would break yaml parsing.

Describe alternatives you've considered

I could try to make sure I add PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true every time I run a yarn install, but that's not ideal. I could also create a wrapper script that sets the environment variable before running the actual yarn-berry.js file, as recommended in #1146 (comment), but that feels a bit hacky too.

@nawbc

This comment has been minimized.

@tychenjiajun
Copy link

Related #3938
This really stop me from migrating to v2 or later versions.

@rally25rs
Copy link
Contributor

The sharp library seems to want some env vars to be set as well, which would benefit from this feature.
https://sharp.pixelplumbing.com/install#custom-prebuilt-binaries

To install the prebuilt sharp binaries from a custom URL, set the sharp_binary_host npm config option or the npm_config_sharp_binary_host environment variable.

@merceyz
Copy link
Member

merceyz commented Jul 27, 2023

We've added support for environment files so this should be covered by that.
Ref #4718

@merceyz merceyz closed this as not planned Won't fix, can't repro, duplicate, stale Jul 27, 2023
@ricovitch
Copy link

ricovitch commented Sep 5, 2023

The sharp library seems to want some env vars to be set as well, which would benefit from this feature. https://sharp.pixelplumbing.com/install#custom-prebuilt-binaries

To install the prebuilt sharp binaries from a custom URL, set the sharp_binary_host npm config option or the npm_config_sharp_binary_host environment variable.

@rally25rs How did you workaround installing sharp library through prebuilt binaries with current latest yarn release ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants