-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
924 additions
and
87 deletions.
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/*.log | ||
node_modules/ | ||
/coverage/ | ||
/lib/ |
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 |
---|---|---|
@@ -1,32 +1,43 @@ | ||
{ | ||
"name": "your-project", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"start": "babel-node src", | ||
"test": "eslint src && flow && jest --coverage", | ||
"precommit": "yarn test", | ||
"prepush": "yarn test" | ||
}, | ||
"browserslist": [ | ||
"> 1%" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"babel-cli": "^6.24.0", | ||
"babel-eslint": "^7.2.1", | ||
"babel-jest": "^19.0.0", | ||
"babel-preset-env": "^1.2.2", | ||
"babel-preset-flow": "^6.23.0", | ||
"eslint": "^3.18.0", | ||
"eslint-config-airbnb": "^14.1.0", | ||
"eslint-plugin-compat": "^1.0.2", | ||
"eslint-plugin-flowtype": "^2.30.4", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^3.0.2 || ^4.0.0", | ||
"eslint-plugin-react": "^6.9.0", | ||
"flow-bin": "^0.42.0", | ||
"husky": "^0.13.3", | ||
"jest": "^19.0.2" | ||
} | ||
"name": "your-project", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"start": "yarn dev:start", | ||
"dev:start": "nodemon --ignore lib --exec babel-node src/server", | ||
"prod:build": "rimraf lib && babel src -d lib --ignore .test.js", | ||
"prod:start": "NODE_ENV=production pm2 start lib/server && pm2 logs", | ||
"prod:stop": "pm2 delete server", | ||
"test": "eslint src && flow && jest --coverage", | ||
"precommit": "yarn test", | ||
"prepush": "yarn test && yarn prod:build" | ||
}, | ||
"browserslist": [ | ||
"> 1%" | ||
], | ||
"dependencies": { | ||
"common-tags": "^1.4.0", | ||
"compression": "^1.6.2", | ||
"express": "^4.15.2" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.24.0", | ||
"babel-eslint": "^7.2.1", | ||
"babel-jest": "^19.0.0", | ||
"babel-preset-env": "^1.2.2", | ||
"babel-preset-flow": "^6.23.0", | ||
"eslint": "^3.18.0", | ||
"eslint-config-airbnb": "^14.1.0", | ||
"eslint-plugin-compat": "^1.0.2", | ||
"eslint-plugin-flowtype": "^2.30.4", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^3.0.2 || ^4.0.0", | ||
"eslint-plugin-react": "^6.9.0", | ||
"flow-bin": "^0.42.0", | ||
"husky": "^0.13.3", | ||
"jest": "^19.0.2", | ||
"nodemon": "^1.11.0", | ||
"pm2": "^2.4.4", | ||
"rimraf": "^2.6.1" | ||
} | ||
} |
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,9 @@ | ||
body { | ||
width: 960px; | ||
margin: auto; | ||
font-family: sans-serif; | ||
} | ||
|
||
h1 { | ||
color: limegreen; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
// @flow | ||
|
||
import compression from 'compression' | ||
import express from 'express' | ||
|
||
import { APP_NAME, STATIC_PATH, WEB_PORT } from '../shared/config' | ||
import { isProd } from '../shared/util' | ||
import renderApp from './render-app' | ||
|
||
const app = express() | ||
|
||
app.use(compression()) | ||
app.use(STATIC_PATH, express.static('dist')) | ||
app.use(STATIC_PATH, express.static('public')) | ||
|
||
app.get('/', (req, res) => { | ||
res.send(renderApp(APP_NAME)) | ||
}) | ||
|
||
app.listen(WEB_PORT, () => { | ||
// eslint-disable-next-line no-console | ||
console.log(`Server running on port ${WEB_PORT} ${isProd ? '(production)' : '(development)'}.`) | ||
}) |
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,19 @@ | ||
// @flow | ||
|
||
import { html } from 'common-tags' | ||
import { STATIC_PATH } from '../shared/config' | ||
|
||
const renderApp = (title: string) => | ||
html`<!doctype html> | ||
<html> | ||
<head> | ||
<title>${title}</title> | ||
<link rel="stylesheet" href="${STATIC_PATH}/css/style.css"> | ||
</head> | ||
<body> | ||
<h1>${title}</h1> | ||
</body> | ||
</html> | ||
` | ||
|
||
export default renderApp |
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,4 @@ | ||
// @flow | ||
export const WEB_PORT = process.env.PORT || 8000 | ||
export const STATIC_PATH = '/static' | ||
export const APP_NAME = 'Hello App' |
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,4 @@ | ||
// @flow | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const isProd = process.env.NODE_ENV === 'production' |
Oops, something went wrong.