Skip to content

Commit

Permalink
Windows (mui#415)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Steven Truesdell authored and ctrlplusb committed Apr 21, 2017
1 parent ef35285 commit 1f26e01
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
// A jsx extension is not required for files containing jsx
"react/jsx-filename-extension": 0,
// This rule struggles with flow and class properties
"react/sort-comp": 0
"react/sort-comp": 0,
// ignore linebreak style. the CRLF / LF endings wont matter
// if a windows user correctly converts CRLF to LF upon commits otherwise
// there are errors every line.
"linebreak-style": 0
}
}
1 change: 0 additions & 1 deletion config/values.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const values = {

// The host on which the server should run.
host: EnvVars.string('HOST', '0.0.0.0'),

// The port on which the server should run.
port: EnvVars.number('PORT', 1337),

Expand Down
6 changes: 6 additions & 0 deletions internal/docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@ git merge upstream/master
# Deal with the merge conflicts, delete the yarn.lock file and
# rebuild it, then commit and push.
```

___Q:___ __My development server starts and bundles correctly, but the JavaScript bundles don't load. What causes this to happen?__

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.


10 changes: 7 additions & 3 deletions internal/scripts/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@

import { resolve as pathResolve } from 'path';
import appRootDir from 'app-root-dir';
import { exec } from '../utils';
import rimraf from 'rimraf';
import config from '../../config';

const cmd = `$(npm bin)/rimraf ${pathResolve(appRootDir.get(), config('buildOutputPath'))}`;
function clean() {
rimraf(pathResolve(appRootDir.get(), config('buildOutputPath')), () => {
console.log(`Cleaned ${pathResolve(appRootDir.get(), config('buildOutputPath'))}`);
});
}

exec(cmd);
clean();
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"analyze:server": "babel-node internal/scripts/analyze --server",
"build": "babel-node internal/scripts/build --optimize",
"build:dev": "babel-node internal/scripts/build",
"clean": "babel-node internal/scripts/clean",
"clean": "cross-env babel-node internal/scripts/clean",
"deploy": "babel-node internal/scripts/deploy",
"develop": "DEPLOYMENT=development babel-node internal/development",
"develop": "cross-env DEPLOYMENT=development babel-node internal/development",
"lint": "eslint client server shared config internal",
"precommit": "lint-staged",
"preinstall": "node internal/scripts/preinstall",
"prepush": "jest",
"start": "NODE_ENV=production node build/server",
"start": "cross-env NODE_ENV=production node build/server",
"test": "jest",
"test:coverage": "jest --coverage"
},
Expand Down Expand Up @@ -61,6 +61,7 @@
"app-root-dir": "1.0.2",
"colors": "1.1.2",
"compression": "1.6.2",
"cross-env": "4.0.0",
"dotenv": "4.0.0",
"express": "4.15.2",
"helmet": "3.5.0",
Expand Down

0 comments on commit 1f26e01

Please sign in to comment.