Skip to content

Commit

Permalink
fix(monorepo): fixes resolution of modules, CRA builds, ignores, and …
Browse files Browse the repository at this point in the history
…ensures that we can start / monitor apps in local dev; drops CRA scripts version to get around facebook/create-react-app#8685"
  • Loading branch information
dermidgen committed May 13, 2020
1 parent 6664da3 commit b493598
Show file tree
Hide file tree
Showing 11 changed files with 583 additions and 16,830 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ node_modules
.env.test.local
.env.production.local


*.log
npm-debug.log*
yarn-debug.log*
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ The largest problem to solve which may enable us to offer varying levels of comp
You'll need Yarn and Lerna installed to manage packages and shared modules.

Get started by running `lerna bootstrap`. You'll want to rerun this any time you pull changes where new dependencies have been added.

To run the project, you can use `lerna run --stream start`. I like the `--stream` option as it follows the logs nicely together.
16,646 changes: 0 additions & 16,646 deletions package-lock.json

This file was deleted.

28 changes: 28 additions & 0 deletions stack/client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.vscode
.env

# dependencies
node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local


*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
10 changes: 8 additions & 2 deletions stack/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"react-redux": "^7.2.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"react-scripts": "3.4.0",
"react-share": "^4.1.0",
"redux": "^4.0.5",
"redux-saga": "^1.1.3"
Expand All @@ -32,7 +32,13 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"release": "standard-version"
},
"standard-version": {
"skip": {
"tag": true
}
},
"eslintConfig": {
"extends": "react-app"
Expand Down
22 changes: 22 additions & 0 deletions stack/client/serve.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"headers": [
{
"source": "static/**",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=31536000"
}
]
},
{
"source": "index.html",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
}
]
}
1 change: 1 addition & 0 deletions stack/server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ node_modules
.env.test.local
.env.production.local

*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
55 changes: 0 additions & 55 deletions stack/server/access.log

This file was deleted.

9 changes: 8 additions & 1 deletion stack/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ const http = require('http');
const bodyParser = require('body-parser');
const cors = require('cors');

const {
name:APP_NAME,
version:APP_VERSION
} = require('./package.json')

const app = express();

const STAGING_ENVIRONMENT = 'staging';
const PRODUCTION_ENVIRONMENT = 'prod';
const SERVER_PORT = process.env.PORT || 5000

// Set up basic access logging with file rotation:
app.use(morgan('combined', {stream: rfs.createStream('access.log', {maxFiles: 5, size: '100M'})}));
Expand Down Expand Up @@ -60,12 +66,13 @@ name varchar(100)
`GET /scores/:challengeId`
*/
const server = app.listen(process.env.PORT || 5000, function() {
const server = app.listen(SERVER_PORT, function() {
/**
* The TFE expects keep-alive connections to remain open forever. Expressjs defaults to a
* timeout of 2 minutes. This causes many ChannelClosedExceptions for the TFE.
*/
server.setTimeout(0)
console.log(`${APP_NAME} v${APP_VERSION} listening on ${SERVER_PORT}`)

/**
* Node's default behavior is to close the connection on upgrade requests. The HTTP2 spec
Expand Down
9 changes: 8 additions & 1 deletion stack/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@
"rotating-file-stream": "^2.1.0"
},
"scripts": {
"start": "node index.js"
"release": "standard-version",
"start": "nodemon -q -L -e js,json,yml,yaml --exec 'node index.js'"
},
"standard-version": {
"skip": {
"tag": true
}
},
"devDependencies": {
"nodemon": "^2.0.3",
"standard-version": "^7.0.0"
}
}
Loading

0 comments on commit b493598

Please sign in to comment.