Skip to content

Commit 3054c8e

Browse files
Add done steps
1 parent f8b6ef5 commit 3054c8e

File tree

145 files changed

+4056
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+4056
-0
lines changed

step-0-done/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015", "react"]
3+
}

step-0-done/.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
webpack.config.js
3+
public
4+
README.md

step-0-done/.eslintrc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"browser": true,
5+
"node": true,
6+
"es6": true
7+
},
8+
"plugins": [
9+
"react"
10+
],
11+
"parserOptions": {
12+
"ecmaVersion": 6,
13+
"sourceType": "module",
14+
"ecmaFeatures": {
15+
"jsx": true,
16+
"experimentalObjectRestSpread": true
17+
},
18+
},
19+
"rules": {
20+
"react/display-name": 0,
21+
"react/forbid-prop-types": 1,
22+
"react/jsx-boolean-value": 1,
23+
"react/jsx-closing-bracket-location": 1,
24+
"react/jsx-curly-spacing": 1,
25+
"react/jsx-handler-names": 1,
26+
"react/jsx-indent-props": 1,
27+
"react/jsx-key": 1,
28+
"react/jsx-max-props-per-line": 1,
29+
"react/jsx-no-bind": 1,
30+
"react/jsx-no-duplicate-props": 1,
31+
"react/jsx-no-literals": 1,
32+
"react/jsx-no-undef": 1,
33+
"react/jsx-pascal-case": 1,
34+
"jsx-quotes": 1,
35+
"react/jsx-sort-prop-types": 1,
36+
"react/jsx-sort-props": 1,
37+
"react/jsx-uses-react": 1,
38+
"react/jsx-uses-vars": 1,
39+
"react/no-danger": 1,
40+
"react/no-did-mount-set-state": 1,
41+
"react/no-did-update-set-state": 1,
42+
"react/no-direct-mutation-state": 1,
43+
"react/no-multi-comp": 1,
44+
"react/no-set-state": 1,
45+
"react/no-unknown-property": 1,
46+
"react/prefer-es6-class": 0,
47+
"react/prop-types": 1,
48+
"react/react-in-jsx-scope": 1,
49+
"react/require-extension": 1,
50+
"react/self-closing-comp": 1,
51+
"react/sort-comp": 1,
52+
"react/wrap-multilines": 1
53+
}
54+
}

step-0-done/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Node.js
2+
node_modules
3+
npm-debug.log
4+
5+
# Bundles
6+
bundle.js
7+
bundle.js.map

step-0-done/package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "react-workshop",
3+
"description": "React Workshop",
4+
"version": "0.1.0",
5+
"dependencies": {
6+
"react": "0.14.7",
7+
"react-dom": "0.14.7"
8+
},
9+
"devDependencies": {
10+
"babel-loader": "6.2.4",
11+
"babel-preset-es2015": "6.6.0",
12+
"babel-preset-react": "6.5.0",
13+
"babel-register": "6.7.2",
14+
"eslint": "2.4.0",
15+
"eslint-plugin-react": "4.2.3",
16+
"webpack": "1.12.14",
17+
"webpack-dev-server": "1.14.1"
18+
},
19+
"scripts": {
20+
"lint": "eslint src",
21+
"bundle": "webpack -p --colors --progress",
22+
"start": "webpack-dev-server -d --colors --inline --content-base public",
23+
"build": "npm run lint && npm run bundle"
24+
}
25+
}

step-0-done/public/css/main.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-family: 'Roboto', sans-serif;
3+
}
28.6 KB
Loading

step-0-done/public/img/react.png

13.2 KB
Loading

step-0-done/public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8"/>
5+
<title>React Workshop</title>
6+
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
7+
<link href="/css/main.css" rel="stylesheet" type="text/css">
8+
<link rel="icon" type="image/png" href="/img/react.png">
9+
</head>
10+
<body>
11+
<h1>Wines</h1>
12+
13+
<div id="main"></div>
14+
15+
<script src="/js/bundle.js"></script>
16+
</body>
17+
</html>

step-0-done/public/js/.gitkeep

Whitespace-only changes.

step-0-done/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Etape 0
2+
3+
Ce dossier contient la version finale de [l'étape 0]('../step-0')

step-0-done/src/app.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
import Wine from './components/wine';
5+
6+
ReactDOM.render(
7+
<Wine name="Château Chevrol Bel Air"/>,
8+
document.getElementById('main')
9+
);

step-0-done/src/components/wine.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
3+
const WineStyle = {
4+
padding: 8,
5+
boxShadow: '0 1px 6px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.12)'
6+
};
7+
8+
const Wine = React.createClass({
9+
propTypes: {
10+
name: React.PropTypes.string
11+
},
12+
13+
render() {
14+
return (
15+
<div style={WineStyle}>
16+
{this.props.name}
17+
</div>
18+
);
19+
}
20+
});
21+
22+
export default Wine;

step-0-done/webpack.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var webpack = require('webpack');
2+
3+
module.exports = {
4+
output: {
5+
path: './public/js/',
6+
publicPath: '/js/',
7+
filename: 'bundle.js'
8+
},
9+
entry: {
10+
app: ['./src/app.js']
11+
},
12+
resolve: {
13+
extensions: ['', '.js', '.jsx']
14+
},
15+
module: {
16+
loaders: [
17+
{
18+
test: /\.js$/,
19+
exclude: /node_modules/,
20+
loader: 'babel'
21+
}
22+
]
23+
}
24+
};

step-1-done/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015", "react"]
3+
}

step-1-done/.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
webpack.config.js
3+
public
4+
README.md

step-1-done/.eslintrc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"browser": true,
5+
"node": true,
6+
"es6": true
7+
},
8+
"plugins": [
9+
"react"
10+
],
11+
"parserOptions": {
12+
"ecmaVersion": 6,
13+
"sourceType": "module",
14+
"ecmaFeatures": {
15+
"jsx": true,
16+
"experimentalObjectRestSpread": true
17+
},
18+
},
19+
"rules": {
20+
"react/display-name": 0,
21+
"react/forbid-prop-types": 1,
22+
"react/jsx-boolean-value": 1,
23+
"react/jsx-closing-bracket-location": 1,
24+
"react/jsx-curly-spacing": 1,
25+
"react/jsx-handler-names": 1,
26+
"react/jsx-indent-props": 1,
27+
"react/jsx-key": 1,
28+
"react/jsx-max-props-per-line": 1,
29+
"react/jsx-no-bind": 1,
30+
"react/jsx-no-duplicate-props": 1,
31+
"react/jsx-no-literals": 1,
32+
"react/jsx-no-undef": 1,
33+
"react/jsx-pascal-case": 1,
34+
"jsx-quotes": 1,
35+
"react/jsx-sort-prop-types": 1,
36+
"react/jsx-sort-props": 1,
37+
"react/jsx-uses-react": 1,
38+
"react/jsx-uses-vars": 1,
39+
"react/no-danger": 1,
40+
"react/no-did-mount-set-state": 1,
41+
"react/no-did-update-set-state": 1,
42+
"react/no-direct-mutation-state": 1,
43+
"react/no-multi-comp": 1,
44+
"react/no-set-state": 1,
45+
"react/no-unknown-property": 1,
46+
"react/prefer-es6-class": 0,
47+
"react/prop-types": 1,
48+
"react/react-in-jsx-scope": 1,
49+
"react/require-extension": 1,
50+
"react/self-closing-comp": 1,
51+
"react/sort-comp": 1,
52+
"react/wrap-multilines": 1
53+
}
54+
}

step-1-done/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Node.js
2+
node_modules
3+
npm-debug.log
4+
5+
# Bundles
6+
bundle.js
7+
bundle.js.map

step-1-done/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "react-workshop",
3+
"description": "React Workshop",
4+
"version": "0.1.0",
5+
"dependencies": {
6+
"react": "0.14.7",
7+
"react-dom": "0.14.7"
8+
},
9+
"devDependencies": {
10+
"babel-loader": "6.2.4",
11+
"babel-preset-es2015": "6.6.0",
12+
"babel-preset-react": "6.5.0",
13+
"babel-register": "6.7.2",
14+
"chai": "3.5.0",
15+
"eslint": "2.4.0",
16+
"eslint-plugin-react": "4.2.3",
17+
"jsdom": "8.1.0",
18+
"mocha": "2.4.5",
19+
"react-addons-test-utils": "0.14.7",
20+
"webpack": "1.12.14",
21+
"webpack-dev-server": "1.14.1"
22+
},
23+
"scripts": {
24+
"lint": "eslint src tests",
25+
"test": "mocha --compilers js:babel-register tests/index.js",
26+
"bundle": "webpack -p --colors --progress",
27+
"start": "webpack-dev-server -d --colors --inline --content-base public",
28+
"build": "npm run test && npm run lint && npm run bundle"
29+
}
30+
}

step-1-done/public/css/avalanche.css

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

step-1-done/public/css/main.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-family: 'Roboto', sans-serif;
3+
}
28.6 KB
Loading

step-1-done/public/img/react.png

13.2 KB
Loading

step-1-done/public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8"/>
5+
<title>React Workshop</title>
6+
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
7+
<link href="/css/main.css" rel="stylesheet" type="text/css">
8+
<link rel="icon" type="image/png" href="/img/react.png">
9+
</head>
10+
<body>
11+
<h1>Wines</h1>
12+
13+
<div id="main"></div>
14+
15+
<script src="/js/bundle.js"></script>
16+
</body>
17+
</html>

step-1-done/public/js/.gitkeep

Whitespace-only changes.

step-1-done/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Etape 1
2+
3+
Ce dossier contient la version finale de [l'étape 1]('../step-1')

step-1-done/src/app.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
import Wine from './components/wine';
5+
6+
ReactDOM.render(
7+
<Wine name="Château Chevrol Bel Air"/>,
8+
document.getElementById('main')
9+
);

step-1-done/src/components/wine.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
3+
const WineStyle = {
4+
padding: 8,
5+
boxShadow: '0 1px 6px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.12)'
6+
};
7+
8+
const Wine = React.createClass({
9+
propTypes: {
10+
name: React.PropTypes.string
11+
},
12+
13+
render() {
14+
return (
15+
<div style={WineStyle}>
16+
{this.props.name}
17+
</div>
18+
);
19+
}
20+
});
21+
22+
export default Wine;

step-1-done/tests/bootstrap.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* eslint no-console: 0 */
2+
3+
import jsdom from 'jsdom';
4+
5+
export function bootstrapEnv(body = '') {
6+
const doc = jsdom.jsdom(`<!doctype html><html><body>${body}</body></html>`);
7+
const win = doc.defaultView;
8+
function propagateToGlobal(window) {
9+
for (const key in window) {
10+
if (!window.hasOwnProperty(key)) continue;
11+
if (key in global) continue;
12+
global[key] = window[key];
13+
}
14+
}
15+
global.document = doc;
16+
global.window = win;
17+
propagateToGlobal(win);
18+
console.log('\nENV setup is done !!!');
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* eslint no-undef:0 */
2+
3+
import React from 'react';
4+
import { expect } from 'chai';
5+
import ReactTestUtils from 'react-addons-test-utils';
6+
7+
import Wine from '../../src/components/wine';
8+
9+
describe('Wine', () => {
10+
it('affiche le nom du vin', () => {
11+
const wine = ReactTestUtils.renderIntoDocument(<Wine name="Un bon Bourgogne" />);
12+
const div = ReactTestUtils.findRenderedDOMComponentWithTag(wine, 'div');
13+
expect(div.textContent).to.be.equal('Un bon Bourgogne');
14+
});
15+
});

step-1-done/tests/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint no-unused-vars:0, no-console: 0 */
2+
3+
import { bootstrapEnv } from './bootstrap';
4+
5+
bootstrapEnv();
6+
7+
console.log('===================================================================\n');
8+
console.log('If you want to run other tests, don\'t forget ton include them in the "tests" array.');
9+
console.log('of $ROOT/tests/index.js)');
10+
console.log('\n===================================================================\n');
11+
12+
const tests = [
13+
require('./components/wine.spec.js')
14+
];

0 commit comments

Comments
 (0)