-
Notifications
You must be signed in to change notification settings - Fork 393
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: migrate from yarn to pnpm #4897
base: master
Are you sure you want to change the base?
Conversation
``` | ||
yarn local | ||
pnpm local |
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.
Currently running into this issue: webdriverio/webdriverio#13787
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.
Currently worked around it by adding tsx as devDependency in `@lwc/integration-tests".
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 is looking good so far. I'm surprised so many changed are needed for pnpm, but I do like the workspace:*
thing.
One thing missing: this code to build the benchmarks will need to run yarn or pnpm:
lwc/packages/@lwc/perf-benchmarks/scripts/build.js
Lines 117 to 120 in 4df361b
'yarn --immutable', | |
// bust the Tachometer cache in case these files change locally | |
`echo '${directoryHash}'`, | |
'yarn build:performance:components', |
The reason is that it is going to compare the current master
against an arbitrary commit from the past. Since that arbitrary commit might be using yarn, I'd suggest checking if [ -f yarn.lock ]
inline.
@nolanlawson thank you for looking into this! I'll see what I can do about the benchmark scripts. I left them for last since it takes a while to fully run. The changes in src are mostly due to the non-flat structure of node_modules, which actually helps figure out some "phantom" and cyclic dependencies since they break |
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.
Thank you for looking into this! I plan to give this a deeper look, but this week is crunch week so we're a bit time-strapped. 🙇
For the perf benchmark tests, don't worry about running all of them. If you'd like you can also set BENCHMARK_SAMPLE_SIZE=1 BENCHMARK_TIMEOUT=0
and it should run pretty fast.
It seems changes are needed at least in these two scripts as well: lwc/packages/@lwc/perf-benchmarks/scripts/build.js Lines 75 to 77 in f602082
lwc/packages/@lwc/perf-benchmarks/scripts/fix-deps.sh Lines 8 to 21 in f602082
Currently observing these errors in the console:
|
I think this means that Rollup is bundling incorrectly and we're ending up with two copies of |
/nucleus test |
/nucleus test |
async function findLicenseText(depName) { | ||
// Iterate through possible names for the license file | ||
const names = ['LICENSE', 'LICENSE.md', 'LICENSE.txt']; | ||
|
||
// We would use require.resolve, but 1) that doesn't work if the module lacks a "main" in its `package.json`, | ||
// and 2) it gives us a deep `./path/to/index.js` which makes it harder to find a top-level LICENSE file. So | ||
// just assume that our deps are hoisted to the top-level `node_modules`. | ||
const resolvedDepPath = path.join(process.cwd(), 'node_modules', depName); | ||
const resolvedDepPath = list.find((dep) => dep.name === depName).paths[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 does generate-license-files.js
need to be updated?
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.
The dependencies are not hoisted to the top-level anymore. Transitive dependencies like entities
from '@parse5/tools` are also not hoisted to the package which depends on it. This is the only reasonable way to accomplish this.
Refs:
/nucleus test |
OK yeah it looks like our
This has always been a nasty hacky, and now it's coming back to bite us. I may need to get clever here. |
I mean, at this point I would be happy to switch to |
@nolanlawson we could always use shamefully-hoist and avoid most changes here. The reason I didn't use it from the get-go was to try and get the full benefits of pnpm (especially avoiding the phantom dependencies). Thanks for helping with the PR. I'll see if I can fix the issue with the benchmarks. |
Details
I'm still going through all scripts and haven't touched CI yet, but this is mostly working.
I don't know what external workflows might depend on things like the versions being spelled out in
package.json
and could break by using workspace:* and others. I initially made it work without that feature, so I can revert back to spelled out versions if needed.Since pnpm doesn’t hoist dependencies to the root by default, it uncovers several issues similar to
@lwc/shared
dep #4415I’m submitting fixes for those separately to make sure they are correct.
I recommend cloning in a separate folder or running
git clean -dfX
before trying this out.pnpm version used:
9.14.2
.Closes #4426
Top-level package.json scripts I tested so far:
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item