From dd8c4039c334001b46fdcd907c4244a409e4f6ba Mon Sep 17 00:00:00 2001 From: Alexis King Date: Wed, 28 Aug 2019 07:40:42 -0500 Subject: [PATCH 1/3] console: Fix server-build script on first run Previously, the `rm static/dist/versioned/*.gz` step would fail on the first run, since the glob would match no files, and `rm` would complain. This approach just deletes the whole directory, which is probably better, anyway, since it avoids any lingering outdated files. --- console/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console/package.json b/console/package.json index be92ede091a36..20439cbf2dc72 100644 --- a/console/package.json +++ b/console/package.json @@ -15,7 +15,7 @@ "start": "concurrently --kill-others \"npm run start-prod\"", "start-prod": "better-npm-run start-prod", "build": "webpack --progress -p --colors --display-error-details --config webpack/prod.config.js", - "server-build": "npm run build && mkdir -p static/dist/versioned && cp static/dist/*.js static/dist/*.css static/dist/versioned/ && rm static/dist/versioned/*.gz && gzip -r -f static/dist/versioned", + "server-build": "npm run build && rm -rf static/dist/versioned && mkdir -p static/dist/versioned && cp static/dist/*.js static/dist/*.css static/dist/versioned/ && gzip -r -f static/dist/versioned", "build-unused": "webpack --verbose --colors --display-error-details --config webpack/prod.config.js --json | webpack-unused -s src", "postinstall": "webpack --display-error-details --config webpack/prod.config.js", "lint": "eslint -c .eslintrc src api", From 36e56239022615b3f856911ca4ff96b0636eaaf7 Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Tue, 24 Sep 2019 18:38:17 +0530 Subject: [PATCH 2/3] add server-build script to makefile --- community/sample-apps/realtime-poll/src/apollo.js | 2 +- console/Makefile | 14 ++++++++++++++ console/package.json | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/community/sample-apps/realtime-poll/src/apollo.js b/community/sample-apps/realtime-poll/src/apollo.js index e31fde15ad8a0..8d98ffbb9604c 100644 --- a/community/sample-apps/realtime-poll/src/apollo.js +++ b/community/sample-apps/realtime-poll/src/apollo.js @@ -9,7 +9,7 @@ import { getMainDefinition } from 'apollo-utilities'; import { InMemoryCache } from 'apollo-cache-inmemory'; -export const HASURA_GRAPHQL_ENGINE_HOSTNAME = 'realtime-poll.demo.hasura.app'; +export const HASURA_GRAPHQL_ENGINE_HOSTNAME = 'hasura-pro-demo.herokuapp.com'; const scheme = (proto) => { return window.location.protocol === 'https:' ? `${proto}s` : proto; diff --git a/console/Makefile b/console/Makefile index 80a2195c0ee25..22856f5f79518 100644 --- a/console/Makefile +++ b/console/Makefile @@ -39,3 +39,17 @@ gcloud-set-metadata: 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 gsutil setmeta -h "Content-Encoding: gzip" gs://$(BUCKET_NAME)/console/$(VERSION)/* + + +server-build: + if [ ! -d "$(DIST_PATH)/common" ]; then \ + mkdir -p $(DIST_PATH); \ + gsutil -m cp -r gs://$(BUCKET_NAME)/console/assets/common "$(DIST_PATH)"; \ + mv "$(DIST_PATH)/common/css/font-awesome.min.css.gz" "$(DIST_PATH)/common/css/font-awesome.min.css"; \ + gzip "$(DIST_PATH)/common/css/font-awesome.min.css"; \ + fi + rm -rf "$(DIST_PATH)/versioned" + npm run build + mkdir -p "$(DIST_PATH)/versioned" + cp "$(DIST_PATH)"/*.js "$(DIST_PATH)"/*.css "$(DIST_PATH)/versioned/" + gzip -r -f "$(DIST_PATH)/versioned" diff --git a/console/package.json b/console/package.json index 20439cbf2dc72..687e1e81d1b02 100644 --- a/console/package.json +++ b/console/package.json @@ -15,7 +15,7 @@ "start": "concurrently --kill-others \"npm run start-prod\"", "start-prod": "better-npm-run start-prod", "build": "webpack --progress -p --colors --display-error-details --config webpack/prod.config.js", - "server-build": "npm run build && rm -rf static/dist/versioned && mkdir -p static/dist/versioned && cp static/dist/*.js static/dist/*.css static/dist/versioned/ && gzip -r -f static/dist/versioned", + "server-build": "make server-build", "build-unused": "webpack --verbose --colors --display-error-details --config webpack/prod.config.js --json | webpack-unused -s src", "postinstall": "webpack --display-error-details --config webpack/prod.config.js", "lint": "eslint -c .eslintrc src api", From c06ae4a44746fe548e3161de7659ea80ba2f70a9 Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Tue, 24 Sep 2019 18:39:25 +0530 Subject: [PATCH 3/3] remove un-necessary change --- community/sample-apps/realtime-poll/src/apollo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/community/sample-apps/realtime-poll/src/apollo.js b/community/sample-apps/realtime-poll/src/apollo.js index 8d98ffbb9604c..e31fde15ad8a0 100644 --- a/community/sample-apps/realtime-poll/src/apollo.js +++ b/community/sample-apps/realtime-poll/src/apollo.js @@ -9,7 +9,7 @@ import { getMainDefinition } from 'apollo-utilities'; import { InMemoryCache } from 'apollo-cache-inmemory'; -export const HASURA_GRAPHQL_ENGINE_HOSTNAME = 'hasura-pro-demo.herokuapp.com'; +export const HASURA_GRAPHQL_ENGINE_HOSTNAME = 'realtime-poll.demo.hasura.app'; const scheme = (proto) => { return window.location.protocol === 'https:' ? `${proto}s` : proto;