6a8200df95
Summary: This only affects the website when it is hosted locally using express. The current version of the website is annoyingly sluggish, as the whole docs structure is parsed on each request. In this PR, we store the result of extracting the Markdown sources in memory, significantly speeding up page loads. We also delay the extraction of docs until a request is made that would require them (e.g. anything that hits `/react-native/docs/*`). There is still a 8 second delay when the docs are first visited, as expected. This can be improved in a later PR. Any changes to the docs structure may require a server restart to take effect. This is rare enough that I don't think it is a blocker. This PR significantly speeds up first page load times on the homepage and any non-docs site, and speeds up subsequent page loads on Docs. This will make for a better web development experience. Extracting the docs on each request takes around 8 seconds. Storing these in memory allows us to virtuall Closes https://github.com/facebook/react-native/pull/12203 Differential Revision: D4516697 Pulled By: hramos fbshipit-source-id: 05276e9827c82e38ccf064209b3fd38005f8e247 |
||
---|---|---|
.. | ||
core | ||
jsdocs | ||
layout | ||
server | ||
src/react-native | ||
.gitignore | ||
README.md | ||
package.json | ||
publish-gh-pages.js | ||
setup.sh |
README.md
Install prerequisites
Before running the website, make sure you've run the following:
git clone https://github.com/facebook/react-native.git
cd react-native
npm install
Run the website server
The first time, get all the website dependencies loaded via
cd website
npm install
Then, run the server via
npm start
open http://localhost:8079/react-native/index.html
Anytime you change the contents, just refresh the page and it's going to be updated.
Publish the website
cd website
npm run publish-website