2018-06-29 14:51:00 +03:00
|
|
|
export PATH := node_modules/.bin:$(PATH)
|
2018-07-10 13:01:02 +03:00
|
|
|
DIST_PATH ?= ./static/dist
|
2018-07-03 20:10:13 +03:00
|
|
|
BUCKET_NAME ?= hasura-graphql-engine
|
|
|
|
VERSION ?= $(shell ../scripts/get-version.sh)
|
2018-06-29 14:51:00 +03:00
|
|
|
|
2018-07-11 09:49:03 +03:00
|
|
|
all: deps build gzip-assets gcloud-cp-stable gcloud-set-metadata
|
2018-06-29 14:51:00 +03:00
|
|
|
|
|
|
|
deps:
|
2018-07-10 13:01:02 +03:00
|
|
|
npm install
|
|
|
|
|
|
|
|
ci-deps:
|
|
|
|
if [ ! -d "node_modules" ]; then npm ci; fi
|
2018-06-29 14:51:00 +03:00
|
|
|
|
|
|
|
build:
|
|
|
|
npm run build
|
|
|
|
|
|
|
|
test:
|
2018-07-11 08:00:27 +03:00
|
|
|
npm run dev & npm run test
|
2018-06-29 14:51:00 +03:00
|
|
|
|
2018-07-11 09:49:03 +03:00
|
|
|
gzip-assets:
|
|
|
|
gzip $(DIST_PATH)/*.js
|
|
|
|
gzip $(DIST_PATH)/*.css
|
|
|
|
mv $(DIST_PATH)/main.js.gz $(DIST_PATH)/main.js
|
|
|
|
mv $(DIST_PATH)/vendor.js.gz $(DIST_PATH)/vendor.js
|
|
|
|
mv $(DIST_PATH)/main.css.gz $(DIST_PATH)/main.css
|
|
|
|
|
2018-07-10 13:01:02 +03:00
|
|
|
# to be run inside circle-ci
|
|
|
|
ci-copy-assets:
|
|
|
|
mkdir -p /build/_console_output
|
|
|
|
cp $(DIST_PATH)/* /build/_console_output/
|
|
|
|
echo "$(VERSION)" > /build/_console_output/version.txt
|
|
|
|
|
2018-06-29 14:51:00 +03:00
|
|
|
gcloud-cp-stable:
|
2018-07-03 20:10:13 +03:00
|
|
|
gsutil cp -r $(DIST_PATH)/main.css gs://$(BUCKET_NAME)/console/$(VERSION)/main.css
|
|
|
|
gsutil cp -r $(DIST_PATH)/main.js gs://$(BUCKET_NAME)/console/$(VERSION)/main.js
|
|
|
|
gsutil cp -r $(DIST_PATH)/vendor.js gs://$(BUCKET_NAME)/console/$(VERSION)/vendor.js
|
2018-06-29 14:51:00 +03:00
|
|
|
|
|
|
|
gcloud-set-metadata:
|
2018-07-03 20:10:13 +03:00
|
|
|
gsutil setmeta -h "Content-Type: application/javascript" gs://$(BUCKET_NAME)/console/$(VERSION)/*.js
|
|
|
|
gsutil setmeta -h "Content-Type: text/css" gs://$(BUCKET_NAME)/console/$(VERSION)/*.css
|
2018-07-11 09:49:03 +03:00
|
|
|
gsutil setmeta -h "Content-Encoding: gzip" gs://$(BUCKET_NAME)/console/$(VERSION)/*
|