Add make target to deploy to Firebase
The configuration file has been split into 2: one for development mode
and another one for production mode.
Change-Id: I12917cd79c95642adc30004be5bc1a927bca389b
diff --git a/frontend/Makefile b/frontend/Makefile
index fc3d69e..b904f82 100644
--- a/frontend/Makefile
+++ b/frontend/Makefile
@@ -1,6 +1,21 @@
-.PHONY: serve
+.PHONY: serve deploy build_js
WEBPACK := ./node_modules/webpack-cli/bin/cli.js
serve:
$(WEBPACK) serve --mode development
+
+node_deps:
+ npm ci --no-save
+
+clean_deps:
+ rm -rf node_modules
+
+deps: node_deps
+ rm -rf dist
+
+build_js:
+ $(WEBPACK) --mode production
+
+deploy: deps build_js
+ firebase deploy --only hosting:twpt-dashboard
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index dc4ddc1..a2e638a 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -1,7 +1,7 @@
<script>
import {mapGetters} from 'vuex';
-import config from './config.json5';
+import config from './config.js';
import GsiButton from './GsiButton.vue';
export default {
diff --git a/frontend/src/GsiButton.vue b/frontend/src/GsiButton.vue
index 01cd924..7cb9f1d 100644
--- a/frontend/src/GsiButton.vue
+++ b/frontend/src/GsiButton.vue
@@ -1,5 +1,5 @@
<script>
-import config from './config.json5';
+import config from './config.js';
export default {
mounted() {
diff --git a/frontend/src/config.dev.json5 b/frontend/src/config.dev.json5
new file mode 100644
index 0000000..07bff27
--- /dev/null
+++ b/frontend/src/config.dev.json5
@@ -0,0 +1,8 @@
+{
+ // Details for the Sign In with Google functionality
+ google: {
+ clientId: '223047594100-ha7istt4csc0mlq11heogk7bqvmpbqo0.apps.googleusercontent.com',
+ },
+ // URL of the GRPC host
+ grpcWebHost: 'http://localhost:8081'
+}
diff --git a/frontend/src/config.js b/frontend/src/config.js
new file mode 100644
index 0000000..7db9da0
--- /dev/null
+++ b/frontend/src/config.js
@@ -0,0 +1,5 @@
+import configDev from './config.dev.json5';
+import configProd from './config.json5';
+
+const config = PRODUCTION ? configProd : configDev;
+export default config;
diff --git a/frontend/src/config.json5 b/frontend/src/config.json5
index 07bff27..3d26583 100644
--- a/frontend/src/config.json5
+++ b/frontend/src/config.json5
@@ -4,5 +4,5 @@
clientId: '223047594100-ha7istt4csc0mlq11heogk7bqvmpbqo0.apps.googleusercontent.com',
},
// URL of the GRPC host
- grpcWebHost: 'http://localhost:8081'
+ grpcWebHost: 'https://twpt-grpc-web.avm99963.com'
}
diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js
index 7287e6c..005f361 100644
--- a/frontend/webpack.config.js
+++ b/frontend/webpack.config.js
@@ -1,3 +1,4 @@
+const webpack = require('webpack');
const path = require('path')
const json5 = require('json5');
const {VueLoaderPlugin} = require('vue-loader');
@@ -47,6 +48,9 @@
filename: 'index.html',
template: 'index.html',
}),
+ new webpack.DefinePlugin({
+ 'PRODUCTION': args.mode == 'production',
+ }),
],
devServer: {
static: './dist',