diff --git a/Procfile b/Procfile index 6f86b16..2be5f80 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: node server.js \ No newline at end of file +web: yarn start diff --git a/package.json b/package.json index 4fd7e89..328fdb0 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,7 @@ "scripts": { "clean": "rimraf bundle.js bundle.js.map", "build": "webpack --config=webpack.config.js -p", - "postinstall": "$npm_execpath run clean && $npm_execpath run build", - "start": "node server.js", + "start": "([ -f .env ] || $npm_execpath run build) && node server.js", "dev": "webpack-dev-server --inline --hot", "lint": "$npm_execpath run lint:js && $npm_execpath run lint:markdown", "lint:js": "eslint --cache --ext .js,.jsx src *.js", diff --git a/server.js b/server.js index ffb2d94..4c4283f 100644 --- a/server.js +++ b/server.js @@ -10,6 +10,7 @@ app.use(bodyParser.json({ type: 'application/*+json' })); app.use(express.static(__dirname)); // Check if we're running on a local dev machine +// TODO: Remove use of .env. Change instructions to direct users to direnv if (fs.existsSync('./.env')) { // Load environment variables from .env require('dotenv').config();