-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add peer deps for postcss and e2e tests #39080
Conversation
packages/e2e-tests/package.json
Outdated
@@ -37,6 +37,11 @@ | |||
"puppeteer-testing-library": "^0.5.0", | |||
"uuid": "^8.3.0" | |||
}, | |||
"optionalDependencies": { |
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.
Should these be peer or optional? I wasn't sure what to do, as I know puppeteer
could be a very big thing to have to bring in. (At the same time, for the e2e-tests package, it kind of makes sense to need it.)
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.
Actually, I just moved these to peers. Let me know what you think
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.
We have been doing all we can to avoid having puppeteer
in the node_modules
because it downloads Chromium as part of the post-install process. puppeteer-core
is more difficult to configure and integrate, but it lets us defer that painful moment until someone runs e2e tests for the first time:
gutenberg/packages/scripts/scripts/test-e2e.js
Lines 31 to 33 in ebb4a8a
const result = spawn( 'node', [ require.resolve( 'puppeteer-core/install' ) ], { | |
stdio: 'inherit', | |
} ); |
In the past, we would alias puppeteer
with puppeteer-core
but it wasn't reliable with npm 6 so changed the strategy. Do you know which package declares puppeteer
as a peer 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.
Great thought, I was worried about that. Do you think optionalDependencies
would solve that problem??
Here is the explainer:
$ yarn explain peer-requirements pea0fd
➤ YN0000: @wordpress/e2e-tests@portal:../gutenberg/packages/e2e-tests. [62522] doesn't provide puppeteer, breaking the following requirements:
➤ YN0000: puppeteer-testing-library@npm:0.5.0 [f94aa] → * ✘
It looks like puppeteer-testing-library
has a peer dep requesting puppeteer:
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.
Great thought, I was worried about that. Do you think
optionalDependencies
would solve that problem??
I have never tried using optionalDependencies
because it seems like it still installs dependencies according to https://docs.npmjs.com/cli/v8/configuring-npm/package-json#optionaldependencies. The difference seems to be that it doesn't fail the whole installation process when it is unable to satisfy this dependency for any reason.
It looks like
puppeteer-testing-library
has a peer dep requesting puppeteer:
This library is maintained by @kevin940726 so let's see what he thinks.
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 think we should list them as peerDependencies
, but also mark them as optional using peerDependenciesMeta
.
We'll deprecate puppeteer-testing-library
once we migrate to Playwright, I'd recommend ignoring the warning for now if it's possible, or I can quickly publish a patch to fix that.
Size Change: 0 B Total Size: 1.22 MB ℹ️ View Unchanged
|
Thank you for another patch for better peer dependencies handling 👍🏻 I left a note about |
60180cf
to
2bd943a
Compare
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, thank you 👍
I also added peer deps to the preferences package. (Side note, I'm unsure about the package-lock changes! Hopefully CI works with them.) |
Description
I found a few more peer dependency warnings while testing in https://github.com/noahtallen/test-yarn-gutenberg/. I think this should be the final update needed to get all peer dependencies resolved among WordPress dependencies. The remaining errors are related to 3rd party packages, from what I can tell.
Specifically:
postcss
to one of the postcss plugins.Testing Instructions
CI
Screenshots
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).