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

feat: docusaurus upgrade cli command #4082

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

semoal
Copy link
Contributor

@semoal semoal commented Jan 20, 2021

Motivation

Introduce the feature requested here: #4075

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan & Pending things

  • Introduce this command to documentation
  • Add testing

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 20, 2021
@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify
Copy link

netlify bot commented Jan 20, 2021

✔️ Deploy preview for docusaurus-2 ready!
Built without sensitive environment variables

🔨 Explore the source changes: 485c68d

🔍 Inspect the deploy logs: https://app.netlify.com/sites/docusaurus-2/deploys/60088bfd300ec90008905dac

😎 Browse the preview: https://deploy-preview-4082--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Jan 20, 2021

Size Change: -2 B (0%)

Total Size: 27.1 kB

ℹ️ View Unchanged
Filename Size Change
website/build/blog/2017/12/14/introducing-docusaurus/index.html 20.9 kB -2 B (0%)
website/build/docs/introduction/index.html 180 B 0 B
website/build/index.html 6.02 kB 0 B

compressed-size-action

@github-actions
Copy link

github-actions bot commented Jan 20, 2021

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟠 56 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🟠 51 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 74 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 64 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 48 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 65 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 75 🟢 100 🟢 100 🟠 86 Report

@netlify
Copy link

netlify bot commented Jan 20, 2021

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 234e289
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/624fe01b402f890008e8260a
😎 Deploy Preview https://deploy-preview-4082--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@slorber slorber added the better engineering Not a bug or feature request label Jan 21, 2021
@slorber
Copy link
Collaborator

slorber commented Jan 21, 2021

Thanks @semoal that looks like a good start. I don't have time to test it right now and will be a bit busy but will get back to you when I can.

Was wondering if you could do some upfront research on how other CLIs are implementing this kind of feature, as this is quite common. Was wondering if the common approach is to actually run yarn upgrade x y z rather than something else, as there are potentially many possible solutions here.

In the end I'd like the version to be upgraded in both the lockfile/node_modules but also the package.json, is it the case currently?

Also, maybe we should default to the @latest tag, not sure it is picked by default for NPM users due to using alpha (not sure it's a problem though).

@slorber slorber linked an issue Jan 21, 2021 that may be closed by this pull request
@Josh-Cena Josh-Cena added pr: new feature This PR adds a new API or behavior. and removed better engineering Not a bug or feature request labels Nov 7, 2021
@Josh-Cena Josh-Cena self-requested a review as a code owner November 15, 2021 13:55
@@ -10,6 +10,7 @@
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"upgrade": "docusaurus upgrade",
Copy link
Collaborator

Choose a reason for hiding this comment

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

need to add this to init templates as well

@slorber
Copy link
Collaborator

slorber commented Nov 16, 2021

Looks nice, will run it tomorrow

Maybe you could:

  • add new command to init templates
  • add doc
  • extract some method like getPackageName with a test (the rest is IO intensive so it would be hard to test)

Edit: oh, this PR is quite old 😅

@Josh-Cena
Copy link
Collaborator

I think this command should be a separate package instead of in the core. Reason: we may want to make it display the changelog / highlights of the latest version, and auto-fix some breaking changes / recommended changes. If the project's version is 2.0.0-beta.8, we would want docusaurus upgrade to display the changelog for 2.0.0-beta.9, which is only achievable if it's fetched from NPM on-site, like create-docusaurus. We would update the changelog and breaking change fix rules as a Babel transformation before every release.

@slorber
Copy link
Collaborator

slorber commented Dec 1, 2021

Agree, we should be able to use npx docusaurus-upgrade@latest and run fresh migration code even if you are on an older version.

We may provide more than just upgrading deps in the future

@slorber slorber added the apprentice Issues that are good candidates to be handled by a Docusaurus apprentice / trainee label Sep 25, 2023
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 CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docusaurus upgrade CLI command
5 participants