react_on_rails 6.0.0.beta.4 → 6.0.0.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc +4 -0
- data/CHANGELOG.md +19 -10
- data/NEWS.md +2 -0
- data/README.md +8 -2
- data/docs/additional-reading/heroku-deployment.md +11 -0
- data/docs/additional-reading/turbolinks.md +18 -0
- data/lib/generators/react_on_rails/base_generator.rb +2 -1
- data/lib/generators/react_on_rails/templates/base/base/client/REACT_ON_RAILS_CLIENT_README.md +9 -0
- data/lib/generators/react_on_rails/templates/base/base/client/package.json.tt +1 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/HelloWorldApp.jsx.tt +3 -1
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +1 -1
- metadata +3 -3
- data/lib/generators/react_on_rails/templates/base/base/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42d8b62d349c697d5c55c8227150d93a90740525
|
4
|
+
data.tar.gz: 6713ad458f96b0521cbd1a463798be17ecc20f50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03ec907da25dc246f348c183be0a59bfc0fddbbc14090b88b99830a738e68128a6f9df23eca5bb6e6686fa45eeea50fdba956b98e4bf70998213895777bcea4b
|
7
|
+
data.tar.gz: a7a9afdeb827279def4e82d1c6ba147be3ef7ec27dac254087433ef566dd8ec6e4f77ab443f5aa8e3ce1330caefcf175379287ae5568ac24e4aeb3776313e9ce
|
data/.eslintrc
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
All notable changes to this project will be documented in this file. Items under `Unreleased` is upcoming features that will be out in next version.
|
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
|
-
|
6
5
|
## [Unreleased]
|
6
|
+
|
7
|
+
## [6.0.0-rc1]
|
7
8
|
##### Breaking Changes
|
8
9
|
- Added automatic compilation of assets at precompile is now done by ReactOnRails. Thus, you don't need to provide your own assets.rake file that does the precompilation.
|
9
|
-
[#398](https://github.com/shakacode/react_on_rails/pull/398).
|
10
|
-
- Migration: you can either
|
10
|
+
[#398](https://github.com/shakacode/react_on_rails/pull/398) by [robwise](https://github.com/robwise), [jbhatab](https://github.com/jbhatab), and [justin808](https://github.com/justin808).
|
11
|
+
- **Migration to v6: you can either:**
|
11
12
|
|
12
13
|
1. Specify a `config/react_on_rails` setting for `npm_build_production_command` to be nil to turn this feature off.
|
13
14
|
2. Specify the script command you want to run to build your production assets, and remove your assets.rake file.
|
@@ -20,19 +21,25 @@ Here is the addition to the generated config file:
|
|
20
21
|
```
|
21
22
|
|
22
23
|
##### Fixed
|
23
|
-
- Fixed errors when server rendered props contain \u2028 or \u2029 characters [#375](https://github.com/shakacode/react_on_rails/pull/375) by [mariusandra]
|
24
|
+
- Fixed errors when server rendered props contain \u2028 or \u2029 characters [#375](https://github.com/shakacode/react_on_rails/pull/375) by [mariusandra](https://github.com/mariusandra)
|
24
25
|
|
25
26
|
##### Added
|
26
|
-
-
|
27
|
+
- Experimental ability to use node.js process for server rendering. See [#380](https://github.com/shakacode/react_on_rails/pull/380) by [alleycat-at-git](https://github.com/alleycat-at-git).
|
28
|
+
- Non-digested version of assets in public folder [#413](https://github.com/shakacode/react_on_rails/pull/413) by [alleycat-at-git](https://github.com/alleycat-at-git).
|
29
|
+
- Cache client/node_modules directory to prevent Heroku from reinstalling all modules from scratch [#324](https://github.com/shakacode/react_on_rails/pull/324) by [modosc](https://github.com/modosc).
|
30
|
+
- ReactOnRails.reactOnRailsPageLoaded() is exposed in case one needs to call this manually and information on async script loading added. See [#315](https://github.com/shakacode/react_on_rails/pull/315) by [SqueezedLight](https://github.com/SqueezedLight).
|
27
31
|
|
28
32
|
##### Changed
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
33
|
+
- [#398](https://github.com/shakacode/react_on_rails/pull/398) by [robwise](https://github.com/robwise), [jbhatab](https://github.com/jbhatab), and [justin808](https://github.com/justin808) contains:
|
34
|
+
- Only one webpack config is generated for server and client config. Package.json files were changed to reflect this.
|
35
|
+
- Added npm_build_test_command to allow developers to change what npm command is automatically run from rspec.
|
36
|
+
- Replace URI with Addressable gem. See [#405](https://github.com/shakacode/react_on_rails/pull/405) by [lucke84](https://github.com/lucke84)
|
32
37
|
|
33
38
|
##### Removed
|
34
|
-
-
|
35
|
-
-
|
39
|
+
- [#398](https://github.com/shakacode/react_on_rails/pull/398) by [robwise](https://github.com/robwise), [jbhatab](https://github.com/jbhatab), and [justin808](https://github.com/justin808) contains:
|
40
|
+
- Server rendering is no longer an option in the generator and is always accessible.
|
41
|
+
- Removed lodash, jquery, and loggerMiddleware from the generated code.
|
42
|
+
- Removed webpack watch check for test helper automatic compilation.
|
36
43
|
|
37
44
|
## [5.2.0] - 2016-04-08
|
38
45
|
##### Added
|
@@ -310,7 +317,9 @@ Best done with Object destructing:
|
|
310
317
|
|
311
318
|
##### Fixed
|
312
319
|
- Fix several generator related issues.
|
320
|
+
|
313
321
|
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/5.2.0...master
|
322
|
+
[6.0.0-rc.1]: https://github.com/shakacode/react_on_rails/compare/5.2.0...6.0.0-rc.1
|
314
323
|
[5.2.0]: https://github.com/shakacode/react_on_rails/compare/5.1.1...5.2.0
|
315
324
|
[5.1.1]: https://github.com/shakacode/react_on_rails/compare/5.1.0...5.1.1
|
316
325
|
[5.1.0]: https://github.com/shakacode/react_on_rails/compare/5.0.0...5.1.0
|
data/NEWS.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
*We'll keep a history of the news. A few bullets at the top will also show on the [README.md](./README.md).*
|
4
4
|
|
5
5
|
* Always see the [CHANGELOG.md](./CHANGELOG.md) for the latest project changes.
|
6
|
+
|
7
|
+
* 2016-04-08: 5.2.0 Released! Support for React 15.0 and updates to the Generator.
|
6
8
|
* 2016-03-17: **4.0.3** Shipped! Includes using the new Heroku buildpack steps, several smaller changes detailed in the [CHANGELOG.md](./CHANGELOG.md).
|
7
9
|
* 2016-03-17: **4.0.2** Shipped! Includes using the new Heroku buildpack steps.
|
8
10
|
* Better support for hot reloading of assets from Rails with new helpers and updates to the sample testing app, [spec/dummy](spec/dummy).
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/shakacode/react_on_rails.svg?branch=master)](https://travis-ci.org/shakacode/react_on_rails) [![Dependency Status](https://gemnasium.com/shakacode/react_on_rails.svg)](https://gemnasium.com/shakacode/react_on_rails) [![Gem Version](https://badge.fury.io/rb/react_on_rails.svg)](https://badge.fury.io/rb/react_on_rails) [![npm version](https://badge.fury.io/js/react-on-rails.svg)](https://badge.fury.io/js/react-on-rails) [![Code Climate](https://codeclimate.com/github/shakacode/react_on_rails/badges/gpa.svg)](https://codeclimate.com/github/shakacode/react_on_rails) [![Coverage Status](https://coveralls.io/repos/shakacode/react_on_rails/badge.svg?branch=master&service=github)](https://coveralls.io/github/shakacode/react_on_rails?branch=master)
|
2
2
|
|
3
3
|
# NEWS
|
4
|
-
* 2016-
|
4
|
+
* 2016-05-11: 6.0.0-rc.1 Released! Simplified generator and install process! See the [CHANGELOG.md](./CHANGELOG.md) for details.
|
5
5
|
* [New slides on React on Rails](http://www.slideshare.net/justingordon/react-on-rails-v4032).
|
6
6
|
* 2016-02-28: We added a [Projects page](./PROJECTS.md) and a [Kudos page](./KUDOS.md). Please edit the page and add your project or [email us](mailto:contact@shakacode.com) and we'll add you. We also love stars as it helps us attract new users and contributors.
|
7
7
|
* *See [NEWS.md](NEWS.md) for more notes over time.*
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
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://facebook.github.io/react/), [**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
20
|
|
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/reactjs/redux) and [React-Router](https://github.com/reactjs/react-redux) are supported as well, also with server rendering. 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!
|
21
|
+
React on Rails integrates Facebook's [React](https://github.com/facebook/react) front-end framework with Rails. React v0.14.x and greate is supported, with server rendering. [Redux](https://github.com/reactjs/redux) and [React-Router](https://github.com/reactjs/react-redux) are supported as well, also with server rendering. 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
22
|
|
23
23
|
## Including your React Component in your Rails Views
|
24
24
|
Please see [Getting Started](#getting-started) for how to set up your Rails project for React on Rails to understand how `react_on_rails` can see your ReactComponents.
|
@@ -71,6 +71,7 @@ Please see [Getting Started](#getting-started) for how to set up your Rails proj
|
|
71
71
|
- [ReactOnRails View Helpers API](#reactonrails-view-helpers-api)
|
72
72
|
- [ReactOnRails JavaScript API](#reactonrails-javascript-api)
|
73
73
|
- [React-Router](#react-router)
|
74
|
+
- [Deployment](#deployment)
|
74
75
|
+ [Adding Additional Routes for the Dev Server](#adding-additional-routes-for-the-dev-server)
|
75
76
|
+ [Migrate From react-rails](#migrate-from-react-rails)
|
76
77
|
+ [Additional Reading](#additional-reading)
|
@@ -407,6 +408,11 @@ Components are created as [stateless function(al) components](https://facebook.g
|
|
407
408
|
1. [React on Rails docs for react-router](docs/additional-reading/react-router.md)
|
408
409
|
1. Examples in [spec/dummy/app/views/react_router](spec/dummy/app/views/react_router) and follow to the JavaScript code in the [spec/dummy/client/app/startup/ServerRouterApp.jsx](spec/dummy/client/app/startup/ServerRouterApp.jsx).
|
409
410
|
|
411
|
+
## Deployment
|
412
|
+
* Version 6.0 puts the necessary precompile steps automatically in the rake precompile step. You can, however, disable this by setting certain values to nil in the [config/react_on_rails.rb](config/react_on_rails.rb).
|
413
|
+
* See the [Heroku Deployment](docs/additional-reading/heroku-deployment.md) doc for specifics regarding Heroku.
|
414
|
+
* If you're using the node server for server rendering, you may want to do your own AWS install. We'll have more docs on this in the future.
|
415
|
+
|
410
416
|
## Additional Reading
|
411
417
|
+ [JavaScript API](docs/api/javascript-api.md)
|
412
418
|
+ [Ruby API](docs/api/ruby-api.md)
|
@@ -7,6 +7,17 @@ The generator has created the necessary files and gems for deployment to Heroku.
|
|
7
7
|
+ `config/puma.rb`: Puma webserver config file
|
8
8
|
+ `lib/tasks/assets.rake`: This rake task file is provided by the generator regardless of whether the user chose Heroku Deployment as an option. It is highlighted here because it is helpful to understand that this task is what generates your JavaScript bundles in production.
|
9
9
|
|
10
|
+
|
11
|
+
By default Heroku will cache the root `node_modules` directory between deploys but since we're installing in `client/node_modules` you'll need to add the following line to the `package.json` in your root directory (otherwise you'll have to sit through a full `npm install` on each deploy):
|
12
|
+
|
13
|
+
```js
|
14
|
+
"cacheDirectories": [
|
15
|
+
"node_modules",
|
16
|
+
"client/node_modules"
|
17
|
+
],
|
18
|
+
|
19
|
+
```
|
20
|
+
|
10
21
|
## How to Deploy
|
11
22
|
|
12
23
|
React on Rails requires both a ruby environment (for Rails) and a Node environment (for Webpack), so you will need to have Heroku use multiple buildpacks.
|
@@ -28,6 +28,24 @@ Turbolinks 5 is now being supported. React on Rails will automatically detect wh
|
|
28
28
|
|
29
29
|
For more information on Turbolinks 5: [https://github.com/turbolinks/turbolinks](https://github.com/turbolinks/turbolinks)
|
30
30
|
|
31
|
+
### async script loading
|
32
|
+
Generally async script loading can be done like:
|
33
|
+
```erb
|
34
|
+
<%= javascript_include_tag 'application', async: Rails.env.production? %>
|
35
|
+
```
|
36
|
+
If you use ```document.addEventListener("turbolinks:load", function() {...});``` somewhere in your code, you will notice, that Turbolinks 5 does not fire ```turbolinks:load``` on initial page load. A quick workaround is to use ```defer``` instead of ```async```:
|
37
|
+
```erb
|
38
|
+
<%= javascript_include_tag 'application', defer: Rails.env.production? %>
|
39
|
+
```
|
40
|
+
More information on this issue can be found here: https://github.com/turbolinks/turbolinks/issues/28
|
41
|
+
|
42
|
+
When loading your scripts asynchronously you may experience, that your Components are not registered correctly. Call ```ReactOnRails.reactOnRailsPageLoaded()``` to re-initialize like so:
|
43
|
+
```
|
44
|
+
document.addEventListener("turbolinks:load", function() {
|
45
|
+
ReactOnRails.reactOnRailsPageLoaded();
|
46
|
+
});
|
47
|
+
```
|
48
|
+
|
31
49
|
## Troubleshooting
|
32
50
|
To turn on tracing of Turbolinks events, put this in your registration file, where you register your components.
|
33
51
|
|
@@ -66,7 +66,8 @@ module ReactOnRails
|
|
66
66
|
base_path = "base/base/"
|
67
67
|
base_files = %w(app/controllers/hello_world_controller.rb
|
68
68
|
client/.babelrc
|
69
|
-
client/webpack.config.js
|
69
|
+
client/webpack.config.js
|
70
|
+
client/REACT_ON_RAILS_CLIENT_README.md)
|
70
71
|
base_files.each { |file| copy_file(base_path + file, file) }
|
71
72
|
end
|
72
73
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Client folder generated by the React on Rails gem.
|
2
|
+
|
3
|
+
See documentation [at github.com/shakacode/react_on_rails](https://github.com/shakacode/react_on_rails) for details on how it is organized.
|
4
|
+
|
5
|
+
If you need additional help, please consider:
|
6
|
+
|
7
|
+
* [Our ShakaCode Forum for React on Rails](https://forum.shakacode.com/c/rails/reactonrails).
|
8
|
+
* Joining our Slack discussion room by [email us a bit about you and your project](mailto:contact@shakacode.com).
|
9
|
+
* [Hiring us](https://forum.shakacode.com/c/rails/reactonrails) for coaching and custom web application development for your project.
|
@@ -11,6 +11,7 @@
|
|
11
11
|
"build:production": "NODE_ENV=production webpack --config webpack.config.js",
|
12
12
|
"build:development": "webpack -w --config webpack.config.js"
|
13
13
|
},
|
14
|
+
"cacheDirectories": ["node_modules", "client/node_modules"],
|
14
15
|
"dependencies": {
|
15
16
|
"babel": "^6.5.2",
|
16
17
|
"babel-cli": "^6.6.5",
|
@@ -8,7 +8,9 @@ import HelloWorld from '../containers/HelloWorld';
|
|
8
8
|
// See documentation for https://github.com/reactjs/react-redux.
|
9
9
|
// This is how you get props from the Rails view into the redux store.
|
10
10
|
// This code here binds your smart component to the redux store.
|
11
|
-
|
11
|
+
// railsContext provides contextual information especially useful for server rendering, such as
|
12
|
+
// knowing the locale. See the React on Rails documentation for more info on the railsContext
|
13
|
+
const HelloWorldApp = (props, _railsContext) => {
|
12
14
|
const store = createStore(props);
|
13
15
|
const reactComponent = (
|
14
16
|
<Provider store={store}>
|
data/package.json
CHANGED
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: 6.0.0.beta.
|
4
|
+
version: 6.0.0.beta.5
|
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-05-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -373,11 +373,11 @@ files:
|
|
373
373
|
- lib/generators/react_on_rails/install_generator.rb
|
374
374
|
- lib/generators/react_on_rails/react_no_redux_generator.rb
|
375
375
|
- lib/generators/react_on_rails/react_with_redux_generator.rb
|
376
|
-
- lib/generators/react_on_rails/templates/base/base/.DS_Store
|
377
376
|
- lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt
|
378
377
|
- lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb
|
379
378
|
- lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt
|
380
379
|
- lib/generators/react_on_rails/templates/base/base/client/.babelrc
|
380
|
+
- lib/generators/react_on_rails/templates/base/base/client/REACT_ON_RAILS_CLIENT_README.md
|
381
381
|
- lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx.tt
|
382
382
|
- lib/generators/react_on_rails/templates/base/base/client/node/package.json
|
383
383
|
- lib/generators/react_on_rails/templates/base/base/client/node/server.js
|
Binary file
|