-
Notifications
You must be signed in to change notification settings - Fork 116
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/yarn3 #1952
Chore/yarn3 #1952
Conversation
zahnster
commented
Oct 14, 2021
- Updates project to Yarn3
- Updates dependencies and scripts to be compatible
|
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.
In your Actions you'll want to update the Get yarn cache
steps to the following to get the cache correctly:
run: echo "::set-output name=dir::$(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.
To get things working in Netlify you may need to add the following to your netlify.toml
:
[build.environment]
YARN_VERSION = "3.0.2"
YARN_FLAGS = "--immutable"
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
OK, seems like most things are starting to work. Outstanding issues include:
|
- name: Get yarn cache | ||
id: yarn-cache | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- name: Get yarn cache directory path |
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.
Newer cache syntax
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
"packages/paste-utils", | ||
"packages/paste-website" | ||
] | ||
}, |
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.
OK, so to prevent yarn thinking the fake @twilio-paste-core
packages in the core bundle are real workspaces, we need to not list them as valid workspaces. That means we have to list the valid ones explicitly. But it never considers @twilio-paste-core/x
ever again
@@ -3,6 +3,12 @@ | |||
targetPort = 3000 | |||
framework = "#auto" | |||
|
|||
[build] | |||
command = "yarn build && yarn build:theme-designer" |
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.
I was hoping this would take precedent from the admin UI, but it doesn't. Which is weird, because publish directory totally does
Haven't tried it yet, but this might be the way to cache properly on Netlify. |
✔️ Deploy Preview for paste-theme-designer ready! 🔨 Explore the source changes: 77502f2 🔍 Inspect the deploy log: https://app.netlify.com/sites/paste-theme-designer/deploys/6172edd7048e570007d3534b 😎 Browse the preview: https://deploy-preview-1952--paste-theme-designer.netlify.app |
✔️ Deploy Preview for paste-docs ready! 🔨 Explore the source changes: 77502f2 🔍 Inspect the deploy log: https://app.netlify.com/sites/paste-docs/deploys/6172edd79c0a06000867d342 😎 Browse the preview: https://deploy-preview-1952--paste-docs.netlify.app |
Size Change: +22 B (0%) Total Size: 532 kB
ℹ️ View Unchanged
|
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.
Looks good!! I just had a couple non-blocking questions.
"types": "./types/index.d.ts", | ||
"scripts": { | ||
"bootstrap": "lerna bootstrap", | ||
"bootstrap": "", |
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.
Why is this script still here if it does nothing?
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 this is annoying.
There are two ways to set Netlify build commands and settings. In the Netlify admin UI and in the netlify.toml
file.
In all but one case, the toml
file will take precedent over the Netlify UI settings. All but the build
command.
The build command in the Netlify UI includes running yarn bootstrap
, which is required for all sites still using the v1 of yarn, but breaks builds using yarn v3.
So to not block everyone from working whilst we did this, but have working builds in this branch, we make sure yarn bootstrap
doesn't actually call lerna by blanking out the script in the branch.
Once merged, we'll remove the Netlify UI setting and only use the config files moving forward to prevent this from happening agains.
"eslint-plugin-react": "^7.20.0", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"eslint-plugin-unicorn": "^23.0.0", | ||
"eslint": "7.23.0", |
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.
Why did the ^ get removed for all these packages?
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.
So because we upgrade the lockfile to a completely different format you are effectively doing a completely fresh, unlocked dependency install as if the lockfile doesn't exist. The ^
tells yarn to install the latest version that satisfies the dependency range, but in this case that is a minor dependency bump, the latest v7 of eslint for example.
In those minor bumps some rules have changes for eslint plugins and we get alot of errors. The scope is upgrade yarn, not upgrade eslint, all it's rules and our code to match it.
So we pinned it to keep that scope.
@@ -30,6 +30,7 @@ | |||
"@twilio-paste/button": "^7.0.0", | |||
"@twilio-paste/design-tokens": "^6.6.0", | |||
"@twilio-paste/flex": "^2.0.2", | |||
"@twilio-paste/form": "^6.0.2", |
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.
Unrelated question, but why are all the packages listed as both a peer dependency and a dev dependency?
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.
Good question. It's related to local compilation of packages. I'm sure there is a very good long technical answer, but essentially because the peer dependencies are actually local to the package, if they aren't listed as a dev dependency they are compiled into the package, because the system kind of can't find them. https://github.com/twilio-labs/paste#dependencies
Because they are local, they are symlinked from the root. They are technically dev dependencies to the package when we work and compile, but peer dependencies when they are installed on someone elses computer.
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.
🥳
2bcf7ae
to
77502f2
Compare