[Feature] Support env variables in yarnrc
See original GitHub issue- I’d be willing to implement this feature
- This feature can already be implemented through a plugin
Describe the user story
yarn v1 supports env variables in yarnrc/npmrc:
//registry.npmjs.org/:_authToken=${COMPANY_NPM_TOKEN}
but v2 doesn’t support it in .yarnrc.yml
Describe the solution you’d like
It would be nice to support env variables like in other tools/libraries (for example docker compose)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Configuration options | Yarn - Package Manager
List of all the configuration option for Yarn (yarnrc files) ... Environment variables can be accessed from setting definitions by using the ${NAME}...
Read more >Yarn envvars and .yarnrc files - w3resource
The environment variables defined in the process.env enable you to configure additional Yarn features. CHILD_CONCURRENCY. Process.env.
Read more >Set yarn environment variables without using terminal directly
Almost all providers support custom environment variables. After you set up the variable, you can interpolate it in .yarnrc.yml (if you ...
Read more >Migrating to Yarn 2 - Heroku Dev Center
This article is intended to help current Heroku users migrate from Yarn 1 to ... You will want to remove the environment variables...
Read more >Using modern Yarn for deployment with Node.js on Azure App ...
.yarnrc.yml points to the Yarn version it will be using under .yarn/releases ... to node as NODE_ENV environment variable * debuggingEnabled ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in https://github.com/yarnpkg/berry/pull/1341 💫
You can inject runtime environment variables, including variables already defined within the active shell, by rerouting the
yarnPath
defined in.yarnrc.yml
to a custom path containing a.js
file which instantiates a validYarn v2
release
in the form of achild_process
. At that point, declaring customprocess.env
values is straight-forward. Though it does feel a bit hacky. Check out@yarkPkg Berry
’s repo and you can see they do exactly that. However, I imagine best practices would be to utilize thepnpapi
lifecycle as according to the docs.