docusaurus
docusaurus copied to clipboard
feat: docusaurus upgrade cli command
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
:x: [V1] Deploy preview failure Built without sensitive environment variables
:hammer: Explore the source changes: 485c68d996faf207c6dec9709a23de2a6be39678
:mag: Inspect the deploy logs: https://app.netlify.com/sites/docusaurus-1/deploys/60088bfdd622aa00087a6707
:x: [V1] Deploy preview failure Built without sensitive environment variables
:hammer: Explore the source changes: d98f00a62282f29c4dc196b9056c98e3cd49839b
:mag: Inspect the deploy logs: https://app.netlify.com/sites/docusaurus-1/deploys/60088c6ce97ad00007fd0b6f
:heavy_check_mark: Deploy preview for docusaurus-2 ready! Built without sensitive environment variables
:hammer: Explore the source changes: 485c68d996faf207c6dec9709a23de2a6be39678
:mag: Inspect the deploy logs: https://app.netlify.com/sites/docusaurus-2/deploys/60088bfd300ec90008905dac
:sunglasses: Browse the preview: https://deploy-preview-4082--docusaurus-2.netlify.app
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 |
⚡️ 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 |
[V2]
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 234e289f1080f5885aacdd94109ef476ebdd7579 |
| 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...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
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).
Looks nice, will run it tomorrow
Maybe you could:
- add new command to init templates
- add doc
- extract some method like
getPackageNamewith a test (the rest is IO intensive so it would be hard to test)
Edit: oh, this PR is quite old 😅
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.
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