react_on_rails 3.0.0.rc.1 → 3.0.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/CHANGELOG.md +7 -4
- data/Gemfile +5 -1
- data/README.md +17 -13
- data/docs/additional_reading/react-and-redux.md +1 -1
- data/docs/additional_reading/react_router.md +1 -1
- data/docs/additional_reading/turbolinks.md +14 -2
- data/docs/contributing.md +3 -1
- data/docs/doctrine.md +2 -2
- data/docs/recommended-project-structure.md +1 -1
- data/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt +1 -1
- data/lib/generators/react_on_rails/templates/base/base/client/package.json.tt +24 -23
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +1 -1
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/index.jsx +1 -1
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx.tt +1 -1
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/store/helloWorldStore.jsx +2 -2
- data/lib/generators/react_on_rails/templates/redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +1 -1
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +1 -1
- data/rakelib/dummy_apps.rake +6 -0
- data/rakelib/run_rspec.rake +7 -1
- data/rakelib/task_helpers.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1882e63cd3c443aa67f2d9a1880f6be2a7d9d263
|
4
|
+
data.tar.gz: 792845e5aebe6c4e54a7527668c9af31ce5de665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d2414f70dc6ca4a019e5f5133ea1ab18b6d56d5165061afe5ed312640572c592cc5b1529bdd2db1e5b2b139a5f712013a26376a0f0adff859b2daec1be13e95
|
7
|
+
data.tar.gz: d245de4737799b8cbb1a0177926ee15379e1a76241c3c875ae62b6a685dd37929342276152667d9ee3b029da099385c59cbe28c3fb4bfbd977f77ca5a7084de5
|
data/.travis.yml
CHANGED
@@ -3,7 +3,7 @@ sudo: required
|
|
3
3
|
language: ruby
|
4
4
|
|
5
5
|
rvm:
|
6
|
-
- 2.2.
|
6
|
+
- 2.2.4
|
7
7
|
|
8
8
|
services:
|
9
9
|
- docker
|
@@ -22,10 +22,12 @@ before_install:
|
|
22
22
|
- sudo apt-get install -y xvfb
|
23
23
|
|
24
24
|
install:
|
25
|
-
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install
|
25
|
+
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install 5.5.0
|
26
26
|
- npm install -g npm
|
27
27
|
- npm install -g poltergeist
|
28
|
+
- gem install bundler
|
28
29
|
- bundle install
|
30
|
+
- ENABLE_TURBOLINKS_5=TRUE bundle install
|
29
31
|
- npm install
|
30
32
|
- rake dummy_apps
|
31
33
|
- rake examples
|
data/CHANGELOG.md
CHANGED
@@ -3,14 +3,16 @@ All notable changes to this project will be documented in this file. Items under
|
|
3
3
|
|
4
4
|
Contributors: please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version.
|
5
5
|
|
6
|
-
## [3.0.0-
|
6
|
+
## [3.0.0-rc.2] - 2016-02-09
|
7
7
|
##### Fixed
|
8
8
|
- Fix Bootstrap Sass Append to Gemfile, missing new line. [#262](https://github.com/shakacode/react_on_rails/pull/262).
|
9
9
|
|
10
10
|
##### Added
|
11
11
|
- Added helper `redux_store` and associated JavaScript APIs that allow multiple React components to use the same store. Thus, you initialize the store, with props, separately from the components.
|
12
|
-
- Added forman to gemspec in case new dev does not have it globally installed. [#248](https://github.com/shakacode/react_on_rails/pull/248)
|
13
|
-
|
12
|
+
- Added forman to gemspec in case new dev does not have it globally installed. [#248](https://github.com/shakacode/react_on_rails/pull/248).
|
13
|
+
- Support for Turbolinks 5! [#270](https://github.com/shakacode/react_on_rails/pull/270).
|
14
|
+
- Added better error messages for `ReactOnRails.register()`. [#273](https://github.com/shakacode/react_on_rails/pull/273).
|
15
|
+
|
14
16
|
##### Breaking Change
|
15
17
|
- Calls to `react_component` should use a named argument of props. For example, change this:
|
16
18
|
```ruby
|
@@ -23,6 +25,7 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
|
|
23
25
|
```
|
24
26
|
You'll get a deprecation message to change this.
|
25
27
|
- Renamed `ReactOnRails.configure_rspec_to_compile_assets` to `ReactOnRails::TestHelper.configure_rspec_to_compile_assets`. The code has also been optimized to check for whether or not the compiled webpack bundles are up to date or not and will not run if not necessary. If you are using non-standard directories for your generated webpack assets (`app/assets/javascripts/generated` and `app/assets/stylesheets/generated`) or have additional directories you wish the helper to check, you need to update your ReactOnRails configuration accordingly. See [documentation](https://github.com/shakacode/react_on_rails/blob/master/docs/additional_reading/rspec_configuration.md) for how to do this. [#253](https://github.com/shakacode/react_on_rails/pull/253).
|
28
|
+
- You have to call `ReactOnRails.register` to register react components. This was deprecated in v2. [#273](https://github.com/shakacode/react_on_rails/pull/273).
|
26
29
|
|
27
30
|
##### Migration Steps v2 to v3
|
28
31
|
- [spec/dummy/spec/rails_helper.rb](https://github.com/shakacode/react_on_rails/blob/master/spec%2Fdummy%2Fspec%2Frails_helper.rb#L36..38) for an example. Add this line to your `rails_helper.rb`:
|
@@ -162,7 +165,7 @@ Best done with Object destructing:
|
|
162
165
|
##### Fixed
|
163
166
|
- Fix several generator related issues.
|
164
167
|
|
165
|
-
[3.0.0-
|
168
|
+
[3.0.0-rc.1]: https://github.com/shakacode/react_on_rails/compare/2.3.0...3.0.0-rc.1
|
166
169
|
[2.3.0]: https://github.com/shakacode/react_on_rails/compare/2.2.0...2.3.0
|
167
170
|
[2.2.0]: https://github.com/shakacode/react_on_rails/compare/2.1.1...2.2.0
|
168
171
|
[2.1.1]: https://github.com/shakacode/react_on_rails/compare/v2.1.0...2.1.1
|
data/Gemfile
CHANGED
@@ -29,6 +29,10 @@ gem "selenium-webdriver"
|
|
29
29
|
gem "spring"
|
30
30
|
gem "sqlite3"
|
31
31
|
gem "therubyracer"
|
32
|
-
|
32
|
+
if ENV["ENABLE_TURBOLINKS_5"].nil? || ENV["ENABLE_TURBOLINKS_5"].strip.empty?
|
33
|
+
gem "turbolinks", "2.5.3"
|
34
|
+
else
|
35
|
+
gem "turbolinks", "~> 5.0.0.beta"
|
36
|
+
end
|
33
37
|
gem "uglifier", ">= 2.7.2"
|
34
38
|
gem "web-console", "~> 2.0"
|
data/README.md
CHANGED
@@ -2,11 +2,15 @@
|
|
2
2
|
|
3
3
|
# NEWS
|
4
4
|
|
5
|
-
* 3.0.0.
|
5
|
+
* 3.0.0.rc.2 shipped on Sunday, 2/14/2016. Please see the [Changelog](CHANGELOG.md) for details, and let us know if you see any issues! [Migration steps from 1.x](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#migration-steps-v1-to-v2). [Migration steps from 2.x](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#migration-steps-v2-to-v3).
|
6
|
+
* [RubyGems](https://rubygems.org/gems/react_on_rails/versions/3.0.0.rc.2), `gem "react_on_rails", "~> 3.0.0-rc.2"`
|
7
|
+
* [NPM](https://www.npmjs.com/package/react-on-rails), `npm i --save react-on-rails@3.0.0-rc.2`
|
8
|
+
* 3.0.0.rc.1 shipped on Monday, 2/8/2016.
|
6
9
|
* 3.0.0 Highlights:
|
7
10
|
1. Support for ensuring JavaScript is current when running tests.
|
8
11
|
2. Support for multiple React components with one Redux store. So you can have a header React component and different body React components talking to the same Redux store!
|
9
|
-
|
12
|
+
3. Support for Turbolinks 5!
|
13
|
+
* There was a fatal error when using the lastest version of Redux for server rendering. See [Redux #1335](https://github.com/reactjs/redux/issues/1335). See [diff 3.1.6...3.1.4](https://github.com/reactjs/redux/commit/e2e14d26f09ca729ae0555442f50fcfc45bfb423#diff-1fdf421c05c1140f6d71444ea2b27638). Workaround for server rendering: Use Redux 3.1.7 or upgrade to React On Rails v2.3.0. [this commit](https://github.com/shakacode/react_on_rails/commit/59f1e68d3d233775e6abc63bff180ea59ac2d79e) on [PR #244](https://github.com/shakacode/react_on_rails/pull/244/).
|
10
14
|
* 2.x Highlights:
|
11
15
|
1. Fixed a **critical** problem with TurboLinks. Be sure to see [turbolinks docs](docs/additional_reading/turbolinks.md) for more information on how to debug TurboLinks issues.
|
12
16
|
2. Provides a convenient helper to ensure that JavaScript assets are compiled before running tests.
|
@@ -16,9 +20,9 @@
|
|
16
20
|
|
17
21
|
# React on Rails
|
18
22
|
|
19
|
-
**Project Objective**: To provide an opinionated and optimal framework for integrating **Ruby on Rails** with modern JavaScript tooling and libraries, including [**Webpack**](http://webpack.github.io/), [**Babel**](https://babeljs.io/), [**React**](https://github.com/
|
23
|
+
**Project Objective**: To provide an opinionated and optimal framework for integrating **Ruby on Rails** with modern JavaScript tooling and libraries, including [**Webpack**](http://webpack.github.io/), [**Babel**](https://babeljs.io/), [**React**](https://github.com/reactjs/react-router), [**Redux**](https://github.com/reactjs/redux), [**React-Router**](https://github.com/reactjs/react-router). This differs significantly from typical Rails. When considering what goes into **react_on_rails**, we ask ourselves, is the functionality related to the intersection of using Rails and with modern JavaScript? If so, then the functionality belongs right here. In other cases, we're releasing separate npm packages or Ruby gems. If you are interested in implementing React using traditional Rails architecture, see [react-rails](https://github.com/reactjs/react-rails).
|
20
24
|
|
21
|
-
React on Rails integrates Facebook's [React](https://github.com/facebook/react) front-end framework with Rails. React v0.14.x is supported, with server rendering. [Redux](https://github.com/
|
25
|
+
React on Rails integrates Facebook's [React](https://github.com/facebook/react) front-end framework with Rails. React v0.14.x is supported, with server rendering. [Redux](https://github.com/reactjs/redux) and [React-Router](https://github.com/reactjs/react-redux) are supported as well. See the Rails on Maui [blog post](http://www.railsonmaui.com/blog/2014/10/03/integrating-webpack-and-the-es6-transpiler-into-an-existing-rails-project/) that started it all!
|
22
26
|
|
23
27
|
Be sure to see:
|
24
28
|
|
@@ -101,10 +105,10 @@ Please see [Getting Started](#getting-started) for how to set up your Rails proj
|
|
101
105
|
## Features
|
102
106
|
Like the [react-rails](https://github.com/reactjs/react-rails) gem, React on Rails is capable of server-side rendering with fragment caching and is compatible with [turbolinks](https://github.com/rails/turbolinks). Unlike react-rails, which depends heavily on sprockets and jquery-ujs, React on Rails uses [webpack](http://webpack.github.io/) and does not depend on jQuery. While the initial setup is slightly more involved, it allows for advanced functionality such as:
|
103
107
|
|
104
|
-
+ [Redux](https://github.com/
|
108
|
+
+ [Redux](https://github.com/reactjs/redux)
|
105
109
|
+ [Webpack dev server](https://webpack.github.io/docs/webpack-dev-server.html) with [hot module replacement](https://webpack.github.io/docs/hot-module-replacement-with-webpack.html)
|
106
110
|
+ [Webpack optimization functionality](https://github.com/webpack/docs/wiki/optimization)
|
107
|
-
+ [React Router](https://github.com/
|
111
|
+
+ [React Router](https://github.com/reactjs/react-router)
|
108
112
|
|
109
113
|
See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) for an example of a live implementation and code.
|
110
114
|
|
@@ -167,7 +171,7 @@ That will install the latest version and update your package.json.
|
|
167
171
|
## How it Works
|
168
172
|
The generator installs your webpack files in the `client` folder. Foreman uses webpack to compile your code and output the bundled results to `app/assets/javascripts/generated`, which are then loaded by sprockets. These generated bundle files have been added to your `.gitignore` for your convenience.
|
169
173
|
|
170
|
-
Inside your Rails views, you can now use the `react_component` helper method provided by React on Rails. You can pass props directly to the react component helper. You can also initialize a Redux store with view helper `redux_store` so that the store can be shared amongst multiple React components. Your best
|
174
|
+
Inside your Rails views, you can now use the `react_component` helper method provided by React on Rails. You can pass props directly to the react component helper. You can also initialize a Redux store with view helper `redux_store` so that the store can be shared amongst multiple React components. Your best bet is to scan the code inside of the [/spec/dummy](spec/dummy) sample app.
|
171
175
|
|
172
176
|
### Client-Side Rendering vs. Server-Side Rendering
|
173
177
|
In most cases, you should use the `prerender: false` (default behavior) with the provided helper method to render the React component from your Rails views. In some cases, such as when SEO is vital or many users will not have JavaScript enabled, you can enable server-rendering by passing `prerender: true` to your helper, or you can simply change the default in `config/initializers/react_on_rails`.
|
@@ -327,8 +331,8 @@ From your Rails view, you can use the provided helper `redux_store(store_name, p
|
|
327
331
|
**app/views/layouts/application.html.erb**
|
328
332
|
```erb
|
329
333
|
...
|
330
|
-
|
331
|
-
<%=
|
334
|
+
<%= redux_store("appStore", @react_props) %>;
|
335
|
+
<%= react_component("NavbarApp") %>
|
332
336
|
yield
|
333
337
|
...
|
334
338
|
```
|
@@ -337,12 +341,12 @@ Components are created as [stateless function(al) components](https://facebook.g
|
|
337
341
|
|
338
342
|
**_comments.html.erb**
|
339
343
|
```erb
|
340
|
-
<%=
|
344
|
+
<%= react_component("CommentsApp") %>
|
341
345
|
```
|
342
346
|
|
343
347
|
**_blogs.html.erb**
|
344
348
|
```erb
|
345
|
-
<%=
|
349
|
+
<%= react_component("BlogsApp") %>
|
346
350
|
```
|
347
351
|
|
348
352
|
*Note:* You will not be doing any partial updates to the Redux store when loading a new page. When the page content loads, React on Rails will rehydrate a new version of the store with whatever props are placed on the page.
|
@@ -362,7 +366,7 @@ In the former case, the Rails server loads `bootstrap-sprockets`, provided by th
|
|
362
366
|
|
363
367
|
This allows for using Bootstrap in your regular Rails stylesheets. If you wish to customize any of the Bootstrap variables, you can do so via the `client/assets/stylesheets/_pre-bootstrap.scss` partial.
|
364
368
|
|
365
|
-
#### Bootstrap via Webpack Dev Server
|
369
|
+
#### Bootstrap via Webpack HMR Dev Server
|
366
370
|
When using the webpack dev server, which does not go through Rails, bootstrap is loaded via the [bootstrap-sass-loader](https://github.com/shakacode/bootstrap-sass-loader) which uses the `client/bootstrap-sass-config.js` file.
|
367
371
|
|
368
372
|
#### Keeping Custom Bootstrap Configurations Synced
|
@@ -440,7 +444,7 @@ If you are using [react-rails](https://github.com/reactjs/react-rails) in your p
|
|
440
444
|
Note: If you have components from react-rails you want to use, then you will need to port them into react_on_rails which uses webpack instead of the asset pipeline.
|
441
445
|
|
442
446
|
## Additional Reading
|
443
|
-
+ [The React on Rails Doctrine](http://www.shakacode.com/2016/01/
|
447
|
+
+ [The React on Rails Doctrine](http://www.shakacode.com/2016/01/27/the-react-on-rails-doctrine.html)
|
444
448
|
+ [Babel](docs/additional_reading/babel.md)
|
445
449
|
+ [Generated Client Code](docs/additional_reading/generated_client_code.md)
|
446
450
|
+ [Heroku Deployment](docs/additional_reading/heroku_deployment.md)
|
@@ -13,7 +13,7 @@ const RouterApp = (props, location) => {
|
|
13
13
|
let redirectLocation;
|
14
14
|
let routeProps;
|
15
15
|
|
16
|
-
// See https://github.com/
|
16
|
+
// See https://github.com/reactjs/react-router/blob/master/docs/guides/advanced/ServerRendering.md
|
17
17
|
match({ routes, location }, (_error, _redirectLocation, _routeProps) => {
|
18
18
|
error = _error;
|
19
19
|
redirectLocation = _redirectLocation;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Turbolinks
|
2
2
|
|
3
3
|
* See [Turbolinks on Github](https://github.com/rails/turbolinks)
|
4
|
-
* Currently support 2.5.x of Turbolinks
|
4
|
+
* Currently support 2.5.x of Turbolinks and 5.0.0.beta1 of Turbolinks 5.
|
5
5
|
* Turbolinks is currently included only via the Rails gem and the Rails manifest file rather than NPM. [Turbolinks Issue #658 ](https://github.com/rails/turbolinks/issues/658) discusses this.
|
6
6
|
|
7
7
|
## Why Turbolinks?
|
@@ -22,8 +22,13 @@ the JavaScript and stylesheets are cached by the browser, as they will still req
|
|
22
22
|
```
|
23
23
|
Note, in the future, we might change to installing this via npm.
|
24
24
|
|
25
|
+
## Turbolinks 5
|
26
|
+
Turbolinks 5 is now being supported. React on Rails will automatically detect which version of Turbolinks you are using and use the correct event handlers.
|
27
|
+
|
28
|
+
For more information on Turbolinks 5: [https://github.com/turbolinks/turbolinks](https://github.com/turbolinks/turbolinks)
|
29
|
+
|
25
30
|
## Troubleshooting
|
26
|
-
To turn on tracing of Turbolinks events, put this in your registration file, where you register your components.
|
31
|
+
To turn on tracing of Turbolinks events, put this in your registration file, where you register your components.
|
27
32
|
|
28
33
|
```js
|
29
34
|
ReactOnRails.setOptions({
|
@@ -50,11 +55,18 @@ At Webpack compile time, the value of devBuild is inserted into your file.
|
|
50
55
|
|
51
56
|
Once you do that, you'll see messages prefixed with **TURBO:** like this in the browser console:
|
52
57
|
|
58
|
+
Turbolinks Classic:
|
53
59
|
```
|
54
60
|
TURBO: WITH TURBOLINKS: document page:before-unload and page:change handlers installed. (program)
|
55
61
|
TURBO: reactOnRailsPageLoaded
|
56
62
|
```
|
57
63
|
|
64
|
+
Turbolinks 5:
|
65
|
+
```
|
66
|
+
TURBO: WITH TURBOLINKS 5: document turbolinks:before-cache and turbolinks:load handlers installed. (program)
|
67
|
+
TURBO: reactOnRailsPageLoaded
|
68
|
+
```
|
69
|
+
|
58
70
|
We've noticed that Turbolinks doesn't work if you use the ruby gem version of jQuery and jQuery ujs. Therefore we recommend using the node packages instead. See the [tutorial app](https://github.com/shakacode/react-webpack-rails-tutorial) for how to accomplish this.
|
59
71
|
|
60
72
|
![2016-02-02_10-38-07](https://cloud.githubusercontent.com/assets/1118459/12760060/6546e254-c999-11e5-828b-a8aaa473e5bd.png)
|
data/docs/contributing.md
CHANGED
@@ -156,6 +156,8 @@ If you run `rspec` at the top level, you'll see this message: `require': cannot
|
|
156
156
|
|
157
157
|
After running a test, you can view the coverage results SimpleCov reports by opening `coverage/index.html`.
|
158
158
|
|
159
|
+
To test `spec/dummy` against Turbolinks 5, install the gem by running `ENABLE_TURBOLINKS_5=TRUE bundle install` in the `spec/dummy` directory before running `rake`.
|
160
|
+
|
159
161
|
### Debugging
|
160
162
|
Start the sample app like this for some debug printing:
|
161
163
|
|
@@ -184,7 +186,7 @@ All linting is performed from the docker container for CI. You will need docker
|
|
184
186
|
Once you have docker and docker-compose running locally, run `docker-compose build lint`. This will build the `reactonrails_lint` docker image and docker-compose `lint` container. The initial build is slow, but after the install, startup is very quick.
|
185
187
|
|
186
188
|
### Linting Commands
|
187
|
-
Run `rake lint`.
|
189
|
+
Run `rake lint`.
|
188
190
|
|
189
191
|
Alternately with Docker:
|
190
192
|
|
data/docs/doctrine.md
CHANGED
@@ -39,8 +39,8 @@ Here's the chef's selection from the React on Rails community:
|
|
39
39
|
* [Bootstrap](http://getbootstrap.com/), loaded from [bootstrap-loader](https://github.com/shakacode/bootstrap-loader/). Common UI styles.
|
40
40
|
* [Lodash](https://lodash.com/): Swiss army knife of utilities.
|
41
41
|
* [React](https://facebook.github.io/react/): UI components.
|
42
|
-
* [React-Router](https://github.com/
|
43
|
-
* [Redux](https://github.com/
|
42
|
+
* [React-Router](https://github.com/reactjs/react-router): Provider of deep links for client-side application.
|
43
|
+
* [Redux](https://github.com/reactjs/redux): Flux implementation (aka "state container").
|
44
44
|
|
45
45
|
### JavaScript Tooling
|
46
46
|
* [Babel](https://babeljs.io/): Transpiler for ES6 into ES5 and much more.
|
@@ -15,7 +15,7 @@ While React On Rails does not *enforce* a specific project structure, we do *rec
|
|
15
15
|
* `/containers`: "smart" components. These components are bound to Redux.
|
16
16
|
* `/reducers`: Reducers for redux.
|
17
17
|
* `/routes`: Routes for React Router.
|
18
|
-
* `/store`: Store, which might be [configured differently for dev vs. production](https://github.com/
|
18
|
+
* `/store`: Store, which might be [configured differently for dev vs. production](https://github.com/reactjs/redux/tree/master/examples/real-world/store).
|
19
19
|
* `/startup`: Component bindings to stores, with registration of components and stores.
|
20
20
|
* `/schemas`: Schemas for AJAX JSON requests and responses, as used by the [Normalizr](https://github.com/gaearon/normalizr) package.
|
21
21
|
1. `/client/app/assets`: Assets for CSS for client app.
|
@@ -37,46 +37,47 @@
|
|
37
37
|
<%- end -%>
|
38
38
|
},
|
39
39
|
"dependencies": {
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"babel
|
43
|
-
"babel-
|
44
|
-
"babel-
|
45
|
-
"babel-
|
46
|
-
"babel-
|
47
|
-
"babel-preset-
|
48
|
-
"babel-preset-
|
49
|
-
"babel-
|
50
|
-
"
|
40
|
+
"autoprefixer": "^6.3.2",
|
41
|
+
"axios": "^0.9.1",
|
42
|
+
"babel": "^6.5.1",
|
43
|
+
"babel-cli": "^6.5.1",
|
44
|
+
"babel-core": "^6.5.1",
|
45
|
+
"babel-loader": "^6.2.2",
|
46
|
+
"babel-polyfill": "^6.5.0",
|
47
|
+
"babel-preset-es2015": "^6.5.0",
|
48
|
+
"babel-preset-react": "^6.5.0",
|
49
|
+
"babel-preset-stage-0": "^6.5.0",
|
50
|
+
"css-loader": "^0.23.1",
|
51
|
+
"es5-shim": "^4.5.2",
|
51
52
|
"expose-loader": "^0.7.1",
|
52
53
|
<%- if options.redux? -%>
|
53
54
|
"immutable": "^3.7.6",
|
54
55
|
<%- end -%>
|
55
56
|
"imports-loader": "^0.6.5",
|
56
57
|
"jquery": "^2.2.0",
|
57
|
-
"jquery-ujs": "^1.
|
58
|
+
"jquery-ujs": "^1.2.0",
|
58
59
|
"loader-utils": "^0.2.12",
|
59
|
-
"lodash": "^4.
|
60
|
+
"lodash": "^4.3.0",
|
60
61
|
<%- if options.redux? -%>
|
61
62
|
"mirror-creator": "1.0.0",
|
62
63
|
<%- end -%>
|
63
|
-
"react": "^0.14.
|
64
|
+
"react": "^0.14.7",
|
64
65
|
<%- unless options.skip_bootstrap? -%>
|
65
|
-
"react-bootstrap": "^0.28.
|
66
|
+
"react-bootstrap": "^0.28.3",
|
66
67
|
<%- end -%>
|
67
|
-
"react-dom": "^0.14.
|
68
|
+
"react-dom": "^0.14.7",
|
68
69
|
"react-on-rails": "<%= VersionSyntaxConverter.new.rubygem_to_npm %>",
|
69
70
|
<%- if options.redux? -%>
|
70
|
-
"react-redux": "^4.0
|
71
|
-
"redux": "^3.
|
71
|
+
"react-redux": "^4.4.0",
|
72
|
+
"redux": "^3.3.1",
|
72
73
|
"redux-promise": "^0.5.1",
|
73
74
|
"redux-thunk": "^1.0.3",
|
74
75
|
<%- end -%>
|
75
|
-
"webpack": "^1.12.
|
76
|
+
"webpack": "^1.12.13"
|
76
77
|
},
|
77
78
|
"devDependencies": {
|
78
79
|
<%- unless options.skip_js_linters? -%>
|
79
|
-
"babel-eslint": "^5.0.0-
|
80
|
+
"babel-eslint": "^5.0.0-beta8",
|
80
81
|
<%- end -%>
|
81
82
|
"babel-plugin-react-transform": "^2.0.0",
|
82
83
|
<%- unless options.skip_bootstrap? -%>
|
@@ -86,7 +87,7 @@
|
|
86
87
|
"css-loader": "^0.23.1",
|
87
88
|
<%- unless options.skip_js_linters? -%>
|
88
89
|
"eslint": "^1.10.3",
|
89
|
-
"eslint-config-airbnb": "^
|
90
|
+
"eslint-config-airbnb": "^5.0.0",
|
90
91
|
"eslint-config-shakacode": "^1.0.0",
|
91
92
|
"eslint-plugin-react": "^3.16.1",
|
92
93
|
<%- end -%>
|
@@ -94,10 +95,10 @@
|
|
94
95
|
"file-loader": "^0.8.5",
|
95
96
|
"jade": "^1.11.0",
|
96
97
|
<%- unless options.skip_js_linters? -%>
|
97
|
-
"jscs": "^2.
|
98
|
+
"jscs": "^2.9.0",
|
98
99
|
<%- end -%>
|
99
100
|
"node-sass": "^3.4.2",
|
100
|
-
"react-transform-hmr": "^1.0.
|
101
|
+
"react-transform-hmr": "^1.0.2",
|
101
102
|
"sass-loader": "^3.1.2",
|
102
103
|
"style-loader": "^0.13.0",
|
103
104
|
"url-loader": "^0.5.7",
|
@@ -44,5 +44,5 @@ class HelloWorld extends React.Component {
|
|
44
44
|
|
45
45
|
// Don't forget to actually use connect!
|
46
46
|
// Note that we don't export HelloWorld, but the redux "connected" version of it.
|
47
|
-
// See https://github.com/
|
47
|
+
// See https://github.com/reactjs/react-redux/blob/master/docs/api.md#examples
|
48
48
|
export default connect(select)(HelloWorld);
|
@@ -4,7 +4,7 @@ import { Provider } from 'react-redux';
|
|
4
4
|
import createStore from '../store/helloWorldStore';
|
5
5
|
import HelloWorld from '../containers/HelloWorld';
|
6
6
|
|
7
|
-
// See documentation for https://github.com/
|
7
|
+
// See documentation for https://github.com/reactjs/react-redux.
|
8
8
|
// This is how you get props from the Rails view into the redux store.
|
9
9
|
// This code here binds your smart component to the redux store.
|
10
10
|
export default (props) => {
|
@@ -11,12 +11,12 @@ import thunkMiddleware from 'redux-thunk';
|
|
11
11
|
import loggerMiddleware from 'lib/middlewares/loggerMiddleware';
|
12
12
|
|
13
13
|
import reducers from '../reducers';
|
14
|
-
import {
|
14
|
+
import { initialStates } from '../reducers';
|
15
15
|
|
16
16
|
export default props => {
|
17
17
|
// This is how we get initial props Rails into redux.
|
18
18
|
const { name } = props;
|
19
|
-
const { $$helloWorldState } =
|
19
|
+
const { $$helloWorldState } = initialStates;
|
20
20
|
|
21
21
|
// Redux expects to initialize the store using an Object, not an Immutable.Map
|
22
22
|
const initialState = {
|
@@ -4,7 +4,7 @@ import { Provider } from 'react-redux';
|
|
4
4
|
import createStore from '../store/helloWorldStore';
|
5
5
|
import HelloWorld from '../containers/HelloWorld';
|
6
6
|
|
7
|
-
// See documentation for https://github.com/
|
7
|
+
// See documentation for https://github.com/reactjs/react-redux.
|
8
8
|
// This is how you get props from the Rails view into the redux store.
|
9
9
|
// This code here binds your smart component to the redux store.
|
10
10
|
// This is how the server redux gets hydrated with data.
|
data/package.json
CHANGED
data/rakelib/dummy_apps.rake
CHANGED
@@ -8,6 +8,12 @@ namespace :dummy_apps do
|
|
8
8
|
sh_in_dir(dummy_app_dir, "npm install")
|
9
9
|
end
|
10
10
|
|
11
|
+
task :dummy_app_with_turbolinks_5 do
|
12
|
+
dummy_app_dir = File.join(gem_root, "spec/dummy")
|
13
|
+
bundle_install_with_turbolinks_5_in(dummy_app_dir)
|
14
|
+
sh_in_dir(dummy_app_dir, "npm install")
|
15
|
+
end
|
16
|
+
|
11
17
|
task dummy_apps: [:dummy_app, :node_package] do
|
12
18
|
puts "Prepared all Dummy Apps"
|
13
19
|
end
|
data/rakelib/run_rspec.rake
CHANGED
@@ -25,6 +25,12 @@ namespace :run_rspec do
|
|
25
25
|
bundle_install_in(dummy_app_dir)
|
26
26
|
end
|
27
27
|
|
28
|
+
desc "Runs dummy respec with turbolinks 5"
|
29
|
+
task dummy_turbolinks_5: ["dummy_apps:dummy_app_with_turbolinks_5"] do
|
30
|
+
run_tests_in(File.join("spec", "dummy"), env_vars:
|
31
|
+
"ENABLE_TURBOLINKS_5=TRUE BUNDLE_GEMFILE=#{dummy_app_dir}/Gemfile")
|
32
|
+
end
|
33
|
+
|
28
34
|
# Dynamically define Rake tasks for each example app found in the examples directory
|
29
35
|
ExampleType.all.each do |example_type|
|
30
36
|
desc "Runs RSpec for #{example_type.name_pretty} only"
|
@@ -46,7 +52,7 @@ namespace :run_rspec do
|
|
46
52
|
Coveralls::RakeTask.new
|
47
53
|
|
48
54
|
desc "run all tests"
|
49
|
-
task run_rspec: [:gem, :dummy, :dummy_no_turbolinks, :examples, :empty, :js_tests] do
|
55
|
+
task run_rspec: [:gem, :dummy, :dummy_no_turbolinks, :dummy_turbolinks_5, :examples, :empty, :js_tests] do
|
50
56
|
puts "Completed all RSpec tests"
|
51
57
|
end
|
52
58
|
end
|
data/rakelib/task_helpers.rb
CHANGED
@@ -28,6 +28,10 @@ module ReactOnRails
|
|
28
28
|
sh_in_dir(dir, "DISABLE_TURBOLINKS=TRUE bundle install")
|
29
29
|
end
|
30
30
|
|
31
|
+
def bundle_install_with_turbolinks_5_in(dir)
|
32
|
+
sh_in_dir(dir, "ENABLE_TURBOLINKS_5=TRUE BUNDLE_GEMFILE=#{dir}/Gemfile bundle install")
|
33
|
+
end
|
34
|
+
|
31
35
|
# Runs bundle exec using that directory's Gemfile
|
32
36
|
def bundle_exec(dir: nil, args: nil, env_vars: "")
|
33
37
|
sh_in_dir(dir, "#{env_vars} #{args}")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.rc.
|
4
|
+
version: 3.0.0.rc.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -445,7 +445,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
445
445
|
version: 1.3.1
|
446
446
|
requirements: []
|
447
447
|
rubyforge_project:
|
448
|
-
rubygems_version: 2.
|
448
|
+
rubygems_version: 2.4.8
|
449
449
|
signing_key:
|
450
450
|
specification_version: 4
|
451
451
|
summary: Rails with react server rendering with webpack.
|