This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { Provider } from 'react-redux'; | |
import { updateServiceworker } from 'service-worker-redux' | |
import configureStore from 'store/configure-store' | |
import './index.css'; | |
import App from './App'; | |
import registerServiceWorker from './registerServiceWorker'; | |
const store = configureStore() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createSelector } from 'reselect' | |
// CONSTANTS | |
export const UPDATE_SERVICEWORKER = 'UPDATE_SERVICEWORKER' | |
export function updateServiceworker () { | |
return { | |
type: UPDATE_SERVICEWORKER | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In production, we register a service worker to serve assets from local cache. | |
// This lets the app load faster on subsequent visits in production, and gives | |
// it offline capabilities. However, it also means that developers (and users) | |
// will only see deployed updates on the "N+1" visit to a page, since previously | |
// cached resources are updated in the background. | |
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. | |
// This link also includes instructions on opting out of this behavior. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deployment: | |
prod: | |
branch: master | |
commands: | |
- NODE_ENV=production yarn run build | |
- ./bin/s3Sync.sh [s3 bucket name] | |
staging: | |
branch: staging | |
commands: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$1" != "" ]]; then | |
S3BUCKETNAME="$1" | |
else | |
echo ERROR: Failed to supply S3 bucket name | |
exit 1 | |
fi | |
aws s3 sync build s3://$S3BUCKETNAME --delete --cache-control max-age=31536000,public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isJson (response) { | |
const contentType = response.headers.get('content-type') | |
return contentType && contentType.indexOf('application/json') !== -1 | |
} | |
export function handleResponse (response) { | |
if (response.ok) { | |
if (isJson(response)) { | |
return response.json() | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if (process.env.NODE_ENV !== 'development') { %> | |
<script> | |
var _rollbarConfig = { | |
accessToken: '%REACT_APP_ROLLBAR_TOKEN%', | |
captureUncaught: true, | |
captureUnhandledRejections: true, | |
payload: { | |
environment: '%NODE_ENV%', | |
client: { | |
javascript: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deployment: | |
prod: | |
branch: master | |
commands: | |
- NODE_ENV=production REACT_APP_GIT_SHA=$CIRCLE_SHA1 REACT_APP_ROLLBAR_TOKEN=$ROLLBAR_TOKEN yarn run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import { withRouter } from 'react-router' | |
import reactRouterFetch from 'react-router-fetch' | |
class App extends Component { | |
state = { | |
isAppFetching: false, | |
appFetchingError: null | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reactRouterFetch(routeConfig, location, { dispatch }) | |
.then((results) => { | |
this.setState({ | |
isAppFetching: false | |
}) | |
}) | |
.catch((err) => { | |
this.setState({ | |
isAppFetching: false, | |
appFetchingError: err |