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

Strict check for plugin version mismatch #9342

Closed
1 of 2 tasks
chris48s opened this issue Sep 24, 2023 · 6 comments · Fixed by #9381
Closed
1 of 2 tasks

Strict check for plugin version mismatch #9342

chris48s opened this issue Sep 24, 2023 · 6 comments · Fixed by #9381
Labels
apprentice Issues that are good candidates to be handled by a Docusaurus apprentice / trainee feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Milestone

Comments

@chris48s
Copy link

Have you read the Contributing Guidelines on issues?

Description

In https://github.com/facebook/docusaurus/blob/v2.4.3/packages/docusaurus/src/server/siteMetadata.ts#L75-L92 there is a check which logs an error if @Docusaurus plugins are out of sync with @docusaurus/core

This logs a message, but it is not a hard error.

I would like the ability to run something like

  • docusaurus check or
  • docusaurus build --strict

which throws an exception or otherwise exits with a non-zero exit code if the plugin versions are mis-matched with core.

Has this been requested on Canny?

No response

Motivation

This would be useful as a CI check to help users correctly upgrade docusaurus packages using automated tools like dependabot.

API design

I've suggested

  • docusaurus check or
  • docusaurus build --strict

but open to other ideas.. --strict-plugins?

Have you tried building it?

I have not tried building this as a plugin. At the moment, my proposed workaround for this on a repo where we are using docusaurus is https://github.com/badges/shields/pull/9608/files but parsing the output like this will be brittle.

Maybe this could be a plugin, but it feels like something that conceptually lives in core. The comment in https://github.com/facebook/docusaurus/blob/v2.4.3/packages/docusaurus/src/server/siteMetadata.ts#L75-L92 suggests this would be reasonable.

Self-service

  • I'd be willing to contribute this feature to Docusaurus myself.
@chris48s chris48s added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Sep 24, 2023
@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Sep 25, 2023
@slorber slorber added this to the 3.0 milestone Sep 25, 2023
@slorber
Copy link
Collaborator

slorber commented Sep 25, 2023

Thanks for reporting

I think instead we should throw by default in Docusaurus v3.

@slorber slorber added the apprentice Issues that are good candidates to be handled by a Docusaurus apprentice / trainee label Sep 25, 2023
@JorensM
Copy link
Contributor

JorensM commented Oct 6, 2023

@slorber May I work on this issue?

@slorber
Copy link
Collaborator

slorber commented Oct 6, 2023

If we get a PR before monday yes

@JorensM
Copy link
Contributor

JorensM commented Oct 6, 2023

@slorber Ok, I can do that.

@shubhankar-mern
Copy link

@slorber @chris48s if i get it correctly you want to add some function named docusaurus check/build in checkDocusaurusPackagesVersion and if the versions mismatch it should run(This function throws an exception or otherwise exits with a non-zero exit code if the plugin versions are mis-matched with core.) Its currently logging the error.

@JorensM
Copy link
Contributor

JorensM commented Oct 7, 2023

@slorber So can I start working on it? Or should I get assigned first?

@shubhankar-mern I believe what they want to do it throw an error if there is a version mismatch, as opposed to just logging the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apprentice Issues that are good candidates to be handled by a Docusaurus apprentice / trainee feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
5 participants
@slorber @chris48s @JorensM @shubhankar-mern and others