diff --git a/.babelrc.js b/.babelrc.js index 92e416027..8dad6ed0a 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -22,7 +22,7 @@ module.exports = { }, }, ], - '@babel/preset-stage-2', + ["@babel/preset-stage-2", { "decoratorsLegacy": true }], '@babel/preset-flow', '@babel/preset-react', ], diff --git a/.env.sample b/.env.sample index 324ffe812..2d528adad 100644 --- a/.env.sample +++ b/.env.sample @@ -31,3 +31,6 @@ HONEYBADGER_API_KEY= # SendGrid info for email notifications SENDGRID_API_KEY= + +# Set as true to run https locally, add self-signed certificate in cert folder to trusted certificates +USE_HTTPS= diff --git a/README.md b/README.md index 99afd1786..1c864cc63 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,10 @@ node build/server.js You can modify `tools/deploy.js` as needed to work with your deployment strategy. +## Service Worker + +To run the service worker locally, follow the above steps to run the production server. After testing the service worker, be sure to unregister the service worker in the browser (or close all local Lunch tabs) to avoid issues when testing on the development server. + ## Testing ### Unit tests diff --git a/cert/server.crt b/cert/server.crt index b35a0ae17..1103cc7e5 100644 --- a/cert/server.crt +++ b/cert/server.crt @@ -1,22 +1,18 @@ -----BEGIN CERTIFICATE----- -MIIDljCCAn4CCQDKlarFMPQQbDANBgkqhkiG9w0BAQsFADCBjDELMAkGA1UEBhMC -VVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28x -ETAPBgNVBAoMCExhYiBaZXJvMRkwFwYDVQQDDBBsb2NhbC5sdW5jaC5waW5rMSIw -IAYJKoZIhvcNAQkBFhNqZWZmcmV5QGxhYnplcm8uY29tMB4XDTE4MDQyNjIxMjIy -NFoXDTE5MDQyNjIxMjIyNFowgYwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxp -Zm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMREwDwYDVQQKDAhMYWIgWmVy -bzEZMBcGA1UEAwwQbG9jYWwubHVuY2gucGluazEiMCAGCSqGSIb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UuDppA46hCzLjuhoHMuJehJKYlctZGDYVE2jRYCC/mdFN8jWfHE1sqp9A +Q/qP6vsTvPpfmKcnu/x62TLPH7ZrNvwhiv18YxszvJQAhdGBW8geftMH8x9PfznQ +yzkIDTROeAZbnY29PxQTmVwx90o6CKfLaBAX/Z6ZkFAMio8v3GGuW6bJMo+g7Lz0 +r2KzzZEZp7oUCP5tw1uvAjzO4XD56vNdjrBymrySza2qCM7UNbMEWExtMqvsUK6C +5HcnT3PyWARaJH8G5wQpvFqNbW18nQoh9owoa/hcYhxR2nBRQOECAwEAAaMhMB8w +HQYDVR0RBBYwFIISKi5sb2NhbC5sdW5jaC5waW5rMA0GCSqGSIb3DQEBCwUAA4IB +AQCqystbK46mhrfCWKnS2qlCkuU1YT8xGaOFqb8/f+rNq6UonIZ38vcHUn4k9UcT +HYhVkul36YK85KMq9E6tlmuGxgl8hg021bPgi/0Y8x/4EAWIVYM2IARQhIgEa5+F +30u4Rf+OZhjt4EQ4QUoyOynXLrA2sFnzApeFYhmDwXtkB9umECSF1CLDc8l+zLZB +utBZwdzVSHs8atnZTdCLHwo42egWJVecA8CbNuQZ0PCEF7hmMoVH9Iln1Fvidhp3 +gwI/NnK7fZUWEee4nuinX2OIybPtofkfXjxljcC8bubslmceAjc4rSxGwuY61lvN +B8NDHd+xb30jLmlnr5x+pq7l -----END CERTIFICATE----- diff --git a/package.json b/package.json index e941b0eb2..1f8e5e27b 100644 --- a/package.json +++ b/package.json @@ -188,7 +188,8 @@ "webpack-bundle-analyzer": "^2.11.1", "webpack-dev-middleware": "^3.1.2", "webpack-hot-middleware": "^2.21.2", - "webpack-node-externals": "^1.7.2" + "webpack-node-externals": "^1.7.2", + "workbox-webpack-plugin": "^3.2.0" }, "lint-staged": { "*.{js,jsx}": ["eslint --no-ignore --fix", "git add --force"], diff --git a/public/site.webmanifest b/public/site.webmanifest index 3992b48d7..6803af5fc 100644 --- a/public/site.webmanifest +++ b/public/site.webmanifest @@ -1,4 +1,7 @@ { + "short_name": "Lunch", + "name": "Lunch", + "description": "A simple lunch voting app for you and your team. Search nearby restaurants, add them to your list, vote for as many as you like, and decide on today’s pick!", "icons": [ { "src": "icon.png", @@ -6,5 +9,8 @@ "type": "image/png" } ], - "start_url": "/" + "start_url": "/", + "display": "standalone", + "theme_color": "#FFC0CB", + "background_color": "#FFF" } diff --git a/src/components/ErrorPage/ErrorPage.js b/src/components/ErrorPage/ErrorPage.js index ca40c3b60..0ea869b5b 100644 --- a/src/components/ErrorPage/ErrorPage.js +++ b/src/components/ErrorPage/ErrorPage.js @@ -18,7 +18,7 @@ export function ErrorPage({ error }) { let errorMessage = null; if (error.status === 404) { - title = 'Page Not Found'; + title = 'Page not found'; content = 'Sorry, the page you were trying to view does not exist.'; } else if (process.env.NODE_ENV !== 'production') { errorMessage =
{error.stack}
; diff --git a/src/components/Html.js b/src/components/Html.js index 3a51e3257..0d8630b1d 100644 --- a/src/components/Html.js +++ b/src/components/Html.js @@ -74,6 +74,7 @@ class Html extends Component { + {scripts.map(script => ( @@ -92,6 +93,7 @@ class Html extends Component {