From 9f750721c21b23d4a520fb9d03deb5fc93488841 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 6 Jun 2018 09:57:40 -0400 Subject: [PATCH] Get the prod build working! --- .babelrc | 2 +- index.html | 18 ------- package.json | 4 +- public/index.html | 6 +-- rollup.config.js | 22 ++++---- rollup.prod.js | 3 -- src/WSCache.js | 2 +- src/electron/app.js | 9 ++-- yarn.lock | 129 +++++++++++++++++++++----------------------- 9 files changed, 84 insertions(+), 111 deletions(-) delete mode 100644 index.html diff --git a/.babelrc b/.babelrc index 1c78f4c..91d27db 100644 --- a/.babelrc +++ b/.babelrc @@ -4,7 +4,7 @@ ["env", { "targets": { "browsers": [ - ">0.25%", + ">1%", "not ie 11", "not op_mini all" ] diff --git a/index.html b/index.html deleted file mode 100644 index bb8df56..0000000 --- a/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - Inferno App - - - - - - - diff --git a/package.json b/package.json index f48199d..65d93c1 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "rollup-plugin-alias": "^1.4.0", "rollup-plugin-babel": "^3.0.4", "rollup-plugin-commonjs": "^9.1.3", - "rollup-plugin-cpy": "^1.0.0", + "rollup-plugin-copy": "^0.2.3", "rollup-plugin-filesize": "^1.5.0", "rollup-plugin-livereload": "^0.6.0", "rollup-plugin-node-resolve": "^3.3.0", @@ -71,7 +71,7 @@ "rollup-plugin-visualizer": "^0.6.0" }, "scripts": { - "build": "rollup --config rollup.prod.js", + "build": "set NODE_ENV=production && rollup --config rollup.prod.js", "dist": "yarn run build && build", "electron-start": "node src/electron/wait-inferno", "electron": "electron .", diff --git a/public/index.html b/public/index.html index 869c961..8805644 100644 --- a/public/index.html +++ b/public/index.html @@ -1,8 +1,8 @@ - - + + @@ -10,7 +10,7 @@ - + diff --git a/rollup.config.js b/rollup.config.js index fe9e683..f49c4db 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,24 +1,24 @@ import babel from 'rollup-plugin-babel'; -import copy from 'rollup-plugin-cpy'; +import copy from 'rollup-plugin-copy'; import commonjs from 'rollup-plugin-commonjs'; import replace from 'rollup-plugin-replace'; import resolve from 'rollup-plugin-node-resolve'; export default { - input: 'src/index.js', + input: './src/index.js', output: { - file: 'build/bundle.js', - format: 'es', + file: './build/bundle.js', + format: 'iife', sourcemap: true, }, plugins: [ - copy([{ - dest: 'build/', - files: ['public/index.html', 'public/favicon.ico'], - }, { - dest: 'build/css/', - files: ['public/css/bootstrap.css', 'public/css/app.css'], - }]), + copy({ + 'public/index.html': 'build/index.html', + 'public/favicon.ico': 'build/favicon.ico', + 'public/css/bootstrap.css': 'build/css/bootstrap.css', + 'public/css/app.css': 'build/css/app.css', + verbose: true, + }), replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), }), diff --git a/rollup.prod.js b/rollup.prod.js index 34f11f5..092073e 100644 --- a/rollup.prod.js +++ b/rollup.prod.js @@ -2,9 +2,6 @@ import baseConfig from './rollup.config'; import filesize from 'rollup-plugin-filesize'; import { terser } from 'rollup-plugin-terser'; -// Force the appropriate environment -process.env.NODE_ENV = 'production'; - export default { ...baseConfig, plugins: [ diff --git a/src/WSCache.js b/src/WSCache.js index 8238f58..7773ab4 100644 --- a/src/WSCache.js +++ b/src/WSCache.js @@ -1,7 +1,7 @@ import bindAll from 'lodash-es/bindAll'; import { JSONMessage } from '//helpers/web-socket'; -export class WSCache { +class WSCache { constructor (ws) { this.ws = ws; diff --git a/src/electron/app.js b/src/electron/app.js index 36b0ea6..f4f104a 100644 --- a/src/electron/app.js +++ b/src/electron/app.js @@ -26,10 +26,13 @@ const createWindow = () => { slashes: true, }); mainWindow.loadURL(startUrl); + // Open the DevTools. - mainWindow.webContents.openDevTools({ - mode: 'bottom', - }); + if (process.env.NODE_ENV !== 'production') { + mainWindow.webContents.openDevTools({ + mode: 'bottom', + }); + } // Emitted when the window is closed. mainWindow.on('closed', () => { diff --git a/yarn.lock b/yarn.lock index d5f7c51..5f1d3a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -593,12 +593,12 @@ resolved "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" "@types/node@*": - version "10.3.0" - resolved "https://registry.npmjs.org/@types/node/-/node-10.3.0.tgz#078516315a84d56216b5d4fed8f75d59d3b16cac" + version "10.3.1" + resolved "https://registry.npmjs.org/@types/node/-/node-10.3.1.tgz#51092fbacaed768a122a293814474fbf6e5e8b6d" "@types/node@^8.0.24": - version "8.10.17" - resolved "https://registry.npmjs.org/@types/node/-/node-8.10.17.tgz#d48cf10f0dc6dcf59f827f5a3fc7a4a6004318d3" + version "8.10.18" + resolved "https://registry.npmjs.org/@types/node/-/node-8.10.18.tgz#eb9ad8b0723d13fa9bc8b42543e3661ed805f2bb" abab@^1.0.4: version "1.0.4" @@ -625,8 +625,8 @@ acorn@^3.0.4: resolved "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" acorn@^5.0.0, acorn@^5.3.0, acorn@^5.5.0: - version "5.6.0" - resolved "https://registry.npmjs.org/acorn/-/acorn-5.6.0.tgz#572bedb377a1c61b7a289e72b8c5cfeb7baaf0bf" + version "5.6.2" + resolved "https://registry.npmjs.org/acorn/-/acorn-5.6.2.tgz#b1da1d7be2ac1b4a327fb9eab851702c5045b4e7" address@1.0.3, address@^1.0.1: version "1.0.3" @@ -1751,8 +1751,8 @@ camelcase@^4.0.0, camelcase@^4.1.0: resolved "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" caniuse-lite@^1.0.30000792, caniuse-lite@^1.0.30000844: - version "1.0.30000847" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000847.tgz#be77f439be29bbc57ae08004b1e470b653b1ec1d" + version "1.0.30000849" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000849.tgz#7e1aa48e6d58917dcd70aabf7e7a33514a258f91" capture-exit@^1.2.0: version "1.2.0" @@ -1793,7 +1793,7 @@ chalk@2.3.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.2, chalk@^2.4.1: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1: version "2.4.1" resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" dependencies: @@ -1990,25 +1990,6 @@ core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -cp-file@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/cp-file/-/cp-file-5.0.0.tgz#bc700fd30ca32d24d46c7fb02b992e435fc5a978" - dependencies: - graceful-fs "^4.1.2" - make-dir "^1.0.0" - nested-error-stacks "^2.0.0" - pify "^3.0.0" - safe-buffer "^5.0.1" - -cpy@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/cpy/-/cpy-6.0.0.tgz#0b6888e037bb5a7b02a62249551316208a523253" - dependencies: - arrify "^1.0.1" - cp-file "^5.0.0" - globby "^6.0.0" - nested-error-stacks "^2.0.0" - create-error-class@^3.0.0: version "3.0.2" resolved "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" @@ -2498,8 +2479,8 @@ eslint-module-utils@^2.2.0: pkg-dir "^1.0.0" eslint-plugin-flowtype@^2.46.1: - version "2.48.0" - resolved "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.48.0.tgz#e447dc27dcb99d68e2a705fd9c1046c32aae2ca1" + version "2.49.3" + resolved "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.49.3.tgz#ccca6ee5ba2027eb3ed36bc2ec8c9a842feee841" dependencies: lodash "^4.17.10" @@ -2611,8 +2592,8 @@ eslint@^4.19.0, eslint@^4.19.1: text-table "~0.2.0" esm@^3.0.40: - version "3.0.41" - resolved "https://registry.npmjs.org/esm/-/esm-3.0.41.tgz#f7e8678510e5da89afc5709f9fc1c87f289919e9" + version "3.0.47" + resolved "https://registry.npmjs.org/esm/-/esm-3.0.47.tgz#e6773649dc23c4b2dd496eecc0cf0c0ad951c418" espree@^3.5.4: version "3.5.4" @@ -2979,6 +2960,14 @@ fs-extra@^0.30.0: path-is-absolute "^1.0.0" rimraf "^2.2.8" +fs-extra@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291" + dependencies: + graceful-fs "^4.1.2" + jsonfile "^3.0.0" + universalify "^0.1.0" + fs-extra@^4.0.1: version "4.0.3" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" @@ -3012,7 +3001,7 @@ fsevents@^1.0.0, fsevents@^1.2.3: nan "^2.9.2" node-pre-gyp "^0.10.0" -function-bind@^1.0.2, function-bind@^1.1.1: +function-bind@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -3122,16 +3111,6 @@ globby@^5.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" -globby@^6.0.0: - version "6.1.0" - resolved "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" - dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - got@^6.7.1: version "6.7.1" resolved "https://registry.npmjs.org/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" @@ -3236,10 +3215,10 @@ has-values@^1.0.0: kind-of "^4.0.0" has@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + version "1.0.3" + resolved "https://registry.npmjs.org/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" dependencies: - function-bind "^1.0.2" + function-bind "^1.1.1" history@^4.7.2: version "4.7.2" @@ -4151,8 +4130,8 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" js-yaml@^3.11.0, js-yaml@^3.7.0, js-yaml@^3.9.1: - version "3.11.0" - resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" + version "3.12.0" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -4240,6 +4219,12 @@ jsonfile@^2.1.0: optionalDependencies: graceful-fs "^4.1.6" +jsonfile@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66" + optionalDependencies: + graceful-fs "^4.1.6" + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -4622,10 +4607,6 @@ needle@^2.2.0: iconv-lite "^0.4.4" sax "^1.2.4" -nested-error-stacks@^2.0.0: - version "2.0.1" - resolved "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.0.1.tgz#d2cc9fc5235ddb371fc44d506234339c8e4b0a4b" - nice-try@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" @@ -5146,6 +5127,10 @@ pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" +psl@^1.1.24: + version "1.1.27" + resolved "https://registry.npmjs.org/psl/-/psl-1.1.27.tgz#2b2c77019db86855170d903532400bf71ee085b6" + punycode@^1.4.1: version "1.4.1" resolved "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" @@ -5542,14 +5527,12 @@ rollup-plugin-commonjs@^9.1.3: resolve "^1.5.0" rollup-pluginutils "^2.0.1" -rollup-plugin-cpy@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/rollup-plugin-cpy/-/rollup-plugin-cpy-1.0.0.tgz#495836b776639b9cf93a2c21a829b67ccff46a42" +rollup-plugin-copy@^0.2.3: + version "0.2.3" + resolved "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-0.2.3.tgz#dac1ab81d1f220baeb98e5c4c0108252e1edbb98" dependencies: - chalk "^2.3.2" - cpy "^6.0.0" - lodash.isobject "^3.0.2" - mkdirp "^0.5.1" + colors "^1.1.2" + fs-extra "^3.0.0" rollup-plugin-filesize@^1.5.0: version "1.5.0" @@ -5672,7 +5655,7 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" -"safer-buffer@>= 2.1.2 < 3": +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2: version "2.1.2" resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -5904,13 +5887,14 @@ sprintf-js@~1.0.2: resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" sshpk@^1.7.0: - version "1.14.1" - resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz#130f5975eddad963f1d56f92b9ac6c51fa9f83eb" + version "1.14.2" + resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz#c6fc61648a3d9c4e764fd3fcdf4ea105e492ba98" dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" dashdash "^1.12.0" getpass "^0.1.1" + safer-buffer "^2.0.2" optionalDependencies: bcrypt-pbkdf "^1.0.0" ecc-jsbn "~0.1.1" @@ -6090,8 +6074,8 @@ term-size@^1.2.0: execa "^0.7.0" terser@^3.7.5: - version "3.7.5" - resolved "https://registry.npmjs.org/terser/-/terser-3.7.5.tgz#b18090210794c79a5774bc1f0ebe80fb877a31bd" + version "3.7.6" + resolved "https://registry.npmjs.org/terser/-/terser-3.7.6.tgz#0b3c609f22278c089780ac1cdc63627071e3b96a" dependencies: commander "~2.14.1" source-map "~0.6.1" @@ -6173,7 +6157,14 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" -tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.3.3: +tough-cookie@>=2.3.3, tough-cookie@^2.3.3: + version "2.4.2" + resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.2.tgz#aa9133154518b494efab98a58247bfc38818c00c" + dependencies: + psl "^1.1.24" + punycode "^1.4.1" + +tough-cookie@~2.3.3: version "2.3.4" resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" dependencies: @@ -6233,8 +6224,8 @@ uglify-js@^2.6: uglify-to-browserify "~1.0.0" uglify-js@^3.3.25: - version "3.3.28" - resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.28.tgz#0efb9a13850e11303361c1051f64d2ec68d9be06" + version "3.4.0" + resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.0.tgz#796762282b5b5f0eafe7d5c8c708d1d7bd5ba11d" dependencies: commander "~2.15.0" source-map "~0.6.1" @@ -6328,8 +6319,8 @@ url-parse-lax@^1.0.0: prepend-http "^1.0.1" url-parse@^1.1.8, url-parse@~1.4.0: - version "1.4.0" - resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.4.0.tgz#6bfdaad60098c7fe06f623e42b22de62de0d3d75" + version "1.4.1" + resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.4.1.tgz#4dec9dad3dc8585f862fed461d2e19bbf623df30" dependencies: querystringify "^2.0.0" requires-port "^1.0.0"