Documentation!
Clone or download
Latest commit 3a563f6 Dec 13, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update PR template Mar 12, 2018
common create a slugger instance per page and pass it to components using co… Nov 13, 2018
components stop allowing permalinks on list items Nov 13, 2018
diagram-sources add next.js-based docs Apr 4, 2018
generated makes sure naming conventions match expo.io and removes unused imports Apr 4, 2018
global-styles prevents images from getting too wide Aug 14, 2018
mdjs Fix docs (wrong formatting, RN v0.57 update) (#3273) Nov 10, 2018
pages gives docs its own google analytics Apr 13, 2018
react-native-website @ a4070c1 Fix docs (wrong formatting, RN v0.57 update) (#3273) Nov 10, 2018
scripts Fix docs (wrong formatting, RN v0.57 update) (#3273) Nov 10, 2018
static fixes broken imgur image by self hosting the icloud-entitlement.png May 16, 2018
transition Replace XDE and exp with Expo CLI (#3137) Sep 12, 2018
versions remove SMS permission and update resolve value of sendSMSAsync on And… Dec 14, 2018
.babelrc prepares docs for an easy babel 7 and next 7.0.0 transition once next… Sep 25, 2018
.dockerignore add next.js-based docs Apr 4, 2018
.gitignore Fix map of options formatting in FileSystem Apr 17, 2018
.gitmodules add .gitmodules for satellite repo Aug 15, 2018
Dockerfile circle-ci support Apr 4, 2018
LICENSE add next.js-based docs Apr 4, 2018
README.md Update Quirks section in README Oct 15, 2018
build_image.sh remove references to removed directories (dev libraries/schemer libra… Sep 27, 2018
deploy.sh Replace kubernetes deployment scripts Sep 24, 2018
docs.k8s.template.yml Replace kubernetes deployment scripts Sep 24, 2018
env-config.js add next.js-based docs Apr 4, 2018
package.json add v31.0.0 Oct 31, 2018
server.js removes routing based menu for a basic state managed menu Apr 4, 2018
yarn.lock Fix yarn.lock Apr 4, 2018

README.md

Expo Documentation

This is the public documentation for Expo, its SDK, client and services.

You can access this documentation online at https://docs.expo.io/. It's built using next.js on top of the https://github.com/zeit/docs codebase.

Running Locally

Download the copy of this repostory.

git clone https://github.com/expo/expo-docs.git

Then cd into the downloaded directory and install dependencies with:

yarn

Then you need to install babel-cli

yarn global add babel-cli

Then you can run the app with (make sure you have no server running on port 3000):

yarn run dev

This starts two processes: a next.js server, and a compiler/watcher that converts markdown files into javascript pages that next.js understands.

Now the documentation is running at http://localhost:3000

Running in production mode

yarn run build
yarn run start

Editing Docs Content

You can find the source of the documentation inside the versions directory. Documentation is mostly written in markdown with the help of some React components (for Snack embeds, etc). The routes and navbar are automatically inferred from the directory structure within versions.

Adding Images and Assets

You can add images and assets in the same directory as the markdown file, and you just need to reference them correctly.

New Components

Always try to use the existing components and features in markdown. Create a new component or use a component from NPM, unless there is no other option.

Quirks

  • You can't have curly brace without quotes: `{}` -> {}
  • Make sure to leave a empty newline between a table and following content

Transition from current docs to next.js docs

Compile process

In both yarn run start and yarn run dev, we initially compile (see mdjs dir) all .md files in versions to .js files under pages/versions (which is git-ignored, and never commited). At this point, we also generate the json file navigation-data.json for the navbar, and copy images in versions to the static folder.

In yarn run dev, the watcher watches for changes to files in versions, and re-compiles as necessary. Note: navigation changes probably won't live-reload so make sure to restart the server.

Not breaking existing incoming links

transition/sections.js is used to figure out which URLs to alias. In order to not break existing URLs such as guides/configuration (the new URL is the more sensible workflow/configuration, automatically inferred from the fact that configuration.md is in the workflow subdir), in next.js, we support both so we need to keep a list of URLs to alias under guides. For future versions, the guides URL for configuration won't exist at all so we can slowly phase out this file.

A note about versioning

Expo's SDK is versioned so that apps made on old SDKs are still supported when new SDKs are relased. The website documents previous SDK versions too.

Version names correspond to directory names under versions.

unversioned is a special version for the next SDK release.

Sometimes you want to make an edit in version X and have that edit also be applied in versions Y, Z, ... (say, when you're fixing documentation for an API call that existed in old versions too). You can use the ./scripts/versionpatch.sh utility to apply your git diff in one version in other versions. For example, to update the docs in unversioned then apply it on v8.0.0 and v7.0.0, you'd do the following after editing the docs in unversioned such that it shows up in git diff:

./scripts/versionpatch.sh unversioned v8.0.0 v7.0.0

Any changes in your git diff outside the unversioned directory are ignored so don't worry if you have code changes or such elsewhere.

Updating latest version of docs

When we release a new SDK, we copy the unversioned directory, and rename it to the new version. Latest version of docs is read from package.json so make sure to update the version key there as well. However, if you update the version key there, you need to rm -rf node_modules/.cache/ before the change is picked up (why? read this).

Make sure to also grab the upgrade instructions from the release notes blog post and put them in upgrading-expo-sdk-walkthrough.md.

That's all you need to do. The versions directory is listed on server start to find all available versions. The routes and navbar contents are automatically inferred from the directory structure within versions. So, /versions/v24.0.0/guides/development-mode refers to pages/versions/guides/development-mode.

Because the navbar is automatically generated from the directory structure, the default ordering of the links under each section is alphabetical. However, for many sections, this is not ideal UX. So, if you wish to override the alphabetical ordering, manipulate page titles in sidebar-navigation-order.js.

Importing from the React Native docs

You can import the React Native docs in an automated way into these docs.

  1. Update the react-native-website submodule here
  2. yarn run import-react-native-docs

This will write all the relevant RN doc stuff into the unversioned version directory. You may need to tweak the script as the source docs change; the script hackily translates between the different forms of markdown that have different quirks.

The React Native docs are actually versioned but we currently read off of master.

TODOs: - Handle image sizing in imports better - Read from the appropriate version (configurable) of the React Native docs, not just master - Make Snack embeds work; these are marked in some of the React Native docs but they are just imported as plain JS code blocks