Skip to content

Commit 94dc231

Browse files
committed
[changed] Run the examples with npm run examples
1 parent 6996451 commit 94dc231

File tree

5 files changed

+10
-19
lines changed

5 files changed

+10
-19
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ always be in sync.
3737
- `scripts/test` will fire up a karma runner and watch for changes in the
3838
specs directory.
3939
- `npm test` will do the same but doesn't watch, just runs the tests.
40-
- `scripts/dev-examples` fires up a webpack dev server that will watch
40+
- `npm run examples` fires up a webpack dev server that will watch
4141
for changes and build the examples.
4242

4343
### Build

examples/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ React Router Examples
44
To run and development examples:
55

66
1. Clone this repo
7-
1. Run `npm install`
8-
1. Run `scripts/dev-examples` from the repo's root directory
9-
1. Point your browser to http://localhost:8080
10-
7+
2. Run `npm install`
8+
3. Start the development server with `npm run examples`
9+
4. Point your browser to http://localhost:8080

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
"example": "examples"
1414
},
1515
"scripts": {
16+
"examples": "webpack-dev-server --inline --no-info --content-base examples",
1617
"test": "scripts/test --browsers Firefox --single-run",
1718
"lint": "jsxhint examples modules"
19+
1820
},
1921
"authors": [
2022
"Ryan Florence",

scripts/dev-examples

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

webpack.config.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,21 @@ function isDirectory(dir) {
88
return fs.lstatSync(dir).isDirectory();
99
}
1010

11-
function buildEntries() {
12-
return fs.readdirSync(EXAMPLES_DIR).reduce(function (entries, dir) {
13-
if (dir === 'build')
14-
return entries;
11+
module.exports = {
1512

13+
entry: fs.readdirSync(EXAMPLES_DIR).reduce(function (entries, dir) {
1614
var isDraft = dir.charAt(0) === '_';
1715

1816
if (!isDraft && isDirectory(path.join(EXAMPLES_DIR, dir)))
1917
entries[dir] = path.join(EXAMPLES_DIR, dir, 'app.js');
2018

2119
return entries;
22-
}, {});
23-
}
24-
25-
module.exports = {
26-
27-
entry: buildEntries(),
20+
}, {}),
2821

2922
output: {
3023
filename: '[name].js',
3124
chunkFilename: '[id].chunk.js',
32-
path: 'examples/__build__',
33-
publicPath: '/__build__/'
25+
publicPath: '__build__'
3426
},
3527

3628
module: {

0 commit comments

Comments
 (0)