diff --git a/.eslintignore b/.eslintignore index 340b57df..cb7239b8 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,6 @@ public +build +build-devel coverage images node_modules diff --git a/.flowconfig b/.flowconfig index 9a632b96..52287bb3 100644 --- a/.flowconfig +++ b/.flowconfig @@ -43,4 +43,5 @@ module.name_mapper='^data' -> '/src/data' module.name_mapper='^services' -> '/src/services' module.name_mapper='^support' -> '/src/support' module.name_mapper='^public' -> '/public' +module.name_mapper='^images' -> '/src/images' module.system=haste diff --git a/.gitignore b/.gitignore index 495fb80e..32c7ed74 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build +build-devel # Dependency directory node_modules diff --git a/package.json b/package.json index b3ba4764..2f795f89 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "scripts": { "dev": "npx webpack-dev-server --config ./webpack/dev.babel.js", "dev:local": "npx webpack-dev-server --config ./webpack/local.babel.js", - "build:clean": "rm -rf build", - "build:production": "npx webpack --config ./webpack/production.babel.js --progress --bail", + "build:prod": "rimraf build && npx webpack --config ./webpack/production.babel.js --progress --bail", + "build:dev": "rimraf build-devel && cross-env BUILD=development npx webpack --config ./webpack/production.babel.js --output-path build-devel --progress --bail", "build": "run-s build:*", "flow": "flow check src", "lint": "run-s lint:*", @@ -19,7 +19,9 @@ "lint:css": "npx stylelint './src/**/*.js'", "test": "run-s test:*", "test:unit": "npx jest", - "test-unit:watch": "npx jest -o --watch" + "test-unit:watch": "npx jest -o --watch", + "prod-server": "npx http-server ./build -a localhost -S -C ./server/cert.pem -K ./server/key.pem -o", + "prod-server-dev": "npx http-server ./build-devel -a localhost -S -C ./server/cert.pem -K ./server/key.pem -o" }, "dependencies": { "babel": "^6.23.0", @@ -27,6 +29,7 @@ "bignumber.js": "2.4.0", "color-hash": "^1.0.3", "copy-webpack-plugin": "^4.5.2", + "cross-env": "^5.2.0", "date-fns": "^1.29.0", "ethereumjs-tx": "^1.3.3", "ethereumjs-units": "^0.2.0", @@ -35,6 +38,7 @@ "flow-webpack-plugin": "^1.2.0", "hdkey": "^0.8.0", "html-webpack-plugin": "^3.2.0", + "http-server": "^0.11.1", "jest-fetch-mock": "^1.6.5", "npm-run-all": "^4.1.3", "prop-types": "^15.6.2", @@ -56,6 +60,7 @@ "redux-logger": "^3.0.6", "redux-raven-middleware": "^1.2.0", "redux-thunk": "^2.2.0", + "rimraf": "^2.6.2", "styled-components": "^3.3.3", "styled-media-query": "^2.0.2", "styled-normalize": "^8.0.0", diff --git a/server/cert.pem b/server/cert.pem new file mode 100644 index 00000000..31a57cf6 --- /dev/null +++ b/server/cert.pem @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDMjCCAhoCCQD/Ey0A0Ll1FjANBgkqhkiG9w0BAQsFADBbMQswCQYDVQQGEwJj +ejEKMAgGA1UECAwBczEKMAgGA1UEBwwBYTEKMAgGA1UECgwBczEKMAgGA1UECwwB +czEKMAgGA1UEAwwBczEQMA4GCSqGSIb3DQEJARYBczAeFw0xODA3MjUxMTUyMzla +Fw0xODA4MjQxMTUyMzlaMFsxCzAJBgNVBAYTAmN6MQowCAYDVQQIDAFzMQowCAYD +VQQHDAFhMQowCAYDVQQKDAFzMQowCAYDVQQLDAFzMQowCAYDVQQDDAFzMRAwDgYJ +KoZIhvcNAQkBFgFzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1sON +vf+ny+KASV8pCT83fJNyAV8uAvg/Ur0B/bf26onvhoUJ74w6lFfJTyw0WjOzXR/G +reXg4yO8aGHTwSuYifY0Uj1Lm4cZYz3n96X37cKyviNg8zp+QXKgESwnxJ/VyLf+ +rYc/DzTQsXFs7irDXsGCq+8z56ljZ788axd5wip2AGBAnTzH9OeHD8sRIYNqFKNm +S2Rx1Ev3QIIwqng3e6vX4/kk7Zz380z1MpB2wbEsUQxx27hT4Z2tZRyn0L/AXQBL +H3zxA5FNVxgQaUAFWoqS6cv8nJtIRbnvoiwNygDMyxhrB+CbUCtCVDm8W94TE+Qn ++BdZzfPg/fQbv4B6owIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQC/g7yIDluDPOKP +mo37+hI4vQT90HnSzccMhelBoqHSw2OFN3O+eantCy9eNr9UNHeZP7KyTsvRW5nW +L48Ps1eAPC66QCNvkLmpJ3YRHa157722cPdgV0jYm5njV+9pdjNFFD/yF43nNm/r +IdiOwXak4qqajDeug9oeZh/sGPZ888gnZMaYhON8zzL+CR+xKv45ORVpHY+fQp4f +xv8195pqcehFy2RYniDzcU/cy3IfOJaxYYbV5mlQtFvY8plhC3QtcJebS0nei4J+ +oX2Wh1dxKUNGxqPUjwfyYxPtxPTUEsOJAtTtwcrQ2ShKCzFSP9xdZ9i4WviV84pU +9RGGV7yC +-----END CERTIFICATE----- diff --git a/server/key.pem b/server/key.pem new file mode 100644 index 00000000..587de4a2 --- /dev/null +++ b/server/key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDWw429/6fL4oBJ +XykJPzd8k3IBXy4C+D9SvQH9t/bqie+GhQnvjDqUV8lPLDRaM7NdH8at5eDjI7xo +YdPBK5iJ9jRSPUubhxljPef3pfftwrK+I2DzOn5BcqARLCfEn9XIt/6thz8PNNCx +cWzuKsNewYKr7zPnqWNnvzxrF3nCKnYAYECdPMf054cPyxEhg2oUo2ZLZHHUS/dA +gjCqeDd7q9fj+STtnPfzTPUykHbBsSxRDHHbuFPhna1lHKfQv8BdAEsffPEDkU1X +GBBpQAVaipLpy/ycm0hFue+iLA3KAMzLGGsH4JtQK0JUObxb3hMT5Cf4F1nN8+D9 +9Bu/gHqjAgMBAAECggEBAIbMgXgjMn/vcBQdjZVHP52KsoEX67pjdOOKzOgigvHd +mCE3+e+IdfBMVYfDOCzxzIAEBOF7qzcGZCikVpQlt/3IMjj4Ti+VkaLP5Xx0iPSM +Q0LC1AR2z25m8v80VtW8eSQeENV8UWFLB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ym8WCZmDkVkhFmZk1J +-----END PRIVATE KEY----- diff --git a/src/store.js b/src/store.js index 30e78995..06257554 100644 --- a/src/store.js +++ b/src/store.js @@ -3,8 +3,6 @@ import { createStore, applyMiddleware, compose } from 'redux'; import { routerMiddleware } from 'react-router-redux'; import thunk from 'redux-thunk'; -// import createHistory from 'history/createBrowserHistory'; -// import { useRouterHistory } from 'react-router'; import createHistory from 'history/createHashHistory'; import { createLogger } from 'redux-logger'; import reducers from 'reducers'; @@ -17,17 +15,21 @@ import type { Action, GetState, Store } from 'flowtype'; export const history: History = createHistory({ queryKey: false }); -const RAVEN_KEY: string = 'https://497392c3ff6e46dc9e54eef123979378@sentry.io/294339'; -Raven.config(RAVEN_KEY).install(); - const initialState: any = {}; const enhancers = []; -const middleware = [ + +const middlewares = [ thunk, - RavenMiddleware(RAVEN_KEY), routerMiddleware(history), ]; +// sentry io middleware only in dev build +if (process.env.BUILD === 'development') { + const RAVEN_KEY = 'https://34b8c09deb6c4cd2a4dc3f0029cd02d8@sentry.io/1279550'; + const ravenMiddleware = RavenMiddleware(RAVEN_KEY); + Raven.config(RAVEN_KEY).install(); + middlewares.push(ravenMiddleware); +} let composedEnhancers: any; if (process.env.NODE_ENV === 'development') { @@ -50,13 +52,12 @@ if (process.env.NODE_ENV === 'development') { } composedEnhancers = compose( - applyMiddleware(logger, ...middleware, ...services), + applyMiddleware(logger, ...middlewares, ...services), ...enhancers, ); - } else { composedEnhancers = compose( - applyMiddleware(...middleware, ...services), + applyMiddleware(...middlewares, ...services), ...enhancers, ); } diff --git a/src/views/Landing/index.js b/src/views/Landing/index.js index ed2dd87b..3da5dd4a 100644 --- a/src/views/Landing/index.js +++ b/src/views/Landing/index.js @@ -1,6 +1,6 @@ /* @flow */ - import React from 'react'; +import CaseImage from 'images/case.png'; import styled from 'styled-components'; import Header from 'components/Header'; import Footer from 'components/Footer'; @@ -39,11 +39,10 @@ const LandingContent = styled.div` justify-content: center; `; -const LandingImage = styled.div` +const LandingImage = styled.img` width: 777px; min-height: 500px; margin: auto; - background-image: url('../images/case.png'); background-repeat: no-repeat; background-position: center 0px; background-size: contain; @@ -120,7 +119,7 @@ export default (props: Props) => { showDisconnect={shouldShowDisconnectDevice} /> - + {shouldShowConnectDevice && ( diff --git a/webpack/dev.babel.js b/webpack/dev.babel.js index 792835cb..8ad53418 100644 --- a/webpack/dev.babel.js +++ b/webpack/dev.babel.js @@ -97,7 +97,7 @@ module.exports = { COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()), }), new FlowWebpackPlugin({ - reportingSeverity: 'warning' + reportingSeverity: 'warning', }), new HtmlWebpackPlugin({ chunks: ['index'], diff --git a/webpack/production.babel.js b/webpack/production.babel.js index 95932ddd..3c774fe8 100644 --- a/webpack/production.babel.js +++ b/webpack/production.babel.js @@ -65,7 +65,8 @@ module.exports = { }, plugins: [ new webpack.DefinePlugin({ - COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()), + 'process.env.BUILD': JSON.stringify(process.env.BUILD), + COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash() }), new FlowWebpackPlugin(), new HtmlWebpackPlugin({ diff --git a/yarn.lock b/yarn.lock index 24401a58..e2939568 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2736,6 +2736,10 @@ cors@^2.8.1: object-assign "^4" vary "^1" +corser@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/corser/-/corser-2.0.1.tgz#8eda252ecaab5840dcd975ceb90d9370c819ff87" + cosmiconfig@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-3.1.0.tgz#640a94bf9847f321800403cd273af60665c73397" @@ -2803,6 +2807,13 @@ create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" +cross-env@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.2.0.tgz#6ecd4c015d5773e614039ee529076669b9d126f2" + dependencies: + cross-spawn "^6.0.5" + is-windows "^1.0.0" + cross-spawn@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" @@ -3399,6 +3410,15 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" +ecstatic@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/ecstatic/-/ecstatic-3.3.0.tgz#91cd417d152abf85b37b1ab3ebf3bd25cdc64e80" + dependencies: + he "^1.1.1" + mime "^1.6.0" + minimist "^1.1.0" + url-join "^2.0.5" + editions@^1.3.3: version "1.3.4" resolved "https://registry.yarnpkg.com/editions/-/editions-1.3.4.tgz#3662cb592347c3168eb8e498a0ff73271d67f50b" @@ -4895,7 +4915,7 @@ hdkey@^0.8.0: safe-buffer "^5.1.1" secp256k1 "^3.0.1" -he@1.1.x: +he@1.1.x, he@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -5060,7 +5080,7 @@ http-proxy-middleware@~0.18.0: lodash "^4.17.5" micromatch "^3.1.9" -http-proxy@^1.16.2: +http-proxy@^1.16.2, http-proxy@^1.8.1: version "1.17.0" resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.17.0.tgz#7ad38494658f84605e2f6db4436df410f4e5be9a" dependencies: @@ -5068,6 +5088,19 @@ http-proxy@^1.16.2: follow-redirects "^1.0.0" requires-port "^1.0.0" +http-server@^0.11.1: + version "0.11.1" + resolved "https://registry.yarnpkg.com/http-server/-/http-server-0.11.1.tgz#2302a56a6ffef7f9abea0147d838a5e9b6b6a79b" + dependencies: + colors "1.0.3" + corser "~2.0.0" + ecstatic "^3.0.0" + http-proxy "^1.8.1" + opener "~1.4.0" + optimist "0.6.x" + portfinder "^1.0.13" + union "~0.4.3" + http-signature@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" @@ -5567,7 +5600,7 @@ is-whitespace-character@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.2.tgz#ede53b4c6f6fb3874533751ec9280d01928d03ed" -is-windows@^1.0.1, is-windows@^1.0.2: +is-windows@^1.0.0, is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -6746,6 +6779,10 @@ mime@1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" +mime@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + mime@^2.1.0: version "2.3.1" resolved "https://registry.yarnpkg.com/mime/-/mime-2.3.1.tgz#b1621c54d63b97c47d3cfe7f7215f7d64517c369" @@ -6797,7 +6834,7 @@ minimist@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.1.0.tgz#99df657a52574c21c9057497df742790b2b4c0de" -minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: +minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -7298,13 +7335,17 @@ opener@^1.4.3: version "1.5.1" resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed" +opener@~1.4.0: + version "1.4.3" + resolved "https://registry.yarnpkg.com/opener/-/opener-1.4.3.tgz#5c6da2c5d7e5831e8ffa3964950f8d6674ac90b8" + opn@^5.1.0: version "5.3.0" resolved "https://registry.yarnpkg.com/opn/-/opn-5.3.0.tgz#64871565c863875f052cfdf53d3e3cb5adb53b1c" dependencies: is-wsl "^1.1.0" -optimist@^0.6.1: +optimist@0.6.x, optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" dependencies: @@ -7664,6 +7705,14 @@ pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" +portfinder@^1.0.13: + version "1.0.17" + resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.17.tgz#a8a1691143e46c4735edefcf4fbcccedad26456a" + dependencies: + async "^1.5.2" + debug "^2.2.0" + mkdirp "0.5.x" + portfinder@^1.0.9: version "1.0.13" resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.13.tgz#bb32ecd87c27104ae6ee44b5a3ccbf0ebb1aede9" @@ -8172,6 +8221,10 @@ qs@6.5.2, qs@~6.5.1, qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" +qs@~2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/qs/-/qs-2.3.3.tgz#e9e85adbe75da0bbe4c8e0476a086290f863b404" + qs@~6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" @@ -10371,6 +10424,12 @@ union-value@^1.0.0: is-extendable "^0.1.1" set-value "^0.4.3" +union@~0.4.3: + version "0.4.6" + resolved "https://registry.yarnpkg.com/union/-/union-0.4.6.tgz#198fbdaeba254e788b0efcb630bc11f24a2959e0" + dependencies: + qs "~2.3.3" + uniq@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" @@ -10468,6 +10527,10 @@ urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" +url-join@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/url-join/-/url-join-2.0.5.tgz#5af22f18c052a000a48d7b82c5e9c2e2feeda728" + url-join@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.0.tgz#4d3340e807d3773bda9991f8305acdcc2a665d2a"