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

Migrate React Native website to Docusaurus V2 #2263

Merged
merged 117 commits into from Oct 29, 2020

Conversation

Simek
Copy link
Collaborator

@Simek Simek commented Oct 20, 2020

This PR migrates the React Native website to Docusaurus V2.

This is an effect of collaboration with @slorber and MLH Docusaurus team (@darshkpatel & @teikjun).

It is the initial import, rebased against current master in the main repository.

Refs: #2146, #2139

Fixes #2208, Fixes #2054

Preview

Noticeable changes for website user

  • SPA - reduced page load times, more fluid navigation
  • additional dark theme and theme toggle (dark theme Snacks too)
  • build in tabs sync
  • Snacks appears on mobile without the preview but with link to open example in Expo app
  • blog posts are now searchable
  • code blocks content can be copied by click - "Copy" button appears on hover
  • old versions and next page have a notice for users that they are reading old or upcoming version of the page

Noticeable changes for contributors/maintainers

  • announcement bar support out of the box
  • MDX fragments - which allows to split content and helps to maintain large pages (example: Environment Setup)
  • extended page customizability and theme components swizzling
  • improved build times
  • still growing set of ready to use plugins - https://v2.docusaurus.io/docs/using-plugins/
  • <!--truncate--> tag for blog posts to hide the details on the post list, blog posts tags

You can read more about V2 features and changes in the official documentation:

darshkpatel and others added 30 commits October 20, 2020 19:53
…mp (#12)

* fix local build, basic theme overrides, header reorder, docusaurus bump

* add navbar override group, update navbar typography

* tweak version switcher and hr design

* update page links style, fix text color issues

* use docsVersionDropdown in navbar

* fix validation warning

* footer design tweaks, jsx as default prism language

* add native code banner, fix version label design, update notes style

* static dark navbar, color fix, docusaurus bump

* tweak dark theme, fix page shrinking issue

* navbar UI and positioning tweaks, update blog page

* sidebar spacing, minor color tweaks
* add additional languages for prism

* set up custom theme for prism

* customize according to solarized dark theme

* add custom syntax highlighting from react-native

* rename theme file, add Kotlin, fix one ObjC block

Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>
* add line highlighting with the correct syntax

* use css to display line highlighting

* move css for line highlighting into page overrides section
@Simek
Copy link
Collaborator Author

Simek commented Oct 27, 2020

The archive branch website deploy has been set up and RN Archive is available under https://archive.reactnative.dev/ URL.

In theory, having V1 archive up and running makes this PR ready to review and merge 🙂

@cpojer
Copy link
Contributor

cpojer commented Oct 28, 2020

What are the next steps for this PR? Can you make a checklist in the summary of this PR? Let me know when you need me for final review.

@Simek
Copy link
Collaborator Author

Simek commented Oct 28, 2020

What are the next steps for this PR? Can you make a checklist in the summary of this PR? Let me know when you need me for final review.

@cpojer I have posted all the steps within the migration plan last week. Since V1 Archive is deployed this PR should be ready to merge. The commits that appears in this PR lately are just a small tweaks which should not affect the functionality and break the deployment in any way.

Currently we are only not sure if V2 deploy will work from master (after the merge) but there was no way to check this earlier, we are ready to hot fix issues on merge.

When the V2 deploy will be finished we need to ask Algolia to update the search index and recrawl the website. There are also several minor checks that need to be done after the deployment, for example: if the Google Analytics events are tracked correctly, but all major checks or task are done.

@cpojer
Copy link
Contributor

cpojer commented Oct 28, 2020

Thanks for clarifying. I will review it tomorrow and merge it then.

Copy link
Contributor

@cpojer cpojer left a comment

Choose a reason for hiding this comment

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

Amazing, what a huge amount of work. Thank you so much for making this happen.

@cpojer cpojer merged commit e622c6a into facebook:master Oct 29, 2020
@Simek Simek mentioned this pull request Oct 29, 2020
@sunnylqm
Copy link
Contributor

sunnylqm commented Nov 5, 2020

@Simek I found some docs are reverted to an older version like this one e622c6a#diff-941914e9c6da4d386c78dcde541e7cc9be34624e543dfccbad380409d8e81813L152-L162

@Simek
Copy link
Collaborator Author

Simek commented Nov 5, 2020

Hi @sunnylqm, it is not clear what changes are exactly missing, remember that the tabs code has changed so the diff might be misleading.

Please check the page file in the master docs and let me know if problem occurs in there - https://github.com/facebook/react-native-website/blob/master/docs/building-for-tv.md.

In a meanwhile I will compare master with archive branch and try to find the issue.

@sunnylqm
Copy link
Contributor

sunnylqm commented Nov 5, 2020

@Simek That doc in master is incorrect (older) after the migration commit as I showed above

@Simek
Copy link
Collaborator Author

Simek commented Nov 5, 2020

@sunnylqm Can you show me somehow where exactly is the issue which you are referring? Can you quote the missing paragraph or sentence on the new site?

At the first glance content on https://reactnative.dev/docs/building-for-tv and https://archive.reactnative.dev/docs/building-for-tv pages looks the same.

@sunnylqm
Copy link
Contributor

sunnylqm commented Nov 5, 2020

I think maybe it's because the master version did not build into versioned doc. For the content, it's obvious TabBarIOS and ListView are deprecated long time ago.

So if you take the doc from versioned folder, there might be more inconsistence (not all doc changes go into version folder right away)

@Simek
Copy link
Collaborator Author

Simek commented Nov 5, 2020

I think maybe it's because the master version did not build into versioned doc. For the content, it's obvious TabBarIOS and ListView are deprecated long time ago.

So if you take the doc from versioned folder, there might be more inconsistence (not all doc changes go into version folder immediately)

@sunnylqm Sorry, but I don't understand you.

My last idea is that you are looking for additional known issues on Android TV which were only applied to the next docs before the migration, so they are only visible in the next docs: https://reactnative.dev/docs/next/building-for-tv

@sunnylqm
Copy link
Contributor

sunnylqm commented Nov 5, 2020

@Simek See this commit 6677d7a#diff-941914e9c6da4d386c78dcde541e7cc9be34624e543dfccbad380409d8e81813
It's reverted, isn't it?

@sunnylqm
Copy link
Contributor

sunnylqm commented Nov 5, 2020

If you take the doc from versioned folder and copied them back to master, some changes that haven't build will get lost. Do I make myself clear?

@Simek
Copy link
Collaborator Author

Simek commented Nov 5, 2020

@sunnylqm You should mention #2126 at the beginning. 😉 Now I can clearly see and can confirm that this change has been somehow lost during the migration. Would you like to prepare PR to fix this?

If you take the doc from versioned folder and copied them back to master, some changes that haven't build will get lost

The versioned docs were not copied into next docs during the migration. You can check the whole process in the fork created specially for this migration: https://github.com/react-native-website-migration/react-native-website

@sunnylqm
Copy link
Contributor

sunnylqm commented Nov 5, 2020

And i noticed the edit link now changed to versioned doc(it was linked to master before), which may not be a good choice.
For a common pattern we should commit to master first then cherrypick to current release right?(either automatically or manually)

@Simek
Copy link
Collaborator Author

Simek commented Nov 5, 2020

This is how Docusuaurs V2 "Edit Page" links works and there is no option to change that at this moment. We can always create PR for that, but I'm personally looking at this as an improvement.

When all links were leading to the next version potential contributors were often confused, because they want to fix something on the page they are reading, but after "Edit Page" link click they were seeing different page content or the issue they were looking for was missing on the GitHub file which was opened.

For a common pattern we should commit to master first then cherrypick to current release right?(either automatically or manually)

They way we handle PRs heavily depends on the kind and scope of the issue or improvement, the most common pattern is to edit only next docs, with no backporting. More important changes are usually backported to the latest version too (0.63 at this moment). Also there is no automatic mechanism to backport the changes to older docs, and in 99% of cases version docs generated once will not be regenerated.

@sunnylqm
Copy link
Contributor

sunnylqm commented Nov 5, 2020

The question is that what's the cause for that lost?(I don't know what to check on that migration repo) If it's not copied from versioned docs, the only possibility I can come up with is it's copied from a snapshot on master?
Either way I am worrying about more commits may lost.

@slorber
Copy link
Contributor

slorber commented Nov 5, 2020

@sunnylqm I agree with you and it's also a problem for docusaurus website.
I want to add an option so that we can configure the edit link of each version independently.
You can make the RN 0.63 (latest) target the master docs in priority for example. I'd also prefer to edit the master docs in such case because if we merge by mistake a PR that only target RN. 0.63 we end up loosing the info for RN 0.64

This is also needed because some of our users are assembling md files from external repos, git submodules etc... Also we'll explore how to handle git-based CMS tools like Forestry/Tina/NetlifyCMS, in which case the edit link may rather target the edition UI instead of the git file.

So, it's not ready today but it's something we'll definitively support soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Major Contribution A contribution that changes the site's structure or majorly changes the content of a page
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request for Dark Theme with theme toggle for developers Content of the sidebar cannot be fully viewed
9 participants