Skip to content
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

fix(deps): fix cheerio version to rc.12 #218

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

slorber
Copy link

@slorber slorber commented Aug 13, 2024

Cheerio just released v1.0.0 after 7 years of RC

https://cheerio.js.org/blog/cheerio-1.0

The only problem is that RC users used semver ranges (^) and the 1.0 is not retro-compatible with the latest RC.12, published 2 years ago

Notably:

Docusaurus users installing this plugin will now get Cheerio v1.0, and the following error:

[ERROR] Error: Unable to build website for locale en.
  ...
  [cause]: TypeError: Cannot read properties of undefined (reading 'load')
      at getDocusaurusTag (.../@cmfcmf/docusaurus-search-local/lib/server/parse.js:194:33)
      at .../@cmfcmf/docusaurus-search-local/lib/server/index.js:288:60

A temporary solution: fix the Cheerio version to rc.12 in this lib so that users never use Cheerio v1.0, until you fix the problems, or Cheerio adds back retrocompatibility.

-  "cheerio": "^1.0.0-rc.9",
+  "cheerio": "1.0.0-rc.12",

Until this PR gets merged/released, users will have to force resolution to rc.12 on their side using their package managers features.

For example, Yarn users can do:

  "resolutions": {
    "cheerio": "1.0.0-rc.12"
  },

@Alevale
Copy link

Alevale commented Aug 13, 2024

I think you need to amend your commit and push again based on this rules 😉 https://github.com/cmfcmf/docusaurus-search-local/blob/main/CONTRIBUTING.md#commit-message-guidelines probably adding fix(deps): at the start should do

@garronej
Copy link

Well summed up @slorber

nanditha938 added a commit to ELEVATE-Project/documents that referenced this pull request Aug 14, 2024
The search plugin was creating build issues because one of its dependencies (Cheerio) was upgraded and the search plugin package did not contain the necessary changes pertaining to this upgrade.

On the search plugin repo, until the PR containing changes related to Cheerio version is merged, we are adding a workaround in package.json as specified in cmfcmf/docusaurus-search-local#218

After the search plugin package is updated, the 'overrides' may not be necessary in package.json.

Also, the search plugin version is reverted to 1.2 as it is compatible with Docusaurus v2.
@rbcm1
Copy link

rbcm1 commented Aug 20, 2024

Pinning the version to the RC is a viable workaround.
Nevertheless, the real fix in order to use v1.0.0 of cheerio is also fairly easy (see: #219).

Instead of using cheerio.default.load(...), this just needs to be changed to cheerio.load(...) (so just removing the usage of "default").
According to my tests, everything works fine with this change (which BTW is also used in other parts of the docusaurus-search-local plugin).

@slorber
Copy link
Author

slorber commented Aug 20, 2024

Yes, that would also work but you'd have to also change deps to ensure all RC users upgrade to v1.0 stable

v1.0 stable only works for Node 18.17+ and Docusaurus v3 has support for 18.0. If you upgrade Cheerio to v1.0 stable, you also ask your users to potentially upgrade Node, which is a breaking change.

My suggestion is to release this PR as a minor/patch, and then upgrade Cheerio in the next major, mentioning it requires upgrading Node.

SeaOtocinclus pushed a commit to SeaOtocinclus/projectaria_tools that referenced this pull request Aug 20, 2024
Summary:
1. Update all packages to their most recent versions.
2. Add missing dependencies.
3. Add `cheerio` module's version override until a new version of `cmfcmf/docusaurus-search-local` is released. (see here cmfcmf/docusaurus-search-local#218)
4. Fix MDX pages failing to compile with docusaurus 3.5.2

Differential Revision: D61535847
facebook-github-bot pushed a commit to facebookresearch/projectaria_tools that referenced this pull request Aug 21, 2024
Summary:
Pull Request resolved: #131

1. Update all packages to their most recent versions.
2. Add missing dependencies.
3. Add `cheerio` module's version override until a new version of `cmfcmf/docusaurus-search-local` is released. (see here cmfcmf/docusaurus-search-local#218)
4. Fix MDX pages failing to compile with docusaurus 3.5.2

Reviewed By: SeaOtocinclus

Differential Revision: D61535847

fbshipit-source-id: e52aefc9a2eade45202e618235e799804b13ace9
ross-spencer added a commit to orcfax/docs that referenced this pull request Aug 27, 2024
This needs reverting once cmfcmf/docusaurus-search-local#218
is resolved.
ross-spencer added a commit to orcfax/docs that referenced this pull request Aug 27, 2024
This needs reverting once cmfcmf/docusaurus-search-local#218
is resolved.
jastice pushed a commit to build-server-protocol/build-server-protocol that referenced this pull request Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants