diff --git a/frontend/Makefile b/frontend/Makefile index 5649f17e..f86c9295 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -9,16 +9,15 @@ UI := $(shell pwd)/../ui install: yarn install --prefer-offline -.PHONY: install-production -install-production: compile clean - yarn install --production --pure-lockfile --prefer-offline - .PHONY: clean clean: @rm -rf node_modules ui: +ifeq ($(BUILD),production) +else $(MAKE) compile -C $(UI) +endif .PHONY: test test: ui @@ -34,7 +33,11 @@ test-ci: ui .PHONY: compile compile: ui install +ifeq ($(BUILD),production) NODE_ENV=production $(bindir)/webpack --config webpack/index.js +else + $(bindir)/webpack --config webpack/index.js +endif .PHONY: build build: diff --git a/frontend/package.json b/frontend/package.json index b601f987..3861220e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -19,6 +19,7 @@ "clean-static": "git check-ignore static/** | xargs rm" }, "dependencies": { + "@tomgco/joyent-portal-ui": "alpha", "constant-case": "^2.0.0", "force-array": "^3.1.0", "hapi": "^16.1.0", diff --git a/frontend/server/index.html b/frontend/server/index.html index 0e4aa3aa..2faca297 100644 --- a/frontend/server/index.html +++ b/frontend/server/index.html @@ -7,6 +7,6 @@
- + diff --git a/frontend/webpack/paths.js b/frontend/webpack/paths.js index 82cce528..1d154de0 100644 --- a/frontend/webpack/paths.js +++ b/frontend/webpack/paths.js @@ -12,6 +12,8 @@ module.exports = { path.join(UI, 'node_modules'), ], FRONTEND: path.join(FRONTEND, 'src'), - UI: path.join(UI, 'src'), + UI: process.env.NODE_ENV === 'production' + ? path.join(FRONTEND, 'node_modules', '@tomgco/joyent-portal-ui', 'dist') + : path.join(UI, 'src'), STATIC: path.join(FRONTEND, 'static') }; diff --git a/frontend/webpack/production.js b/frontend/webpack/production.js index 48df216c..392f4a00 100644 --- a/frontend/webpack/production.js +++ b/frontend/webpack/production.js @@ -1,13 +1,16 @@ -// const plugins = require('./plugins'); +const plugins = require('./plugins'); const base = require('./base'); module.exports = Object.assign(base, { devtool: 'hidden-source-map', + entry: [ + base.entry + ], plugins: base.plugins.concat([ - // plugins['occurrence-order'], - // plugins['aggressive-merging'], - // plugins['uglify-js'] + plugins['occurrence-order'], + plugins['aggressive-merging'], + plugins['uglify-js'] ]) }); diff --git a/frontend/yarn.lock b/frontend/yarn.lock index cebec068..77a47c77 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -2,6 +2,25 @@ # yarn lockfile v1 +"@tomgco/joyent-portal-ui@alpha": + version "0.0.1-397" + resolved "https://registry.yarnpkg.com/@tomgco/joyent-portal-ui/-/joyent-portal-ui-0.0.1-397.tgz#c57752cc168882666f603f660a13beecd4c3c757" + dependencies: + color "^1.0.3" + lodash.find "^4.6.0" + lodash.first "^3.0.0" + lodash.flatten "^4.4.0" + lodash.get "^4.4.2" + lodash.isfunction "^3.0.8" + lodash.isstring "^4.0.1" + lodash.isundefined "^3.0.1" + param-case "^2.1.0" + random-natural "^1.0.3" + react "^15.4.1" + react-dom "^15.4.1" + reduce-css-calc "^1.3.0" + styled-components "^1.2.1" + abab@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d" @@ -1184,7 +1203,7 @@ babylon@^6.1.0, babylon@^6.11.0, babylon@^6.13.0, babylon@^6.3.26: version "6.14.1" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.14.1.tgz#956275fab72753ad9b3435d7afe58f8bf0a29815" -balanced-match@^0.4.1: +balanced-match@^0.4.1, balanced-match@^0.4.2: version "0.4.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" @@ -1531,6 +1550,10 @@ circular-json@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" +clamp@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/clamp/-/clamp-1.0.1.tgz#66a0e64011816e37196828fdc8c8c147312c8634" + clean-yaml-object@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/clean-yaml-object/-/clean-yaml-object-0.1.0.tgz#63fb110dc2ce1a84dc21f6d9334876d010ae8b68" @@ -1590,6 +1613,30 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +color-convert@^1.8.2: + version "1.8.2" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.8.2.tgz#be868184d7c8631766d54e7078e2672d7c7e3339" + dependencies: + color-name "^1.1.1" + +color-name@^1.0.0, color-name@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" + +color-string@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.4.0.tgz#2b47f8565fb0eb52f9f77c801992b8ca55d6e898" + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + +color@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/color/-/color-1.0.3.tgz#e48e832d85f14ef694fb468811c2d5cfe729b55d" + dependencies: + color-convert "^1.8.2" + color-string "^1.4.0" + colors@0.5.x: version "0.5.1" resolved "https://registry.yarnpkg.com/colors/-/colors-0.5.1.tgz#7d0023eaeb154e8ee9fce75dcb923d0ed1667774" @@ -3128,6 +3175,10 @@ is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" +is-arrayish@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.1.tgz#c2dfc386abaa0c3e33c48db3fe87059e69065efd" + is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" @@ -3229,6 +3280,10 @@ is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4: jsonpointer "^4.0.0" xtend "^4.0.0" +is-nil@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-nil/-/is-nil-1.0.1.tgz#2daba29e0b585063875e7b539d071f5b15937969" + is-npm@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" @@ -3243,6 +3298,10 @@ is-obj@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" +is-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.1.tgz#8952688c5ec2ffd6b03ecc85e769e02903083470" + is-observable@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-0.2.0.tgz#b361311d83c6e5d726cabf5e250b0237106f5ae2" @@ -3639,6 +3698,10 @@ lodash.find@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1" +lodash.first@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash.first/-/lodash.first-3.0.0.tgz#5dae180d7f818ee65fc5b210b104a7bbef98a16a" + lodash.flatten@^4.2.0, lodash.flatten@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" @@ -3651,6 +3714,10 @@ lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" +lodash.indexof@^4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/lodash.indexof/-/lodash.indexof-4.0.5.tgz#53714adc2cddd6ed87638f893aa9b6c24e31ef3c" + lodash.isempty@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e" @@ -3659,6 +3726,18 @@ lodash.isequal@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.4.0.tgz#6295768e98e14dc15ce8d362ef6340db82852031" +lodash.isfunction@^3.0.8: + version "3.0.8" + resolved "https://registry.yarnpkg.com/lodash.isfunction/-/lodash.isfunction-3.0.8.tgz#4db709fc81bc4a8fd7127a458a5346c5cdce2c6b" + +lodash.isstring@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" + +lodash.isundefined@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash.isundefined/-/lodash.isundefined-3.0.1.tgz#23ef3d9535565203a66cefd5b830f848911afb48" + lodash.map@^4.4.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3" @@ -3754,6 +3833,16 @@ matcher@^0.1.1: dependencies: escape-string-regexp "^1.0.4" +math-expression-evaluator@^1.2.14: + version "1.2.14" + resolved "https://registry.yarnpkg.com/math-expression-evaluator/-/math-expression-evaluator-1.2.14.tgz#39511771ed9602405fba9affff17eb4d2a3843ab" + dependencies: + lodash.indexof "^4.0.5" + +max-safe-int@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/max-safe-int/-/max-safe-int-1.0.0.tgz#44fba8ec993ded91fb2c5a35e71cf9c9f369ce52" + max-timeout@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/max-timeout/-/max-timeout-1.0.0.tgz#b68f69a2f99e0b476fd4cb23e2059ca750715e1f" @@ -4633,6 +4722,21 @@ randexp@^0.4.2: discontinuous-range "1.0.0" ret "~0.1.10" +random-integral@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/random-integral/-/random-integral-1.0.3.tgz#8ff3c117565c9a04b66ddd559f3aed29bd0f0f6c" + dependencies: + clamp "^1.0.1" + max-safe-int "^1.0.0" + to-integer "^1.0.1" + +random-natural@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/random-natural/-/random-natural-1.0.3.tgz#ef28615b03c2cb71aaebf7f24f487266a443c5c0" + dependencies: + max-safe-int "^1.0.0" + random-integral "^1.0.3" + randomatic@^1.1.3: version "1.1.6" resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.6.tgz#110dcabff397e9dcff7c0789ccc0a49adf1ec5bb" @@ -4839,6 +4943,20 @@ redent@^1.0.0: indent-string "^2.1.0" strip-indent "^1.0.1" +reduce-css-calc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz#747c914e049614a4c9cfbba629871ad1d2927716" + dependencies: + balanced-match "^0.4.2" + math-expression-evaluator "^1.2.14" + reduce-function-call "^1.0.1" + +reduce-function-call@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/reduce-function-call/-/reduce-function-call-1.0.2.tgz#5a200bf92e0e37751752fe45b0ab330fd4b6be99" + dependencies: + balanced-match "^0.4.2" + reduce-reducers@^0.1.0, reduce-reducers@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/reduce-reducers/-/reduce-reducers-0.1.2.tgz#fa1b4718bc5292a71ddd1e5d839c9bea9770f14b" @@ -5175,6 +5293,12 @@ simple-mock@^0.7.3: version "0.7.3" resolved "https://registry.yarnpkg.com/simple-mock/-/simple-mock-0.7.3.tgz#461c9e6f1c339cc49a7871b390676cd064388036" +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" + dependencies: + is-arrayish "^0.3.1" + slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" @@ -5484,8 +5608,8 @@ tap-parser@~1.2.2: readable-stream "^2" tap-xunit@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/tap-xunit/-/tap-xunit-1.5.0.tgz#681d141aa0f2ffa252ad2daaf7d70f85d7555b3b" + version "1.5.1" + resolved "https://registry.yarnpkg.com/tap-xunit/-/tap-xunit-1.5.1.tgz#e58e6d26f5896a87cdc6ffbb146dd8c1f418a8a6" dependencies: duplexer "~0.1.1" minimist "~1.2.0" @@ -5581,6 +5705,15 @@ to-fast-properties@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" +to-integer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/to-integer/-/to-integer-1.0.1.tgz#511ad41dce6a93730a8f3b6e35a164fd829464da" + dependencies: + is-function "^1.0.1" + is-nil "^1.0.0" + is-object "^1.0.1" + is-symbol "^1.0.1" + topo@2.x.x: version "2.0.2" resolved "https://registry.yarnpkg.com/topo/-/topo-2.0.2.tgz#cd5615752539057c0dc0491a621c3bc6fbe1d182"