Skip to content

Commit

Permalink
support app engine pathway
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacwhite committed Mar 19, 2019
1 parent eb14a86 commit 4483dec
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -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/
2 changes: 2 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
runtime: nodejs10
instance_class: F4
6 changes: 5 additions & 1 deletion bin/install_customizations
Original file line number Diff line number Diff line change
@@ -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...";
Expand Down
23 changes: 23 additions & 0 deletions bin/update_gae_pkg
Original file line number Diff line number Diff line change
@@ -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))
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 4483dec

Please sign in to comment.