This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 166
Update to use express for heroku reviews app #326
Merged
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
bcc0784
Add express to run server
windse7en 2725fac
Fixed lint error
windse7en db63e29
Add the logic to check if there is need to rebuild
windse7en 9fa006c
Move build to postbuild
windse7en 1b428ba
Update the app.js
windse7en a629ed6
Update to new script with development
windse7en 9f2a0c0
Add README to explain start:express script
windse7en f4e967f
Merge branch 'master' into heroku-memory-update
bjankord efc3a6a
Remove PORT config for start script
windse7en 1f88f57
Merge branch 'heroku-memory-update' of https://github.com/cerner/terr…
windse7en 9e20e30
Merge branch 'master' into heroku-memory-update
bjankord a2a0891
Merge branch 'master' into heroku-memory-update
mjhenkes ef1180f
Merge branch 'master' into heroku-memory-update
mjhenkes 5bf51b7
Merge branch 'master' into heroku-memory-update
bjankord a222efd
Merge branch 'master' into heroku-memory-update
windse7en File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: npm run start:express |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ | |
"version": "0.1.0", | ||
"description": "terra-core", | ||
"engines": { | ||
"node": "6.9.4" | ||
}, | ||
"node": "6.9.4" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/cerner/terra-core.git" | ||
|
@@ -42,6 +42,7 @@ | |
"clean:install": "npm run clean:all && npm install", | ||
"clean:obsolete-snapshots": "npm test -- -u", | ||
"compile": "lerna run compile", | ||
"compile:prod": "cd packages/terra-site && npm run compile:prod", | ||
"deploy": "lerna run --scope terra-site deploy", | ||
"heroku-prebuild": "npm install -g [email protected]", | ||
"heroku-postbuild": "npm install --only=dev", | ||
|
@@ -54,6 +55,7 @@ | |
"pretest": "npm run lint", | ||
"postinstall": "npm run bootstrap", | ||
"start": "cd packages/terra-site && npm run start", | ||
"start:express": "node scripts/express/app.js", | ||
"test": "npm run jest && npm run test:nightwatch-default", | ||
"test:nightwatch-default": "node ./packages/terra-toolkit/lib/scripts/nightwatch-process.js --env default-tiny,default-small,default-medium,default-large,default-huge,default-enormous" | ||
}, | ||
|
@@ -72,6 +74,7 @@ | |
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^3.0.2", | ||
"eslint-plugin-react": "^6.9.0", | ||
"express": "^4.15.2", | ||
"glob": "^7.1.1", | ||
"husky": "^0.13.1", | ||
"identity-obj-proxy": "^3.0.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
/* eslint-disable no-console */ | ||
const express = require('express'); | ||
const path = require('path'); | ||
const shell = require('shelljs'); | ||
|
||
const app = express(); | ||
const port = process.env.PORT || 8081; | ||
// npm script to build assets by webpack | ||
const buildCommand = 'npm run compile:prod'; | ||
// path to webpack built path | ||
const buildPath = path.join(__dirname, '../../packages/terra-site/build'); | ||
|
||
// listen to PORT to avoid Heroku error: R10 boot timeout | ||
app.listen(port); | ||
console.log(`Listening ${port}`); | ||
|
||
if (!shell.test('-d', buildPath)) { | ||
if (shell.exec(buildCommand).code !== 0) { | ||
console.log(`Errors in command: ${buildCommand}`); | ||
process.exit(1); | ||
} else { | ||
console.log(`Finished command: ${buildCommand}`); | ||
} | ||
} | ||
|
||
app.use('/static', express.static(buildPath)); | ||
app.get('/', (req, res) => res.redirect('/static')); | ||
console.log('Switched to built assets.'); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still want to build out our review apps with a dev environment so we get the additional warnings. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, I'm fine with dev environment with production webpack. As webpack will eat a lot of memories, more dev features will make reviews app more unstable. I'd like to add more features if we can reduce the memory cost with webpack compile.