A React.js SPA that demonstrates various front-end coding and testing practises. The site can be accessed here, using the username readonly
and the password Readonly1
.
This React.js SPA features the following:
- CRUD GraphQL operations via Apollo client
- Lean testing of an SPA, utilizing Jest for unit tests, Storybook image screenshots and Reg Suit for visual regression testing, and Cypress for end-to-end testing
- Flow for static type checking of the JavaScript
- An approach to React component creation that separates the visual appearance from the behaviour implementation, as described by Dan Abramov.
- A module-based approach to the structuring of the app's source files
- Circle CI for continuous integration and deployment
- Use of Grommet component library (specifically a beta of the upcoming Version 2 of Grommet)
- Use of React App Rewired to avoid ejecting a project bootstrapped with Create React App
All of the following can be run simultaneously locally—you just need a populated .env file:
yarn start
- runs the app locallyyarn storybook
- run storybook locallyyarn test
- run jest testsyarn cypress
- run cypress testsyarn run screenshot
- create/update storybook screenshots
You can check on the included packages in the build with the following, replacing the xxxx
with the actual bundle checksum value:
source-map-explorer ./build/static/js/main.xxxx.js ./build/static/js/main.xxxx.js.map
I was unable to use a graphql/gql file loader with Babel or Webpack as Storybook does not pick it up.
I might get this problem with Apollo Link State: "local client data getting nulled out after making a query that involves a round trip to the server." For the moment, reverting to 0.4.0 will fix the problem.
Make sure that the whole of the grommet-icons package does not get included in the production build.
This also requires uses of withTheme
...
import { withTheme } from "grommet/components/hocs";
... to be translated to:
import { withTheme } from "grommet/es6/components/hocs";
If you get the 'performing a tls handshake to localhost' issue, follow the instructions here and then restart Firefox. (For OS X, the location for me was ~/Library/Application Support/Firefox/Profiles/
and I had to delete the cert8.db
and cert9.db
files.)
Message: Network error: Store reset while query was in flight(not completed in link chain)
Bug: Github issue
To update flow types for used packages:
flow-typed install