From c69817786e35428348a0b1d8a2ba8b1577b34a43 Mon Sep 17 00:00:00 2001
From: Tom Robinson <tlrobinson@gmail.com>
Date: Thu, 11 Aug 2016 12:39:14 -0700
Subject: [PATCH] Move npm install into circle dependencies

---
 bin/build  | 21 ++++++++++++---------
 bin/ci     |  4 ++--
 circle.yml |  2 +-
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/bin/build b/bin/build
index 5bc52d532c6..dc7cbd4e258 100755
--- a/bin/build
+++ b/bin/build
@@ -17,16 +17,19 @@ version() {
     fi
 }
 
-frontend() {
-    if [ -z ${WEBPACK_OPTS+x} ]; then
-        WEBPACK_OPTS="-p"
-    fi
-
+npm-install() {
     echo "Running 'npm install' to download javascript dependencies..." &&
-    npm install &&
+    npm install
+}
+
+frontend() {
+    echo "Running 'webpack -p' to assemble and minify frontend assets..." &&
+    ./node_modules/.bin/webpack -p
+}
 
-    echo "Running 'webpack $WEBPACK_OPTS' to assemble and minify frontend assets..." &&
-    ./node_modules/.bin/webpack $WEBPACK_OPTS
+frontend-fast() {
+    echo "Running 'webpack' to assemble and minify frontend assets..." &&
+    ./node_modules/.bin/webpack --devtool eval
 }
 
 sample-dataset() {
@@ -44,7 +47,7 @@ uberjar() {
 }
 
 all() {
-    version && frontend && sample-dataset && uberjar
+    version && npm-install && frontend && sample-dataset && uberjar
 }
 
 # Default to running all but let someone specify one or more sub-tasks to run instead if desired
diff --git a/bin/ci b/bin/ci
index 0d287df1c7c..da9bce0bff1 100755
--- a/bin/ci
+++ b/bin/ci
@@ -6,6 +6,6 @@ case $CIRCLE_NODE_INDEX in
     2) ENGINES=h2,postgres,sqlite,crate MB_DB_TYPE=mysql MB_DB_DBNAME=circle_test MB_DB_PORT=3306 MB_DB_USER=ubuntu MB_DB_HOST=localhost lein test ;;
     3) ENGINES=h2,redshift,druid lein test ;;
     4) lein eastwood && lein bikeshed && lein docstring-checker && ./bin/reflection-linter ;;
-    5) npm install && npm run lint && npm run test ;;
-    6) WEBPACK_OPTS="" ./bin/build && npm run test-e2e ;;
+    5) npm run lint && npm run test ;;
+    6) ./bin/build version frontend-fast sample-dataset uberjar && npm run test-e2e ;;
 esac
diff --git a/circle.yml b/circle.yml
index 4ad14e9b7dc..26dd9184361 100644
--- a/circle.yml
+++ b/circle.yml
@@ -24,8 +24,8 @@ dependencies:
     - sudo service crate restart
     - lein deps
     - pip install awscli==1.7.3
-    - npm cache clean
     - npm install -g npm@2.15.9
+    - npm install
 database:
   post:
     # MySQL doesn't load named timezone information automatically, you have to run this command to load it
-- 
GitLab