-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Support Yarn 2 #795
Support Yarn 2 #795
Conversation
Warn yarn2 with cache
…/heroku-buildpack-nodejs into warn-yarn2-engine-package
warning when yarn 2 and engine package.json
display warning for when .yarnrc file exists
display warning for if .npmrc exists
Add checks for Yarn 2
Skip yarn2 cache prune
Set up to use Yarn from vendor directory
if [[ "$YARN2" == "true" ]]; then | ||
if [[ "$NODE_MODULES_CACHE" == "true" ]]; then | ||
warn " | ||
WARNING- You are using Yarn 2. The buildpack won't cache, because Yarn 2 does not provide node modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does provide a node_modules
folder with the node-modules
linker https://yarnpkg.com/configuration/yarnrc#nodeLinker
Though it would be faster to cache the actual cache folder which you can get using yarn config get cacheFolder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This warning message should be reworded - so thanks for pointing this out. However, we're not supporting this yet in this first phase.
|
||
if $YARN; then | ||
if [[ "$YARN2" == "true" ]]; then | ||
echo "Using Yarn 2, skipping installations." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn install
would still need to run for dependencies with a postinstall script when using PnP and to create the node_modules
folder when using the node-modules
linker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right - thanks for pointing this out. The assumption is that the install scripts will not be run for now since install is not run. I made a note in the PR description. We will eventually want to support this, of course, but not in this first draft.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, keep in mind any dependency with a postinstall script wont work. So for example core-js
wont be found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we'll be working on that and keep that in mind. This is a priority. Thanks for the review!
8ec552c
to
0ea2091
Compare
0ea2091
to
7efa680
Compare
This pull request implements support for Yarn 2 usage on Heroku. This is an initial pass at support to collect information on how to best add additional features. This is a first attempt to see how Heroku users approach "no installs".
Fixes #739
Alternative solution to #797
Use case
Heroku is initially supporting repos with Yarn and dependencies checked into the repo in the
.yarn
directory. Monorepos/workspaces are supported.Steps that are different
yarn preinstall
andyarn postinstall
)