Home of The Times' react
/react native
components, using
react-native-web to share across
platforms
We require MacOS with Node.js (version >=8 with npm v5), yarn (latest) and watchman installed. Native development requires Xcode, Android Studio and JDK 8.
You can try without these requirements, but you'd be on your own.
If you use Expo you are able to scan the QR code below
This has been made possible using Fructose
- Run
yarn
to install dependencies with aGRAPHQL_ENDPOINT
envar set for linting. This is simply an example GraphQL endpoint, and you will need to obtain a valid API endpoint in order to successfully work with this repository.
GRAPHQL_ENDPOINT="http://localhost:4000/graphql" yarn
- Install fontforge:
brew install fontforge
(See Fonts section) - Components can be seen running in a storybook:
- web storybook
yarn storybook
- go to http://localhost:9001
- native storybook
yarn storybook-native
and leave it runningyarn ios
to start the iOS app- To start the Android app:
- Start a virtual device
- Check Android SDK path is exported to $ANDROID_HOME. In Mac, android sdk
is installed to ~/Library/Android/sdk by default.
export ANDROID_HOME="/Users/<USERNAME>/Library/Android/sdk"
yarn android
- If you get build errors, check your JDK version with
javac -version
, which should printjavac 1.8.XXXX
. Earlier or later versions may not work.
- go to http://localhost:7007
In order to run development servers for native applications, start haul dev server via:
yarn android:app
or yarn ios:app
We use Haul in lieu of the standard react-native
CLI so that we can generate
native Storybook bundles using Webpack, which we configure to honour our
monorepo packages' respective dev
entry points; this allows one to update a
package's source code and preview the changes without having to manually
re-transpile. Haul also automatically generates debuggable source maps.
In order to view the storybook on native, you'll need to fix broken fonts. This fix is done automatically when running storybook (both web and native), but requires that fontforge is installed, otherwise the fix won't be applied and you'll get the classic red error screen when trying to use a broken font.
See utils package on how to update the schema
The components in this project can be debugged through your browser's developer tools. These steps assume the use of Chrome DevTools.
To debug our web Storybook:
yarn storybook
- navigate to http://localhost:9001
- open DevTools
- Click Sources
- In the Network tab under the leftmost pane, expand top => storybook-preview-iframe => webpack:// => . => packages
Any of these source files can be debugged directly.
To debug our native Storybook:
yarn storybook-native
and leave it runningyarn android:logs
oryarn ios:logs
(this will build storybook app and output logs) 2a. Or you could just runyarn android
oryarn ios
to just build the apps- open the developer menu on your device (Cmd + M on Android, Cmd + D on iOS) and tap Debug JS Remotely
- navigate to http://localhost:8081/debugger-ui if it hasn't opened automatically
- open DevTools
- click Sources
- expand debuggerWorker.js => webpack:// => . => packages
Tests | Covered | CI |
---|---|---|
Unit tests, UI tests and Integration tests | ✅ | Travis Build |
Visual Regression tool (Dextrose) | ✅ | Not automated |
Functional Regression tool (Fructose) | ✅ | Not automated |
See the CONTRIBUTING.md for an extensive breakdown of the project
yarn commit
will commit files (same as git commit
), and will aid the
contributor with adding a suitable commit message inline with
conventional changelog