Skip to content
This repository was archived by the owner on Jun 3, 2019. It is now read-only.

Commit 1f26e01

Browse files
Steven Truesdellctrlplusb
authored andcommitted
Windows (#415)
* update eslintrc line-breaks for windows * add prop-types as a dependency to prevent react-hot-loader from breaking build. add cross-env for starting tasks which break on Windows. add FAQ for when running develop and javascript files aren't loading even though the build is successful. modify the clean task to execute a function rather than use the ${npm bin} exec command, which doesnst work on Windows. * save exact package.json * add cross-env to npm scripts
1 parent ef35285 commit 1f26e01

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

.eslintrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
// A jsx extension is not required for files containing jsx
1515
"react/jsx-filename-extension": 0,
1616
// This rule struggles with flow and class properties
17-
"react/sort-comp": 0
17+
"react/sort-comp": 0,
18+
// ignore linebreak style. the CRLF / LF endings wont matter
19+
// if a windows user correctly converts CRLF to LF upon commits otherwise
20+
// there are errors every line.
21+
"linebreak-style": 0
1822
}
1923
}

config/values.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const values = {
2828

2929
// The host on which the server should run.
3030
host: EnvVars.string('HOST', '0.0.0.0'),
31-
3231
// The port on which the server should run.
3332
port: EnvVars.number('PORT', 1337),
3433

internal/docs/FAQ.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ git merge upstream/master
6262
# Deal with the merge conflicts, delete the yarn.lock file and
6363
# rebuild it, then commit and push.
6464
```
65+
66+
___Q:___ __My development server starts and bundles correctly, but the JavaScript bundles don't load. What causes this to happen?__
67+
68+
Chances are you might be running on Windows. By default the server is bound to `0.0.0.0` for compatibility with Docker and other services. Everything is functioning correctly. The server listens fine on `0.0.0.0` and the problem is only client-side. Windows doesn't like to connecting to `0.0.0.0`. Change the host value in `config/values.js` to `localhost` or `127.0.0.1`. Another option is to specify `HOST=127.0.0.1` in the develop task within your `package.json` or `.env` file.
69+
70+

internal/scripts/clean.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44

55
import { resolve as pathResolve } from 'path';
66
import appRootDir from 'app-root-dir';
7-
import { exec } from '../utils';
7+
import rimraf from 'rimraf';
88
import config from '../../config';
99

10-
const cmd = `$(npm bin)/rimraf ${pathResolve(appRootDir.get(), config('buildOutputPath'))}`;
10+
function clean() {
11+
rimraf(pathResolve(appRootDir.get(), config('buildOutputPath')), () => {
12+
console.log(`Cleaned ${pathResolve(appRootDir.get(), config('buildOutputPath'))}`);
13+
});
14+
}
1115

12-
exec(cmd);
16+
clean();

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
"analyze:server": "babel-node internal/scripts/analyze --server",
1212
"build": "babel-node internal/scripts/build --optimize",
1313
"build:dev": "babel-node internal/scripts/build",
14-
"clean": "babel-node internal/scripts/clean",
14+
"clean": "cross-env babel-node internal/scripts/clean",
1515
"deploy": "babel-node internal/scripts/deploy",
16-
"develop": "DEPLOYMENT=development babel-node internal/development",
16+
"develop": "cross-env DEPLOYMENT=development babel-node internal/development",
1717
"lint": "eslint client server shared config internal",
1818
"precommit": "lint-staged",
1919
"preinstall": "node internal/scripts/preinstall",
2020
"prepush": "jest",
21-
"start": "NODE_ENV=production node build/server",
21+
"start": "cross-env NODE_ENV=production node build/server",
2222
"test": "jest",
2323
"test:coverage": "jest --coverage"
2424
},
@@ -61,6 +61,7 @@
6161
"app-root-dir": "1.0.2",
6262
"colors": "1.1.2",
6363
"compression": "1.6.2",
64+
"cross-env": "4.0.0",
6465
"dotenv": "4.0.0",
6566
"express": "4.15.2",
6667
"helmet": "3.5.0",

0 commit comments

Comments
 (0)