Skip to content

Commit b493598

Browse files
committed
fix(monorepo): fixes resolution of modules, CRA builds, ignores, and ensures that we can start / monitor apps in local dev; drops CRA scripts version to get around facebook/create-react-app#8685"
1 parent 6664da3 commit b493598

File tree

11 files changed

+583
-16830
lines changed

11 files changed

+583
-16830
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ node_modules
2121
.env.test.local
2222
.env.production.local
2323

24+
2425
*.log
2526
npm-debug.log*
2627
yarn-debug.log*

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ The largest problem to solve which may enable us to offer varying levels of comp
1818
You'll need Yarn and Lerna installed to manage packages and shared modules.
1919

2020
Get started by running `lerna bootstrap`. You'll want to rerun this any time you pull changes where new dependencies have been added.
21+
22+
To run the project, you can use `lerna run --stream start`. I like the `--stream` option as it follows the logs nicely together.

package-lock.json

Lines changed: 0 additions & 16646 deletions
This file was deleted.

stack/client/.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
.vscode
4+
.env
5+
6+
# dependencies
7+
node_modules
8+
/.pnp
9+
.pnp.js
10+
11+
# testing
12+
/coverage
13+
14+
# production
15+
/build
16+
17+
# misc
18+
.DS_Store
19+
.env.local
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
24+
25+
*.log
26+
npm-debug.log*
27+
yarn-debug.log*
28+
yarn-error.log*

stack/client/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"react-redux": "^7.2.0",
2424
"react-router": "^5.1.2",
2525
"react-router-dom": "^5.1.2",
26-
"react-scripts": "3.4.1",
26+
"react-scripts": "3.4.0",
2727
"react-share": "^4.1.0",
2828
"redux": "^4.0.5",
2929
"redux-saga": "^1.1.3"
@@ -32,7 +32,13 @@
3232
"start": "react-scripts start",
3333
"build": "react-scripts build",
3434
"test": "react-scripts test",
35-
"eject": "react-scripts eject"
35+
"eject": "react-scripts eject",
36+
"release": "standard-version"
37+
},
38+
"standard-version": {
39+
"skip": {
40+
"tag": true
41+
}
3642
},
3743
"eslintConfig": {
3844
"extends": "react-app"

stack/client/serve.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"headers": [
3+
{
4+
"source": "static/**",
5+
"headers": [
6+
{
7+
"key": "Cache-Control",
8+
"value": "max-age=31536000"
9+
}
10+
]
11+
},
12+
{
13+
"source": "index.html",
14+
"headers": [
15+
{
16+
"key": "Cache-Control",
17+
"value": "no-cache"
18+
}
19+
]
20+
}
21+
]
22+
}

stack/server/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ node_modules
2020
.env.test.local
2121
.env.production.local
2222

23+
*.log
2324
npm-debug.log*
2425
yarn-debug.log*
2526
yarn-error.log*

stack/server/access.log

Lines changed: 0 additions & 55 deletions
This file was deleted.

stack/server/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ const http = require('http');
77
const bodyParser = require('body-parser');
88
const cors = require('cors');
99

10+
const {
11+
name:APP_NAME,
12+
version:APP_VERSION
13+
} = require('./package.json')
14+
1015
const app = express();
1116

1217
const STAGING_ENVIRONMENT = 'staging';
1318
const PRODUCTION_ENVIRONMENT = 'prod';
19+
const SERVER_PORT = process.env.PORT || 5000
1420

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

7077
/**
7178
* Node's default behavior is to close the connection on upgrade requests. The HTTP2 spec

stack/server/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@
1212
"rotating-file-stream": "^2.1.0"
1313
},
1414
"scripts": {
15-
"start": "node index.js"
15+
"release": "standard-version",
16+
"start": "nodemon -q -L -e js,json,yml,yaml --exec 'node index.js'"
17+
},
18+
"standard-version": {
19+
"skip": {
20+
"tag": true
21+
}
1622
},
1723
"devDependencies": {
24+
"nodemon": "^2.0.3",
1825
"standard-version": "^7.0.0"
1926
}
2027
}

0 commit comments

Comments
 (0)