diff --git a/.gcloudignore b/.gcloudignore new file mode 100644 index 00000000..83973d3e --- /dev/null +++ b/.gcloudignore @@ -0,0 +1,20 @@ +# This file specifies files that are *not* uploaded to Google Cloud Platform +# using gcloud. It follows the same syntax as .gitignore, with the addition of +# "#!include" directives (which insert the entries of the given .gitignore-style +# file at that point). +# +# For more information, run: +# $ gcloud topic gcloudignore +# +.gcloudignore +# If you would like to upload your .git directory, .gitignore file or files +# from your .gitignore file, remove the corresponding line +# below: + +.git +.gitignore +Dockerfile +public/css + +# Node.js dependencies: +node_modules/ \ No newline at end of file diff --git a/app.yaml b/app.yaml new file mode 100644 index 00000000..b6f72df7 --- /dev/null +++ b/app.yaml @@ -0,0 +1,2 @@ +runtime: nodejs10 +instance_class: F4 \ No newline at end of file diff --git a/bin/install_customizations b/bin/install_customizations index 1b41777c..f1b9e30e 100755 --- a/bin/install_customizations +++ b/bin/install_customizations @@ -1,7 +1,11 @@ #!/usr/bin/env bash +if [[ -f ./.env ]]; + then + echo "sourcing env vars" + source ./.env +fi echo "Checking for CUSTOMIZATION_GIT_REPO environment variable..." - if ! [[ -z ${CUSTOMIZATION_GIT_REPO} ]]; then echo "Cloning custom repo..."; diff --git a/bin/update_gae_pkg b/bin/update_gae_pkg new file mode 100755 index 00000000..ffd715dd --- /dev/null +++ b/bin/update_gae_pkg @@ -0,0 +1,23 @@ +#!/usr/bin/env node + +const fs = require('fs') +const path = require('path') + +const pkgPath = path.join(__dirname, '../package.json') +// load the custom pkg json +let customPkg = { dependencies: {} } +try { + customPkg = require('../custom/package.json') +} catch (err) { + console.warn('Could not load custom Pkg, aborting', err) + process.exit(1) +} +// load the normal pkg json +const pkg = require(pkgPath) + +const {dotenv} = pkg.devDependencies +// update the start config to use .env, add as normal dep +pkg.scripts.start = `node -r dotenv/config server/index` +pkg.dependencies = Object.assign({}, pkg.dependencies, {dotenv}, customPkg.dependencies) + +fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 4)) diff --git a/package.json b/package.json index e1bd2531..d7ec6a69 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,8 @@ "watch": "concurrently \"nodemon --inspect=0.0.0.0 -r dotenv/config -e js,ejs server/index.js\" \"nodemon -e scss --watch styles --watch custom/styles -x npm run build\"", "test": "NODE_ENV=test mocha test/**/*.test.js -r ./test/utils/bootstrap.js --recursive --exit", "test:cover": "NODE_ENV=test nyc --include=server/** --reporter=html --reporter=text mocha test/**/*.test.js -r ./test/utils/bootstrap.js --recursive --exit", - "lint": "eslint ./server" + "lint": "eslint ./server", + "gcp-build": "./bin/install_customizations && npm run build && ./bin/update_gae_pkg" }, "repository": { "type": "git",