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

Proposal: prevent @docusaurus package version mismatches #3371

Closed
slorber opened this issue Aug 31, 2020 · 3 comments
Closed

Proposal: prevent @docusaurus package version mismatches #3371

slorber opened this issue Aug 31, 2020 · 3 comments
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. help wanted Asking for outside help and/or contributions to this particular issue or PR. proposal This issue is a proposal, usually non-trivial change

Comments

@slorber
Copy link
Collaborator

slorber commented Aug 31, 2020

💥 Proposal

As seen here: #3363

If you have some @docusaurus/* packages on alpha 61, and some on alpha 62, the site might not work correctly.

Sometimes users try to upgrade but one dep is left to an older version, and we have cryptic error messages at dev/build time.

We should prevent running a Docusaurus site if the @Docusaurus packages do not have the exact same version, with a proper error message.

Note: dependabot and other deps upgrade bots will submit PRs to repos asking you to upgrade doccusaurus packages one at a time, so all these PRs should fai on purpose. We should upgrade Docusaurus deps all at once, in a single PR.

@slorber slorber added proposal This issue is a proposal, usually non-trivial change status: needs triage This issue has not been triaged by maintainers difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. help wanted Asking for outside help and/or contributions to this particular issue or PR. and removed status: needs triage This issue has not been triaged by maintainers labels Aug 31, 2020
@TomBrien
Copy link
Contributor

Note: dependabot and other deps upgrade bots will submit PRs to repos asking you to upgrade doccusaurus packages one at a time, so all these PRs should fai on purpose. We should upgrade Docusaurus deps all at once, in a single PR.

I believe (although not tested) a solution to this is packages outside of @docusaurus/core makings sure the peerDependency is pinned to a particular version. This should ensure dependabot and friends realise the two packages need updating in one PR rather than allowing them to update independently. E.g. for preset-core-classic:

  "peerDependencies": {
-   "@docusaurus/core": "^2.0.0",
+   "@docusaurus/core": "2.0.0-alpha62",
    "react": "^16.8.4",
    "react-dom": "^16.8.4"
  },

@slorber
Copy link
Collaborator Author

slorber commented Aug 31, 2020

Yes, we should do that for all ^2.0.0 refs.

The problem is also that Lerna publish does seem to add back the ^ on every publish, so even if we prevent users from using an older deps, we should also ensure that they don't get a newer version that mismatch with the others (ie all at alpha 62 except one at alpha 63)

I think a runtime check would be more reliable.

We had this idea of "docusaurus doctor", that can also be part of it (#2267), but if it's not too expensive I think it could run on each start/build

@slorber
Copy link
Collaborator Author

slorber commented Sep 2, 2020

Should be fixed by #3386

slorber added a commit that referenced this issue Sep 2, 2020
* Attempt to pin all dependency versions exactly for #3371

* warn if @Docusaurus package versions mismatch

* fix yarn lock
@slorber slorber closed this as completed Sep 2, 2020
jasonbosco pushed a commit to typesense/docusaurus-theme-search-typesense that referenced this issue Aug 18, 2021
* Attempt to pin all dependency versions exactly for facebook/docusaurus#3371

* warn if @Docusaurus package versions mismatch

* fix yarn lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. help wanted Asking for outside help and/or contributions to this particular issue or PR. proposal This issue is a proposal, usually non-trivial change
Projects
None yet
Development

No branches or pull requests

2 participants