react_on_rails 1.0.0.pre → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +2 -0
- data/.eslintignore +2 -0
- data/.eslintrc +1 -0
- data/.gitignore +4 -0
- data/.jscsrc +2 -2
- data/.rubocop.yml +2 -0
- data/.scss-lint.yml +3 -3
- data/.travis.yml +31 -18
- data/Dockerfile_ci +12 -0
- data/Dockerfile_tests +12 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +170 -290
- data/Rakefile +20 -7
- data/app/helpers/react_on_rails_helper.rb +5 -5
- data/docker-compose.yml +12 -0
- data/docs/Contributing.md +26 -2
- data/docs/gen-notes/react_syntax.md +3 -0
- data/docs/gen-notes/reducers.md +31 -0
- data/docs/generator_testing_script.md +50 -0
- data/docs/linters.md +8 -0
- data/docs/manual_configuration.md +202 -0
- data/docs/node_dependencies_and_npm.md +29 -0
- data/lib/generators/react_on_rails/base_generator.rb +116 -0
- data/lib/generators/react_on_rails/bootstrap_generator.rb +84 -0
- data/lib/generators/react_on_rails/generator_helper.rb +48 -0
- data/lib/generators/react_on_rails/heroku_deployment_generator.rb +22 -0
- data/lib/generators/react_on_rails/install_generator.rb +86 -0
- data/lib/generators/react_on_rails/linters_generator.rb +38 -0
- data/lib/generators/react_on_rails/react_no_redux_generator.rb +37 -0
- data/lib/generators/react_on_rails/react_with_redux_generator.rb +61 -0
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt +4 -0
- data/lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md +16 -0
- data/lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb +5 -0
- data/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt +6 -0
- data/lib/generators/react_on_rails/templates/base/base/client/.babelrc +3 -0
- data/lib/generators/react_on_rails/templates/base/base/client/REACT_ON_RAILS_CLIENT_README.md +3 -0
- data/lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/startup/clientGlobals.jsx +4 -0
- data/lib/generators/react_on_rails/templates/base/base/client/index.jade +15 -0
- data/lib/generators/react_on_rails/templates/base/base/client/npm-shrinkwrap.json +2907 -0
- data/lib/generators/react_on_rails/templates/base/base/client/server.js +58 -0
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.base.config.js +58 -0
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.hot.config.js +65 -0
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.rails.config.js +45 -0
- data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +30 -0
- data/lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake +26 -0
- data/lib/generators/react_on_rails/templates/base/base/package.json +31 -0
- data/lib/generators/react_on_rails/templates/base/server_rendering/client/app/bundles/HelloWorld/startup/serverGlobals.jsx +3 -0
- data/lib/generators/react_on_rails/templates/base/server_rendering/client/webpack.server.rails.config.js +37 -0
- data/lib/generators/react_on_rails/templates/bootstrap/app/assets/stylesheets/_bootstrap-custom.scss +63 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_post-bootstrap.scss +10 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_pre-bootstrap.scss +8 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_react-on-rails-sass-helper.scss +19 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/bootstrap-sass.config.js +89 -0
- data/lib/generators/react_on_rails/templates/client/README.md +97 -0
- data/lib/generators/react_on_rails/templates/heroku_deployment/.buildpacks +2 -0
- data/lib/generators/react_on_rails/templates/heroku_deployment/Procfile +1 -0
- data/lib/generators/react_on_rails/templates/linters/client/.eslintignore +1 -0
- data/lib/generators/react_on_rails/templates/linters/client/.eslintrc +17 -0
- data/lib/generators/react_on_rails/templates/linters/client/.jscsrc +7 -0
- data/lib/generators/react_on_rails/templates/linters/lib/tasks/brakeman.rake +17 -0
- data/lib/generators/react_on_rails/templates/linters/lib/tasks/ci.rake +33 -0
- data/lib/generators/react_on_rails/templates/linters/lib/tasks/linters.rake +81 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +39 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +33 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx +11 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/package.json.tt +75 -0
- data/lib/generators/react_on_rails/templates/no_redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +11 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx +8 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +48 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/constants/helloWorldConstants.jsx +8 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +43 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/helloWorldReducer.jsx +21 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/index.jsx +14 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx +20 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/store/helloWorldStore.jsx +35 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/lib/middlewares/loggerMiddleware.js +25 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/package.json.tt +82 -0
- data/lib/generators/react_on_rails/templates/redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +21 -0
- data/lib/react_on_rails.rb +1 -7
- data/lib/react_on_rails/configuration.rb +14 -5
- data/lib/react_on_rails/engine.rb +7 -0
- data/lib/react_on_rails/server_rendering_pool.rb +14 -1
- data/lib/react_on_rails/version.rb +1 -1
- data/react_on_rails.gemspec +2 -2
- data/ruby-lint.yml +1 -0
- metadata +75 -11
- data/Dockerfile +0 -14
- data/docs/README.md +0 -1
@@ -0,0 +1,75 @@
|
|
1
|
+
{
|
2
|
+
"name": "react-webpack-rails-tutorial",
|
3
|
+
"version": "1.1.0",
|
4
|
+
"description": "Built using the react_on_rails generator.",
|
5
|
+
"main": "server.js",
|
6
|
+
"engines": {
|
7
|
+
"node": "4.2.0",
|
8
|
+
"npm": "3.3.6"
|
9
|
+
},
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "https://github.com/shakacode/react-webpack-rails-tutorial.git"
|
13
|
+
},
|
14
|
+
"keywords": [
|
15
|
+
"react",
|
16
|
+
"tutorial",
|
17
|
+
"comment",
|
18
|
+
"example"
|
19
|
+
],
|
20
|
+
"author": "justin808",
|
21
|
+
"license": "MIT",
|
22
|
+
"bugs": {
|
23
|
+
"url": "https://github.com/shakacode/react-webpack-rails-tutorial/issues"
|
24
|
+
},
|
25
|
+
"homepage": "https://github.com/shakacode/react-webpack-rails-tutorial",
|
26
|
+
"scripts": {
|
27
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
28
|
+
"start": "node server.js",
|
29
|
+
"build:client": "NODE_ENV=production webpack --config webpack.client.rails.config.js",
|
30
|
+
"build:server": "NODE_ENV=production webpack --config webpack.server.rails.config.js",
|
31
|
+
"build:dev:client": "webpack -w --config webpack.client.rails.config.js",
|
32
|
+
"build:dev:server": "webpack -w --config webpack.server.rails.config.js",<%- unless options.skip_linters? %>
|
33
|
+
"lint": "npm run eslint && npm run jscs",
|
34
|
+
"eslint": "eslint --ext .js,.jsx .",
|
35
|
+
"jscs": "jscs --verbose ."<%- end %>
|
36
|
+
},
|
37
|
+
"dependencies": {
|
38
|
+
"babel-core": "^5.8.25",
|
39
|
+
"babel-loader": "^5.3.2",
|
40
|
+
"body-parser": "^1.14.1",
|
41
|
+
"es5-shim": "^4.1.14",
|
42
|
+
"es6-promise": "^3.0.2",
|
43
|
+
"expose-loader": "^0.7.0",
|
44
|
+
"imports-loader": "^0.6.4",
|
45
|
+
"jquery": "^2.1.4",
|
46
|
+
"jquery-ujs": "^1.1.0-1",
|
47
|
+
"loader-utils": "^0.2.11",
|
48
|
+
"react": "^0.14.0",
|
49
|
+
"react-bootstrap": "^0.27.0",
|
50
|
+
"react-dom": "^0.14.0",
|
51
|
+
"sleep": "^3.0.0",
|
52
|
+
"webpack": "^1.12.2"
|
53
|
+
},
|
54
|
+
"devDependencies": {<%- unless options.skip_linters? %>
|
55
|
+
"babel-eslint": "^4.1.3",
|
56
|
+
<%- end %>"babel-plugin-react-transform": "^1.1.1",
|
57
|
+
"bootstrap-sass": "^3.3.5",
|
58
|
+
"bootstrap-sass-loader": "^1.0.9",
|
59
|
+
"css-loader": "^0.19.0",<%- unless options.skip_linters? %>
|
60
|
+
"eslint": "^1.6.0",
|
61
|
+
"eslint-config-airbnb": "0.1.0",
|
62
|
+
"eslint-plugin-react": "^3.5.1",<%- end %>
|
63
|
+
"esprima-fb": "^15001.1001.0-dev-harmony-fb",
|
64
|
+
"express": "^4.13.3",
|
65
|
+
"file-loader": "^0.8.4",
|
66
|
+
"jade": "^1.11.0",<%- unless options.skip_linters? %>
|
67
|
+
"jscs": "^2.3.0",
|
68
|
+
<%- end %>"node-sass": "^3.3.3",
|
69
|
+
"react-transform-hmr": "^1.0.1",
|
70
|
+
"sass-loader": "^3.0.0",
|
71
|
+
"style-loader": "^0.12.4",
|
72
|
+
"url-loader": "^0.5.6",
|
73
|
+
"webpack-dev-server": "^1.12.0"
|
74
|
+
}
|
75
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
// HelloWorldWidget is an arbitrary name for any "dumb" component. We do not recommend suffixing all your
|
2
|
+
// dump component names with Widget.
|
3
|
+
|
4
|
+
import React, { PropTypes } from 'react';
|
5
|
+
import Immutable from 'immutable';
|
6
|
+
import _ from 'lodash';
|
7
|
+
|
8
|
+
// Simple example of a React "dumb" component
|
9
|
+
export default class HelloWorldWidget extends React.Component {
|
10
|
+
constructor(props, context) {
|
11
|
+
super(props, context);
|
12
|
+
|
13
|
+
// Uses lodash to bind all methods to the context of the object instance, otherwise
|
14
|
+
// the methods defined here would not refer to the component's class, not the component
|
15
|
+
// instance itself.
|
16
|
+
_.bindAll(this, '_handleChange');
|
17
|
+
}
|
18
|
+
|
19
|
+
static propTypes = {
|
20
|
+
// We prefix all property and variable names pointing to Immutable.js objects with '$$'.
|
21
|
+
// This allows us to immediately know we don't call $$helloWorldStore['someProperty'], but instead use
|
22
|
+
// the Immutable.js `get` API for Immutable.Map
|
23
|
+
actions: PropTypes.object.isRequired,
|
24
|
+
$$helloWorldStore: PropTypes.instanceOf(Immutable.Map).isRequired,
|
25
|
+
}
|
26
|
+
|
27
|
+
// React will automatically provide us with the event `e`
|
28
|
+
_handleChange(e) {
|
29
|
+
const name = e.target.value;
|
30
|
+
this.props.actions.updateName(name);
|
31
|
+
}
|
32
|
+
|
33
|
+
render() {
|
34
|
+
const $$helloWorldStore = this.props.$$helloWorldStore;
|
35
|
+
const name = $$helloWorldStore.get('name');
|
36
|
+
return (
|
37
|
+
<div>
|
38
|
+
<h3>
|
39
|
+
Hello, {name}!
|
40
|
+
</h3>
|
41
|
+
<p>
|
42
|
+
Say hello to:
|
43
|
+
<input type="text" value={name} onChange={this._handleChange} />
|
44
|
+
</p>
|
45
|
+
</div>
|
46
|
+
);
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
// See https://www.npmjs.com/package/mirror-creator
|
2
|
+
// Allows us to easily setup constants inside of
|
3
|
+
// client/app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx
|
4
|
+
import mirrorCreator from 'mirror-creator';
|
5
|
+
|
6
|
+
export default mirrorCreator([
|
7
|
+
'HELLO_WORLD_NAME_UPDATE',
|
8
|
+
]);
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React, { PropTypes } from 'react';
|
2
|
+
import HelloWorldWidget from '../components/HelloWorldWidget';
|
3
|
+
import { connect } from 'react-redux';
|
4
|
+
import { bindActionCreators } from 'redux';
|
5
|
+
import Immutable from 'immutable';
|
6
|
+
import * as helloWorldActionCreators from '../actions/helloWorldActionCreators';
|
7
|
+
|
8
|
+
function select(state) {
|
9
|
+
// Which part of the Redux global state does our component want to receive as props?
|
10
|
+
// Note the use of `$$` to prefix the property name because the value is of type Immutable.js
|
11
|
+
return { $$helloWorldStore: state.$$helloWorldStore };
|
12
|
+
}
|
13
|
+
|
14
|
+
// Simple example of a React "smart" component
|
15
|
+
class HelloWorld extends React.Component {
|
16
|
+
constructor(props, context) {
|
17
|
+
super(props, context);
|
18
|
+
}
|
19
|
+
|
20
|
+
static propTypes = {
|
21
|
+
dispatch: PropTypes.func.isRequired,
|
22
|
+
|
23
|
+
// This corresponds to the value used in function select above.
|
24
|
+
$$helloWorldStore: PropTypes.instanceOf(Immutable.Map).isRequired,
|
25
|
+
}
|
26
|
+
|
27
|
+
render() {
|
28
|
+
const { dispatch, $$helloWorldStore } = this.props;
|
29
|
+
const actions = bindActionCreators(helloWorldActionCreators, dispatch);
|
30
|
+
|
31
|
+
// This uses the ES2015 spread operator to pass properties as it is more DRY
|
32
|
+
// This is equivalent to:
|
33
|
+
// <HelloWorldWidget $$helloWorldStore={$$helloWorldStore} actions={actions} />
|
34
|
+
return (
|
35
|
+
<HelloWorldWidget {...{$$helloWorldStore, actions}} />
|
36
|
+
);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
// Don't forget to actually use connect!
|
41
|
+
// Note that we don't export HelloWorld, but the redux "connected" version of it.
|
42
|
+
// See https://github.com/rackt/react-redux/blob/master/docs/api.md#examples
|
43
|
+
export default connect(select)(HelloWorld);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import Immutable from 'immutable';
|
2
|
+
|
3
|
+
import * as actionTypes from '../constants/helloWorldConstants';
|
4
|
+
|
5
|
+
export const $$initialState = Immutable.fromJS({
|
6
|
+
name: '', // this is the default state that would be used if one were not passed into the store
|
7
|
+
});
|
8
|
+
|
9
|
+
export default function helloWorldReducer($$state = $$initialState, action) {
|
10
|
+
const { type, name } = action;
|
11
|
+
|
12
|
+
switch (type) {
|
13
|
+
case actionTypes.HELLO_WORLD_NAME_UPDATE: {
|
14
|
+
return $$state.set('name', name);
|
15
|
+
}
|
16
|
+
|
17
|
+
default: {
|
18
|
+
return $$state;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// This file is our manifest of all reducers for the app.
|
2
|
+
// See /client/app/bundles/HelloWorld/store/helloWorldStore.jsx
|
3
|
+
// A real world app will like have many reducers and it helps to organize them in one file.
|
4
|
+
// See `docs/generators/reducers.md` at https://github.com/shakacode/react_on_rails
|
5
|
+
import helloWorldReducer from './helloWorldReducer';
|
6
|
+
import { $$initialState as $$helloWorldState } from './helloWorldReducer';
|
7
|
+
|
8
|
+
export default {
|
9
|
+
$$helloWorldStore: helloWorldReducer,
|
10
|
+
};
|
11
|
+
|
12
|
+
export const initalStates = {
|
13
|
+
$$helloWorldState,
|
14
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Provider } from 'react-redux';
|
3
|
+
|
4
|
+
import createStore from '../store/helloWorldStore';
|
5
|
+
import HelloWorld from '../containers/HelloWorld';
|
6
|
+
|
7
|
+
// See documentation for https://github.com/rackt/react-redux.
|
8
|
+
// This is how you get props from the Rails view into the redux store.
|
9
|
+
// This code here binds your smart component to the redux store.
|
10
|
+
const HelloWorldAppClient = props => {
|
11
|
+
const store = createStore(props);
|
12
|
+
const reactComponent = (
|
13
|
+
<Provider store={store}>
|
14
|
+
<HelloWorld />
|
15
|
+
</Provider>
|
16
|
+
);
|
17
|
+
return reactComponent;
|
18
|
+
};
|
19
|
+
|
20
|
+
export default HelloWorldAppClient;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { compose, createStore, applyMiddleware, combineReducers } from 'redux';
|
2
|
+
|
3
|
+
// See https://github.com/gaearon/redux-thunk and http://redux.js.org/docs/advanced/AsyncActions.html
|
4
|
+
// This is not actually used for this simple example, but you'd probably want to use this once your app has
|
5
|
+
// asynchronous actions.
|
6
|
+
import thunkMiddleware from 'redux-thunk';
|
7
|
+
|
8
|
+
// This provides an example of logging redux actions to the console.
|
9
|
+
// You'd want to disable this for production.
|
10
|
+
import loggerMiddleware from 'lib/middlewares/loggerMiddleware';
|
11
|
+
|
12
|
+
import reducers from '../reducers';
|
13
|
+
import { initalStates } from '../reducers';
|
14
|
+
|
15
|
+
export default props => {
|
16
|
+
// This is how we get initial props Rails into redux.
|
17
|
+
const { name } = props;
|
18
|
+
const { $$helloWorldState } = initalStates;
|
19
|
+
|
20
|
+
// Redux expects to initialize the store using an Object, not an Immutable.Map
|
21
|
+
const initialState = {
|
22
|
+
$$helloWorldStore: $$helloWorldState.merge({
|
23
|
+
name: name,
|
24
|
+
}),
|
25
|
+
};
|
26
|
+
|
27
|
+
const reducer = combineReducers(reducers);
|
28
|
+
const composedStore = compose(
|
29
|
+
applyMiddleware(thunkMiddleware, loggerMiddleware)
|
30
|
+
);
|
31
|
+
const storeCreator = composedStore(createStore);
|
32
|
+
const store = storeCreator(reducer, initialState);
|
33
|
+
|
34
|
+
return store;
|
35
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/* eslint no-console: 0 */
|
2
|
+
import _ from 'lodash';
|
3
|
+
|
4
|
+
// This logger should be configured not to run in a production environment.
|
5
|
+
// See https://github.com/petehunt/webpack-howto#6-feature-flags for you might turn this off for production.
|
6
|
+
export default function logger({ getState }) {
|
7
|
+
return next => action => {
|
8
|
+
console.log('will dispatch', action);
|
9
|
+
|
10
|
+
// Call the next dispatch method in the middleware chain.
|
11
|
+
const result = next(action);
|
12
|
+
|
13
|
+
// We can't console.log immutable objects out-of-the-box.
|
14
|
+
const immutableState = getState();
|
15
|
+
const readableState = _.reduce(immutableState, (result, immutable, key) => {
|
16
|
+
result[key] = immutable.toJS();
|
17
|
+
}, {});
|
18
|
+
|
19
|
+
console.log('state after dispatch', readableState);
|
20
|
+
|
21
|
+
// This will likely be the action itself, unless
|
22
|
+
// a middleware further in chain changed it.
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
{
|
2
|
+
"name": "react-webpack-rails-tutorial",
|
3
|
+
"version": "1.1.0",
|
4
|
+
"description": "Built using the react_on_rails generator.",
|
5
|
+
"main": "server.js",
|
6
|
+
"engines": {
|
7
|
+
"node": "4.2.0",
|
8
|
+
"npm": "3.3.6"
|
9
|
+
},
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "https://github.com/shakacode/react-webpack-rails-tutorial.git"
|
13
|
+
},
|
14
|
+
"keywords": [
|
15
|
+
"react",
|
16
|
+
"tutorial",
|
17
|
+
"comment",
|
18
|
+
"example"
|
19
|
+
],
|
20
|
+
"author": "justin808",
|
21
|
+
"license": "MIT",
|
22
|
+
"bugs": {
|
23
|
+
"url": "https://github.com/shakacode/react-webpack-rails-tutorial/issues"
|
24
|
+
},
|
25
|
+
"homepage": "https://github.com/shakacode/react-webpack-rails-tutorial",
|
26
|
+
"scripts": {
|
27
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
28
|
+
"start": "node server.js",
|
29
|
+
"build:client": "NODE_ENV=production webpack --config webpack.client.rails.config.js",
|
30
|
+
"build:server": "NODE_ENV=production webpack --config webpack.server.rails.config.js",
|
31
|
+
"build:dev:client": "webpack -w --config webpack.client.rails.config.js",
|
32
|
+
"build:dev:server": "webpack -w --config webpack.server.rails.config.js",<%- unless options.skip_linters? %>
|
33
|
+
"lint": "npm run eslint && npm run jscs",
|
34
|
+
"eslint": "eslint --ext .js,.jsx .",
|
35
|
+
"jscs": "jscs --verbose ."<%- end %>
|
36
|
+
},
|
37
|
+
"dependencies": {
|
38
|
+
"babel-core": "^5.8.25",
|
39
|
+
"babel-loader": "^5.3.2",
|
40
|
+
"body-parser": "^1.14.1",
|
41
|
+
"es5-shim": "^4.1.14",
|
42
|
+
"es6-promise": "^3.0.2",
|
43
|
+
"expose-loader": "^0.7.0",
|
44
|
+
"immutable": "^3.7.5",
|
45
|
+
"imports-loader": "^0.6.4",
|
46
|
+
"jquery": "^2.1.4",
|
47
|
+
"jquery-ujs": "^1.1.0-1",
|
48
|
+
"lodash": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
|
49
|
+
"loader-utils": "^0.2.11",
|
50
|
+
"mirror-creator": "0.0.1",
|
51
|
+
"react": "^0.14.0",
|
52
|
+
"react-bootstrap": "^0.27.0",
|
53
|
+
"react-dom": "^0.14.0",
|
54
|
+
"react-redux": "^3.1.0",
|
55
|
+
"redux": "^3.0.2",
|
56
|
+
"redux-promise": "^0.5.0",
|
57
|
+
"redux-thunk": "^1.0.0",
|
58
|
+
"sleep": "^3.0.0",
|
59
|
+
"webpack": "^1.12.2"
|
60
|
+
},
|
61
|
+
"devDependencies": {<%- unless options.skip_linters? %>
|
62
|
+
"babel-eslint": "^4.1.3",<%- end %>
|
63
|
+
"babel-plugin-react-transform": "^1.1.1",
|
64
|
+
"bootstrap-sass": "^3.3.5",
|
65
|
+
"bootstrap-sass-loader": "^1.0.9",
|
66
|
+
"css-loader": "^0.19.0",<%- unless options.skip_linters? %>
|
67
|
+
"eslint": "^1.6.0",
|
68
|
+
"eslint-config-airbnb": "0.1.0",
|
69
|
+
"eslint-plugin-react": "^3.5.1",<%- end %>
|
70
|
+
"esprima-fb": "^15001.1001.0-dev-harmony-fb",
|
71
|
+
"express": "^4.13.3",
|
72
|
+
"file-loader": "^0.8.4",
|
73
|
+
"jade": "^1.11.0",<%- unless options.skip_linters? %>
|
74
|
+
"jscs": "^2.3.0",<%- end %>
|
75
|
+
"node-sass": "^3.3.3",
|
76
|
+
"react-transform-hmr": "^1.0.1",
|
77
|
+
"sass-loader": "^3.0.0",
|
78
|
+
"style-loader": "^0.12.4",
|
79
|
+
"url-loader": "^0.5.6",
|
80
|
+
"webpack-dev-server": "^1.12.0"
|
81
|
+
}
|
82
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Provider } from 'react-redux';
|
3
|
+
|
4
|
+
import createStore from '../store/helloWorldStore';
|
5
|
+
import HelloWorld from '../containers/HelloWorld';
|
6
|
+
|
7
|
+
// See documentation for https://github.com/rackt/react-redux.
|
8
|
+
// This is how you get props from the Rails view into the redux store.
|
9
|
+
// This code here binds your smart component to the redux store.
|
10
|
+
// This is how the server redux gets hydrated with data.
|
11
|
+
const HelloWorldAppServer = props => {
|
12
|
+
const store = createStore(props);
|
13
|
+
const reactComponent = (
|
14
|
+
<Provider store={store}>
|
15
|
+
<HelloWorld />
|
16
|
+
</Provider>
|
17
|
+
);
|
18
|
+
return reactComponent;
|
19
|
+
};
|
20
|
+
|
21
|
+
export default HelloWorldAppServer;
|