Skip to content

Commit 9e2d23c

Browse files
author
Nicolas Goutay
committedFeb 27, 2016
Project setup
1 parent 06cacd1 commit 9e2d23c

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed
 

‎dist/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>React TodoMVC</title>
6+
</head>
7+
<body>
8+
<div id="app"></div>
9+
<script src="bundle.js"></script>
10+
</body>
11+
</html>

‎package.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "redux-todomvc",
3+
"version": "1.0.0",
4+
"description": "Companion repository for the \"Getting Started with React, Redux and Immutable: a Test-Driven TodoMVC Tutorial\" article.",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "mocha --compilers js:babel-core/register --require ./test/setup.js 'test/**/*.@(js|jsx)'",
8+
"test:watch": "npm run test -- --watch --watch-extensions jsx"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/phacks/redux-todomvc.git"
13+
},
14+
"keywords": [],
15+
"author": "",
16+
"license": "ISC",
17+
"bugs": {
18+
"url": "https://github.com/phacks/redux-todomvc/issues"
19+
},
20+
"homepage": "https://github.com/phacks/redux-todomvc#readme",
21+
"devDependencies": {
22+
"babel-core": "^6.5.2",
23+
"babel-loader": "^6.2.4",
24+
"babel-preset-es2015": "^6.5.0",
25+
"babel-preset-react": "^6.5.0",
26+
"chai": "^3.5.0",
27+
"chai-immutable": "^1.5.3",
28+
"jsdom": "^8.0.4",
29+
"mocha": "^2.4.5",
30+
"react-hot-loader": "^1.3.0",
31+
"webpack": "^1.12.14",
32+
"webpack-dev-server": "^1.14.1"
33+
},
34+
"babel": {
35+
"presets": [
36+
"es2015",
37+
"react"
38+
]
39+
},
40+
"dependencies": {
41+
"immutable": "^3.7.6",
42+
"react": "^0.14.7",
43+
"react-dom": "^0.14.7"
44+
}
45+
}

‎src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('Hello World!');

‎test/setup.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import jsdom from 'jsdom';
2+
import chai from 'chai';
3+
import chaiImmutable from 'chai-immutable';
4+
5+
const doc = jsdom.jsdom('<!doctype html><html><body></body></html>');
6+
const win = doc.defaultView;
7+
8+
global.document = doc;
9+
global.window = win;
10+
11+
Object.keys(window).forEach((key) => {
12+
if (!(key in global)) {
13+
global[key] = window[key];
14+
}
15+
});
16+
17+
chai.use(chaiImmutable);

‎webpack.config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
var webpack = require('webpack');
2+
3+
module.exports = {
4+
entry: [
5+
'webpack-dev-server/client?http://localhost:8080',
6+
'webpack/hot/only-dev-server',
7+
'./src/index.js'
8+
],
9+
module: {
10+
loaders: [{
11+
test: /\.jsx?$/,
12+
exclude: /node_modules/,
13+
loader: 'react-hot!babel'
14+
}]
15+
},
16+
resolve: {
17+
extensions: ['', '.js', '.jsx']
18+
},
19+
output: {
20+
path: __dirname + '/dist',
21+
publicPath: '/',
22+
filename: 'bundle.js'
23+
},
24+
devServer: {
25+
contentBase: './dist',
26+
hot: true
27+
},
28+
plugins: [
29+
new webpack.HotModuleReplacementPlugin() // Wire in the hot loading plugin
30+
]
31+
};

0 commit comments

Comments
 (0)