react_on_rails 8.0.0 → 8.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -9
- data/README.md +8 -11
- data/docs/additional-reading/hot-reloading-rails-development.md +0 -1
- data/docs/api/ruby-api-hot-reload-view-helpers.md +2 -0
- data/docs/basics/installation-overview.md +0 -1
- data/docs/tutorial.md +1 -1
- data/lib/generators/react_on_rails/base_generator.rb +0 -24
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04272c42e87265c2007505eddd7a236c1eddc7ea
|
4
|
+
data.tar.gz: 2e8fe89b83cfe9a3b3ed65823655008e612b79a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 853652ede40c5a0f79fc9d81533ae5240a5c5b610334b7f46fe2b973cab2fa371dc296b1387190b9e1a82c48d60510732c2bfaa8719a3f15635a3c7538b2dcac
|
7
|
+
data.tar.gz: 4782f170a4cde2012df509e22ff88a60c22a669901ea5df7afc43af123a459d9c8a87dbe9916f3376abc99a64a515457f18bd152d3fa27113871388374fe9341
|
data/CHANGELOG.md
CHANGED
@@ -8,11 +8,21 @@ Changes since last non-beta release.
|
|
8
8
|
|
9
9
|
*Please add entries here for your pull requests.*
|
10
10
|
|
11
|
-
## [8.0.
|
12
|
-
|
11
|
+
## [8.0.1]
|
12
|
+
### Fixed
|
13
|
+
- Generator no longer modifies `assets.rb`. [#859](https://github.com/shakacode/react_on_rails/pull/859) by [justin808](https://github.com/justin808)
|
14
|
+
|
15
|
+
## [8.0.0]
|
16
|
+
- Generators and full support for [webpacker_lite](https://github.com/shakacode/webpacker_lite)
|
17
|
+
- No breaking changes to move to 8.0.0 other than the default for this setting changed to nil. If you depended on the default of this setting and are using the asset pipeline (and not webpacker_lite), then add this to your `config/initializers/react_on_rails.rb`:
|
18
|
+
```
|
19
|
+
symlink_non_digested_assets_regex: /\.(png|jpg|jpeg|gif|tiff|woff|ttf|eot|svg|map)/,
|
20
|
+
```
|
21
|
+
- For an example of migration, see: [react-webpack-rails-tutorial PR #395](https://github.com/shakacode/react-webpack-rails-tutorial/pull/395)
|
22
|
+
- For a simple example of the webpacker_lite setup, run the basic generator.
|
13
23
|
|
14
24
|
## [8.0.0-beta.3] - 2017-05-27
|
15
|
-
|
25
|
+
### Changed
|
16
26
|
- Major updates for WebpackerLite 2.0.2. [#844](https://github.com/shakacode/react_on_rails/pull/845) by [justin808](https://github.com/justin808) with help from ](https://github.com/robwise)
|
17
27
|
- Logging no longer occurs when trace is turned to false. [#845](https://github.com/shakacode/react_on_rails/pull/845) by [conturbo](https://github.com/Conturbo)
|
18
28
|
|
@@ -26,9 +36,6 @@ Removed unnecessary values in default paths.yml files for generators. [#834](htt
|
|
26
36
|
### Added
|
27
37
|
Support for WebpackerLite in the generators. [#822](https://github.com/shakacode/react_on_rails/pull/822) by [kaizencodes](https://github.com/kaizencodes) and [justin808](https://github.com/justin808).
|
28
38
|
|
29
|
-
1. You do not need to switch to WebpackerLite to use 8.0.0.
|
30
|
-
2. You can find an upgrade example in [react-webpack-rails-tutorial PR #387](https://github.com/shakacode/react-webpack-rails-tutorial/pull/387).
|
31
|
-
|
32
39
|
### Changed
|
33
40
|
Breaking change is that the default value of symlink_non_digested_assets_regex has changed from this
|
34
41
|
old value to nil. This is a breaking change if you didn't have this value set in your
|
@@ -39,7 +46,6 @@ features and you have not switched to webpacker lite.
|
|
39
46
|
symlink_non_digested_assets_regex: /\.(png|jpg|jpeg|gif|tiff|woff|ttf|eot|svg|map)/,
|
40
47
|
```
|
41
48
|
|
42
|
-
|
43
49
|
## [7.0.4] - 2017-04-27
|
44
50
|
- Return empty json when nil in json_safe_and_pretty [#824](https://github.com/shakacode/react_on_rails/pull/824) by [dzirtusss](https://github.com/dzirtusss)
|
45
51
|
|
@@ -590,8 +596,8 @@ Best done with Object destructing:
|
|
590
596
|
##### Fixed
|
591
597
|
- Fix several generator related issues.
|
592
598
|
|
593
|
-
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/
|
594
|
-
[8.0.0
|
599
|
+
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/8.0.0...master
|
600
|
+
[8.0.0]: https://github.com/shakacode/react_on_rails/compare/7.0.4...8.0.0
|
595
601
|
[8.0.0-beta.3]: https://github.com/shakacode/react_on_rails/compare/8.0.0-beta.2...8.0.0-beta.3
|
596
602
|
[8.0.0-beta.2]: https://github.com/shakacode/react_on_rails/compare/8.0.0-beta.1...8.0.0-beta.2
|
597
603
|
[8.0.0-beta.1]: https://github.com/shakacode/react_on_rails/compare/7.0.4...8.0.0-beta.1
|
data/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/shakacode/react_on_rails.svg?branch=master)](https://travis-ci.org/shakacode/react_on_rails) [![Codeship Status for shakacode/react_on_rails](https://app.codeship.com/projects/cec6c040-971f-0134-488f-0a5146246bd8/status?branch=master)](https://app.codeship.com/projects/187011) [![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
|
-
|
4
|
-
**VERSION 8 is super close!!!**
|
3
|
+
The Docs here on `master` refer to 8.0.0 including support for [webpacker_lite](https://github.com/shakacode/webpacker_lite)! [7.0.4 docs](https://github.com/shakacode/react_on_rails/tree/7.0.4).
|
5
4
|
|
6
|
-
**[VERSION 8.0.0
|
5
|
+
**[VERSION 8.0.0](https://rubygems.org/gems/react_on_rails/versions/8.0.0.beta.3)** has shipped with [webpacker_lite](https://github.com/shakacode/webpacker_lite) support! [react-webpack-rails-tutorial PR #395](https://github.com/shakacode/react-webpack-rails-tutorial/pull/395) shows the changes needed to go to Webpacker Lite.
|
7
6
|
* Why did we fork webpacker to make webpacker_lite? Please provide feedback on my draft article: [Webpacker Lite: Why Did We Fork Webpacker?](https://medium.com/@railsonmaui/webpacker-lite-why-did-we-fork-webpacker-ee3305688d66) (Draft will soon become regular article).
|
8
7
|
|
9
8
|
**For a complete example of this gem, see our live demo at [www.reactrails.com](http://www.reactrails.com). ([Source Code](https://github.com/shakacode/react-webpack-rails-tutorial))**
|
@@ -63,7 +62,7 @@ For more testimonials, see [Live Projects](PROJECTS.md) and [Kudos](./KUDOS.md).
|
|
63
62
|
|
64
63
|
**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 architecture. When considering what goes into **react_on_rails**, we ask ourselves, is the functionality related to the intersection of using Rails and 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).
|
65
64
|
|
66
|
-
React on Rails integrates Facebook's [React](https://github.com/facebook/react) front-end framework with Rails. React v0.14.x and greater 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, using
|
65
|
+
React on Rails integrates Facebook's [React](https://github.com/facebook/react) front-end framework with Rails. React v0.14.x and greater 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, using **execJS**. 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!
|
67
66
|
|
68
67
|
## Table of Contents
|
69
68
|
|
@@ -103,27 +102,25 @@ See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpac
|
|
103
102
|
|
104
103
|
## Why Webpack?
|
105
104
|
|
106
|
-
Webpack is used to generate
|
105
|
+
Webpack is used to generate JavaScript and CSS "bundles" directly to your `/public` directory. [webpacker_lite](https://github.com/shakacode/webpacker_lite) provides view helpers to access the Webpack generated (and fingerprinted) JS and CSS. These files totally skip the Rails asset pipeline. You are responsible for properly processing your Webpack output via the Webpack config files.
|
107
106
|
|
108
|
-
This usage of webpack fits neatly and simply into
|
107
|
+
This usage of webpack fits neatly and simply into existing Rails apps. You can include React components on a Rails view with a simple helper.
|
109
108
|
|
110
109
|
Compare this to some alternative approaches for SPAs (Single Page Apps) that utilize Webpack and Rails. They will use a separate node server to distribute web pages, JavaScript assets, CSS, etc., and will still use Rails as an API server. A good example of this is our ShakaCode team member Alex's article [
|
111
110
|
Universal React with Rails: Part I](https://medium.com/@alexfedoseev/isomorphic-react-with-rails-part-i-440754e82a59).
|
112
111
|
|
113
|
-
We're definitely not doing that. With react_on_rails, webpack is mainly generating a nice JavaScript file for inclusion into `application.js`. We're going to KISS. And that's all relative given how much there is to get right in an enterprise class web application.
|
114
|
-
|
115
112
|
## Upgrade
|
116
113
|
|
117
|
-
To upgrade existing apps to
|
114
|
+
To upgrade existing apps to React on Rails 8 see the [Installation Overview](docs/basics/installation-overview.md)
|
118
115
|
|
119
116
|
## Getting Started
|
120
117
|
|
121
118
|
**For more detailed instructions**, see the [React on Rails Basic Tutorial](docs/tutorial.md).
|
122
119
|
|
123
|
-
1. Add the following to your Gemfile and `bundle install`.
|
120
|
+
1. Add the following to your Gemfile and `bundle install`. We recommend fixing the version of React on Rails, as you will need to keep the exact version in sync with the version in your `client/package.json` file.
|
124
121
|
|
125
122
|
```ruby
|
126
|
-
gem "react_on_rails", "
|
123
|
+
gem "react_on_rails", "8.0.0"
|
127
124
|
```
|
128
125
|
|
129
126
|
2. Commit this to git (you cannot run the generator unless you do this or pass the option `--ignore-warnings`).
|
@@ -31,7 +31,6 @@ The secret sauce is in the [app/views/layouts/application.html.erb](https://gith
|
|
31
31
|
1. Configure the file Rails asset pipeline files:
|
32
32
|
1. [app/assets/javascripts/application_static.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/app/assets/javascripts/application_static.js)
|
33
33
|
1. [app/assets/stylesheets/application_static.css.scss](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/app/assets/stylesheets/application_static.css.scss)
|
34
|
-
1. Be sure your [config/initializers/assets.rb](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/config/initializers/assets.rb) is configured to include the webpack generated files.
|
35
34
|
1. Copy the [client/server-rails-hot.js](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/client/server-rails-hot.js) to the your client directory.
|
36
35
|
1. Copy the scripts in the top level and client level `package.json` files:
|
37
36
|
1. Top Level: [package.json](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/package.json)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
## NOTE: These helpers are NOT needed if using webpacker_lite
|
2
|
+
|
1
3
|
## Hot Reloading View Helpers
|
2
4
|
The `env_javascript_include_tag` and `env_stylesheet_link_tag` support the usage of a webpack dev server for providing the JS and CSS assets during development mode. See the [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/) for a working example.
|
3
5
|
|
@@ -26,7 +26,6 @@ The default path: `public/webpack` can be loaded with webpackConfigLoader as sho
|
|
26
26
|
1. Add `gem "webpacker_lite"` to the Gemfile, run bundle. The gem provides the `stylesheet_pack_tag` and `javascript_pack_tag` helpers which is used to load the bundled assets to your layouts.[Dummy Example](../../spec/dummy/app/views/layouts/application.html.erb)
|
27
27
|
1. Configure the `config/initializers/react_on_rails.rb`. You can adjust some necessary settings and defaults. See file [spec/dummy/config/initializers/react_on_rails.rb](../../spec/dummy/config/initializers/react_on_rails.rb) for a detailed example of configuration, including comments on the different values to configure.
|
28
28
|
1. Configure your Procfiles per the example apps. These are at the root of your Rails installation.
|
29
|
-
1. Configure `config/initializers/assets.rb` probably like [spec/dummy/config/initializers/assets.rb](../../spec/dummy/config/initializers/assets.rb). This example shows what's necessary if you're enabling the hot-reloading Rails development option.
|
30
29
|
1. Configure your top level JavaScript files for inclusion in your layout. You'll want a version that you use for static assets, and you want a file for any files in your setup that are not part of your webpack build. The reason for this is for use with hot-reloading. If you are not using hot reloading, then you only need to configure your `application.js` file to include your Webpack generated files. For more information on hot reloading, see [Hot Reloading of Assets For Rails Development](../additional-reading/hot-reloading-rails-development.md)
|
31
30
|
|
32
31
|
1. Configure your `lib/tasks/assets.rake` file to run webpack during asset precompilation.
|
data/docs/tutorial.md
CHANGED
@@ -51,7 +51,7 @@ cd test-react-on-rails
|
|
51
51
|
Add **React On Rails** gem to your Gemfile (`vim Gemfile` or `nano Gemfile` or in IDE):
|
52
52
|
|
53
53
|
```
|
54
|
-
gem 'react_on_rails', '
|
54
|
+
gem 'react_on_rails', '8.0.0' # use latest gem version, prefer exact version
|
55
55
|
```
|
56
56
|
|
57
57
|
![02](https://cloud.githubusercontent.com/assets/20628911/17464919/3c2d74c2-5cf2-11e6-8704-a84958832fbb.png)
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# rubocop:disable Metrics/ClassLength
|
2
|
-
|
3
1
|
require "rails/generators"
|
4
2
|
require_relative "generator_messages"
|
5
3
|
require_relative "generator_helper"
|
@@ -74,28 +72,6 @@ module ReactOnRails
|
|
74
72
|
append_to_file("Gemfile", "\ngem 'mini_racer', platforms: :ruby\ngem 'webpacker_lite'\n")
|
75
73
|
end
|
76
74
|
|
77
|
-
ASSETS_RB_APPEND = <<-DATA.strip_heredoc
|
78
|
-
# Add client/assets/ folders to asset pipeline's search path.
|
79
|
-
# If you do not want to move existing images and fonts from your Rails app
|
80
|
-
# you could also consider creating symlinks there that point to the original
|
81
|
-
# rails directories. In that case, you would not add these paths here.
|
82
|
-
# If you have a different server bundle file than your client bundle, you'll
|
83
|
-
# need to add it here, like this:
|
84
|
-
# Rails.application.config.assets.precompile += %w( server-bundle.js )
|
85
|
-
|
86
|
-
# Add folder with webpack generated assets to assets.paths
|
87
|
-
Rails.application.config.assets.paths << Rails.root.join("public", "webpack", Rails.env)
|
88
|
-
DATA
|
89
|
-
|
90
|
-
def append_to_assets_initializer
|
91
|
-
assets_initializer = File.join(destination_root, "config/initializers/assets.rb")
|
92
|
-
if File.exist?(assets_initializer)
|
93
|
-
append_to_file(assets_initializer, ASSETS_RB_APPEND)
|
94
|
-
else
|
95
|
-
create_file(assets_initializer, ASSETS_RB_APPEND)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
75
|
def append_to_spec_rails_helper
|
100
76
|
rails_helper = File.join(destination_root, "spec/rails_helper.rb")
|
101
77
|
if File.exist?(rails_helper)
|
data/package.json
CHANGED