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

add versioned documentation to the website #5541

Merged
merged 5 commits into from
Feb 21, 2018

Conversation

ronami
Copy link
Contributor

@ronami ronami commented Feb 13, 2018

Summary

Hi 👋

This PR adds versioned documentation to the website using Docusaurus' built-in support for it (https://docusaurus.io/docs/en/versioning.html). Current docs on the website are master only which may cause confusion about what's available at that time (see #5190).

I adjusted pages/en/versions.js to have correct links to latest/master/past versions along with brief descriptions for each of them.

I also added a link to the release notes of the latest version pointing to CHANGELOG.md, and a link to the source code for the latest (master) version. I looked at a few other projects that use this feature and how they customized that page, e.g. https://facebook.github.io/relay/en/versions.html.

Notes

  • When a new version is published we should also run yarn run version x.x.x inside the website's folder to generate docs for that version. I couldn't figure out if this is automated or manual. Should I document it somewhere? Possibly add it to a publish script?
  • I created documentation for the latest version (v22.2.2), do we plan on going back to past versions and creating docs for them?
  • Normally the website will show docs for the latest stable version. Docs for master or earlier versions can be accessed from the versions page.
  • This is a fairly large PR (in terms of lines of code) but only files in the docs folder and sidebar files that differ from those of the latest version will get copied each time a new version is specified (see https://docusaurus.io/docs/en/versioning.html#fallback-functionality).

Test plan

No changes at all

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Nice, thanks for doing this! Can you post some screenshots too?

With all the versioning I'm afraid we're sooner or later need to move website to its own repo, as it will grow fast

<header className="postHeader">
<h2>{siteConfig.title + ' Versions'}</h2>
</header>
<a name="latest" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Anchors should have a href attribute, you can use a button instead. Please fix this in other places too,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That page was auto-generated by Docusaurus and I think it's intended. I think it should act as an in-page anchor so one can link to that part of the page directly, like this: https://facebook.github.io/relay/en/versions.html#latest.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, this is so wrong. The name attr on anchors is obsolete. They should just use ids. Mind filing an issue or PR fixing that? There's no need to create artificial pseudo anchor too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opened a PR for that as it's pretty straightforward (here). I also updated this PR by removing the redundant anchor tags and using ids instead.

@@ -0,0 +1,328 @@
---
id: version-22.2.2-cli
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use just major and minor versions for docs? I'd rather have docs for "Jest 22.2". Patches are for fixes

Copy link
Contributor Author

@ronami ronami Feb 13, 2018

Choose a reason for hiding this comment

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

Definitely 👍

The version is showing at the top right corner (and the versions page). I think it may be a bit confusing to use semver with only two numbers (e.g. 22.2). What do you think about naming versions like this: 22.2.x or possibly 22.2.0?

Please let me know and I'll push a fix.

Copy link
Member

Choose a reason for hiding this comment

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

22.2.X seems reasonable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can see on React Native's website (https://facebook.github.io/react-native/versions.html) that they use just major and minor versions (0.53), skipping the patch version (like @thymikee suggested).

Looking at it again I think it looks better without the X, what do you guys think?

@ronami
Copy link
Contributor Author

ronami commented Feb 13, 2018

@thymikee thanks for the review 🙂

Here's a screenshot of how the new versions page looks, it can be accessed by clicking on the version next to the Jest logo (top left corner). Other than that and the version at the top it looks exactly the same.

screen shot 2018-02-13 at 10 40 48

I agree that separating the documentation to its own repo should probably happen sooner or later.

We can also consider only having a small number of documented versions of Jest on the website, similar to Relay (https://facebook.github.io/relay/en/versions.html). They have docs only for master/latest/classic.

Other projects (like https://github.com/facebook/react-native-website) already have their docs in its own repo.

@codecov-io
Copy link

codecov-io commented Feb 13, 2018

Codecov Report

Merging #5541 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5541   +/-   ##
=======================================
  Coverage   60.63%   60.63%           
=======================================
  Files         213      213           
  Lines        7313     7313           
  Branches        3        4    +1     
=======================================
  Hits         4434     4434           
  Misses       2878     2878           
  Partials        1        1

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 430aebe...6bd9618. Read the comment docs.

@SimenB
Copy link
Member

SimenB commented Feb 17, 2018

@thymikee is this GTG?

@thymikee
Copy link
Collaborator

Looks good. Next step would be to automate it while cutting a release

@cpojer
Copy link
Member

cpojer commented Feb 17, 2018

Is there any way we can choose not to have a full copy of all docs on the main branch of Jest? Like, is there any way to keep it only in gh-pages or a docs branch?

@thymikee
Copy link
Collaborator

Is there any way we can choose not to have a full copy of all docs on the main branch of Jest? Like, is there any way to keep it only in gh-pages or a docs branch?

@ericnakagawa can you shed some light on that?

@cpojer
Copy link
Member

cpojer commented Feb 20, 2018

I'll merge it an hope it will make people happy. Thanks so much for working on this! As said, ideally we can move all the copies of old versions in a different branch.

@cpojer cpojer closed this Feb 20, 2018
@SimenB
Copy link
Member

SimenB commented Feb 21, 2018

@cpojer closed instead of merged?

@SimenB SimenB reopened this Feb 21, 2018
@cpojer cpojer merged commit 6ab04b7 into jestjs:master Feb 21, 2018
@cpojer
Copy link
Member

cpojer commented Feb 21, 2018

Oh yeah, oops!

@ronami ronami deleted the add-versioned-documentation branch February 21, 2018 08:48
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants