diff --git a/.gitignore b/.gitignore index d8b362efc..3d06bab7e 100644 --- a/.gitignore +++ b/.gitignore @@ -56,4 +56,4 @@ vendor/github.com/ugorji/go/codec/codecgen/bin/* client/build-external/* prog/staticui/* prog/externalui/* -client/dist +client/pkg diff --git a/Makefile b/Makefile index c6928a28c..e30aaedcf 100644 --- a/Makefile +++ b/Makefile @@ -167,6 +167,9 @@ ui-upload: client/build-external/index.html AWS_SECRET_ACCESS_KEY=$$UI_BUCKET_KEY_SECRET \ aws s3 cp client/build-external/ s3://static.weave.works/scope-ui/ --recursive --exclude '*.html' +ui-build-pkg: + cd client && npm run build-pkg && npm run s3-publish + clean: $(GO) clean ./... # Don't actually rmi the build images - rm'ing the .uptodate files is enough to ensure diff --git a/circle.yml b/circle.yml index 47ed292d7..5555fa4b0 100644 --- a/circle.yml +++ b/circle.yml @@ -75,7 +75,8 @@ deployment: )) && docker push ${DOCKER_ORGANIZATION:-$DOCKER_USER}/scope && docker push ${DOCKER_ORGANIZATION:-$DOCKER_USER}/scope:$(./tools/image-tag) && - (test -z "${UI_BUCKET_KEY_ID}" || make ui-upload) + (test -z "${UI_BUCKET_KEY_ID}" || make ui-upload) && + make ui-build-pkg ) - | test -z "${QUAY_USER}" || ( diff --git a/client/.gitignore b/client/.gitignore index 7bea36508..ccd631864 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -2,4 +2,4 @@ node_modules build/ coverage/ test/*png -*.tgz +weave-scope.tgz diff --git a/client/Dockerfile b/client/Dockerfile index 085649e41..c06827e56 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,6 +1,6 @@ FROM node:6.9.0 WORKDIR /home/weave -COPY package.json post-install /home/weave/ +COPY package.json /home/weave/ ENV NPM_CONFIG_LOGLEVEL=warn NPM_CONFIG_PROGRESS=false RUN npm install COPY webpack.local.config.js webpack.production.config.js server.js .babelrc .eslintrc .eslintignore /home/weave/ diff --git a/client/package.json b/client/package.json index c811a738b..4e0129a40 100644 --- a/client/package.json +++ b/client/package.json @@ -90,8 +90,8 @@ "scripts": { "build": "webpack --config webpack.production.config.js", "build-external": "EXTERNAL=true webpack --config webpack.production.config.js", - "build-pkg": "babel app/scripts --ignore __tests__ --out-dir dist && cp -R app/styles dist", - "install": "./post-install", + "build-pkg": "babel app/scripts --ignore __tests__ --out-dir pkg && cp package.json pkg/ && cp -R app/styles pkg/", + "bundle": "npm pack pkg && mv weave-scope-$npm_package_version.tgz weave-scope.tgz", "start": "node server.js", "start-production": "NODE_ENV=production node server.js", "test": "jest", @@ -100,7 +100,7 @@ "clean": "rm build/app.js", "noprobe": "../scope stop && ../scope launch --no-probe --app.window 8760h", "loadreport": "npm run noprobe && sleep 1 && curl -X POST -H \"Content-Type: application/json\" http://$BACKEND_HOST/api/report -d", - "s3-publish" : "npm pack && aws s3 cp weave-scope-*.tgz s3://weaveworks-npm-modules/weave-scope/ --acl public-read" + "s3-publish": "aws s3 cp weave-scope.tgz s3://weaveworks-npm-modules/weave-scope/ --acl public-read" }, "jest": { "transform": { diff --git a/client/post-install b/client/post-install deleted file mode 100755 index 2297fa253..000000000 --- a/client/post-install +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -pwd=$(pwd) -if [[ $pwd == *"node_modules"* ]]; then - echo "Installed as Node module. Building package..." - npm run build-pkg - else - echo "Installed as stand-alone UI. Skipped building package" -fi