Skip to content

Remove most pnpm hoisting, fix phantom deps #24096

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

Merged
merged 3 commits into from
Apr 27, 2022
Merged

Conversation

anomiex
Copy link
Contributor

@anomiex anomiex commented Apr 26, 2022

Changes proposed in this Pull Request:

We've long had pnpm's public hoisting disabled, but it also privately
hoists everything into node_modules/.pnpm/node_modules/ for
compatibility with packages that have undeclared dependencies. Let's
disable most of that private hoisting and see what turns up.

Changes of note:

  • We still hoist a bunch of eslint plugins (and one prettier plugin) as
    untangling that mess seems like enough work to put off for later.
  • Only a few upstream packages have bugs that need working around:
  • fetch-mock's peer dep on node-fetch is optional, but only because
    they also allow running in-browser. It's required for node.
  • Added webpack-cli alongside webpack everywhere to make sure
    p1650571211251179-slack-CBG1CP4EN is fixed. Dropped Webpack entirely
    from Boost instead though, they don't use it.
  • Had our webpack-config package point to its own copy of
    @babel/runtime instead of making that a peer dep.
  • Jetpack's extensions tests use a ton of @wordpress/ packages that
    weren't being directly depended on.

Jetpack product discussion

None

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Everything should continue working as it did before.

We've long had pnpm's public hoisting disabled, but it also privately
hoists everything into `node_modules/.pnpm/node_modules/` for
compatibility with packages that have undeclared dependencies. Let's
disable most of that private hoisting and see what turns up.

Changes of note:

* We still hoist a bunch of eslint plugins (and one prettier plugin) as
  untangling that mess seems like enough work to put off for later.
* Only a few upstream packages have bugs that need working around:
  * `@mdx-js/loader`: mdx-js/mdx#2019
  * `@automattic/components`: Missing dep on `@wordpress/base-styles`.
	And the next version will probably be unusable for us due to added
	`i18n-calypso`.
  * `@automattic/popup-monitor`: Missing dep on `events`.
  * markdown-it`: Missing dep on `punycode`.
    markdown-it/markdown-it#230
  * `@samverschueren/stream-to-observable`: Outdated dep on `any-observable`.
    SamVerschueren/stream-to-observable#9
    Hacking around that should also fix p1649254510834369-slack-CBG1CP4EN.
* `fetch-mock`'s peer dep on `node-fetch` is optional, but only because
  they also allow running in-browser. It's required for node.
* Added `webpack-cli` alongside `webpack` everywhere to make sure
  p1650571211251179-slack-CBG1CP4EN is fixed. Dropped Webpack entirely
  from Boost instead though, they don't use it.
* Had our webpack-config package point to its own copy of
  `@babel/runtime` instead of making that a peer dep.
* Jetpack's extensions tests use a ton of `@wordpress/` packages that
  weren't being directly depended on.
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello anomiex! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D79551-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@github-actions github-actions bot added [JS Package] API [JS Package] Connection [JS Package] Components [JS Package] I18n Loader Webpack Plugin [JS Package] I18n Check Webpack Plugin [JS Package] Remove Asset Webpack Plugin [JS Package] Storybook [JS Package] Webpack Config [Package] Ad aka WordAds [Package] Assets [Package] Identity Crisis This package no longer exists in the monorepo. It was merged into [Package] Connection. [Package] Lazy Images This package no longer exists in the monorepo. [Package] My Jetpack [Package] Search Contains core Search functionality for Jetpack and Search plugins [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ RNA labels Apr 26, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 26, 2022

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: May 3, 2022.
  • Scheduled code freeze: April 25, 2022.

Boost plugin:

  • Next scheduled release: May 3, 2022.
  • Scheduled code freeze: April 25, 2022.

@anomiex anomiex added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Apr 26, 2022
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests well for me, let's give it a try.

@jeherve jeherve added this to the jetpack/11.0 milestone Apr 27, 2022
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Apr 27, 2022
@anomiex anomiex merged commit ef3305b into master Apr 27, 2022
@anomiex anomiex deleted the remove/most-pnpm-hoisting branch April 27, 2022 15:16
@anomiex
Copy link
Contributor Author

anomiex commented Apr 27, 2022

r244512-wpcom

@github-actions
Copy link
Contributor

Great news! One last step: head over to your WordPress.com diff, D79551-code, and deploy it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Apr 27, 2022
samiff pushed a commit that referenced this pull request Apr 27, 2022
We've long had pnpm's public hoisting disabled, but it also privately
hoists everything into `node_modules/.pnpm/node_modules/` for
compatibility with packages that have undeclared dependencies. Let's
disable most of that private hoisting and see what turns up.

Changes of note:

* We still hoist a bunch of eslint plugins (and one prettier plugin) as
  untangling that mess seems like enough work to put off for later.
* Only a few upstream packages have bugs that need working around:
  * `@mdx-js/loader`: mdx-js/mdx#2019
  * `@automattic/components`: Missing dep on `@wordpress/base-styles`.
	And the next version will probably be unusable for us due to added
	`i18n-calypso`.
  * `@automattic/popup-monitor`: Missing dep on `events`.
  * markdown-it`: Missing dep on `punycode`.
    markdown-it/markdown-it#230
  * `@samverschueren/stream-to-observable`: Outdated dep on `any-observable`.
    SamVerschueren/stream-to-observable#9
    Hacking around that should also fix p1649254510834369-slack-CBG1CP4EN.
  * `git-node-fs`: Missing peer dep on `js-git`.
    creationix/git-node-fs#8
* `fetch-mock`'s peer dep on `node-fetch` is optional, but only because
  they also allow running in-browser. It's required for node.
* Added `webpack-cli` alongside `webpack` everywhere to make sure
  p1650571211251179-slack-CBG1CP4EN is fixed. Dropped Webpack entirely
  from Boost instead though, they don't use it.
* Had our webpack-config package point to its own copy of
  `@babel/runtime` instead of making that a peer dep.
* Jetpack's extensions tests use a ton of `@wordpress/` packages that
  weren't being directly depended on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[JS Package] API [JS Package] Components [JS Package] Connection [JS Package] I18n Check Webpack Plugin [JS Package] I18n Loader Webpack Plugin [JS Package] Remove Asset Webpack Plugin [JS Package] Storybook [JS Package] Webpack Config [Package] Ad aka WordAds [Package] Assets [Package] Identity Crisis This package no longer exists in the monorepo. It was merged into [Package] Connection. [Package] Lazy Images This package no longer exists in the monorepo. [Package] My Jetpack [Package] Search Contains core Search functionality for Jetpack and Search plugins [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal RNA Touches WP.com Files [Type] Janitorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants