react_on_rails 7.1.0.beta.2 → 7.1.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1273f61f1bc33677b1ab053a5432ab1797b3aa70
4
- data.tar.gz: e553275faa1621d6b44f2691a27fe8b6fce64f0c
3
+ metadata.gz: 8937d7710f0d1a0c426c61b339b088d812f5ae62
4
+ data.tar.gz: 38981df2dd2fff9a935055ebe1904b9662796f13
5
5
  SHA512:
6
- metadata.gz: 52473eeade602da8c27f78f9c35e0cd9e74d5fc6cd5d38004ada1895330169a2bd16f757ca4f450a501c5ef663fdb5824f0940955c0a4f14ed7a9d98a3805c16
7
- data.tar.gz: d580c8d6f8cb1d164b60f8112a3d96c8664fdf025b7012ef8d4741a1f09e8eb68a82c8331db6b2d5abb1c12413d1e89c378688f246e16df20ab9f621e15bf72e
6
+ metadata.gz: 7563a966d91a544d9ecc9943e78ad219eb0a5b7d4c5c3e1cc3de6fa237def9395746f09a08cedb72c4d1276bbb43172a596c86dbd7b1f480bd37277c6842b82d
7
+ data.tar.gz: 4359cc293b9cdace819e1002d77e82459f8cf8a41c9600f72ca0bf80072fc054b3535cd6f93c557cf286ff4efb3bf8daf93c02ef660960efe630edce09e3c0f2
data/CHANGELOG.md CHANGED
@@ -6,6 +6,9 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
6
6
  ## [Unreleased]
7
7
  *Please add entries here for your pull requests.*
8
8
 
9
+ ## [7.0.4] - 2017-04-27
10
+ - 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)
11
+
9
12
  ## [7.0.3] - 2017-04-27
10
13
  Same as 7.0.1.
11
14
 
@@ -553,7 +556,8 @@ Best done with Object destructing:
553
556
  ##### Fixed
554
557
  - Fix several generator related issues.
555
558
 
556
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/7.0.3...master
559
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/7.0.4...master
560
+ [7.0.4]: https://github.com/shakacode/react_on_rails/compare/7.0.3...7.0.4
557
561
  [7.0.3]: https://github.com/shakacode/react_on_rails/compare/7.0.1...7.0.3
558
562
  [7.0.1]: https://github.com/shakacode/react_on_rails/compare/7.0.0...7.0.1
559
563
  [7.0.0]: https://github.com/shakacode/react_on_rails/compare/6.10.1...7.0.0
data/PROJECTS.md CHANGED
@@ -20,6 +20,7 @@
20
20
  * **[Foxford.ru](http://foxford.ru/)**: Online School ![2016-12-17_13-23-21](https://cloud.githubusercontent.com/assets/1118459/21290377/1adacdf2-c45c-11e6-97c1-f726ab749b2d.png)
21
21
  * **[CareerBuilder for Employers](https://hiring.careerbuilder.com/)**: CareerBuilder's marketing/ecommerce website. We've integrated React on Rails and have deployed the application via Cloud 66, and are busy integrating this into other projects!
22
22
  * **[Josephine](https://www.josephine.com)**: The private network for home cooked meals.
23
+ * **[first](https://first.io/)**: Data-driven Relational Marketing for Real Estate.
23
24
 
24
25
  ## Open Source Projects Live
25
26
  * [github.com/empirical-org/Empirical-Core](https://github.com/empirical-org/Empirical-Core): [Quill.org](https://quill.org/) Provides free tools to make your students better writers.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **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))**
4
4
 
5
- **Speaking!**: Justin is speaking [GORUCO](http://goruco.com/#speakers) on Saturday, June 24, 2017 in NYC: "Front-End Sadness to Happiness: The React on Rails Story". [Email Justin](mailto:justin@shakacode.com) to give this talk at your local meetup or company. [Subscribe](https://app.mailerlite.com/webforms/landing/l1d9x5) to be notified of local and *online* presentations of this talk.
5
+ **Speaking!**: Justin is speaking [GORUCO](http://goruco.com/#speakers) on Saturday, June 24, 2017 in NYC: "Front-End Sadness to Happiness: The React on Rails Story". [Email Justin](mailto:justin@shakacode.com) to give this talk at your local meetup or company. [Subscribe](https://app.mailerlite.com/webforms/landing/l1d9x5) to be notified of local and *online* presentations of this talk.
6
6
 
7
7
  **Aloha from Justin Gordon** ([bio](http://www.railsonmaui.com/about)) and the [ShakaCode](http://www.shakacode.com) Team! We're actively looking for new projects involving React, React-Native, and Rails, including conversion of AngularJs to React. Please [contact me](mailto:justin@shakacode.com) if we could potentially help you in any way. Besides consulting on bigger projects, [ShakaCode](http://www.shakacode.com) is doing ScreenHero plus Slack/Github based [coaching](http://www.shakacode.com/work/shakacode-coaching-plan.pdf) for React on Rails. See our blog post [Can ShakaCode Help You?](https://blog.shakacode.com/can-shakacode-help-you-4a5b1e5a8a63#.jex6tg9w9) for more information.
8
8
 
@@ -49,7 +49,7 @@ For more testimonials, see [Live Projects](PROJECTS.md) and [Kudos](./KUDOS.md).
49
49
  * [284 Ruby Rogues: React on Rails with Justin Gordon and Rob Wise](https://devchat.tv/ruby-rogues/284-rr-react-on-rails-with-justin-gordon-and-rob-wise)
50
50
 
51
51
  # NEWS
52
- * 2017-04-25: 7.0.0 Shipped! Performance improvements! Please upgrade! Only "breaking" change is that you have to update both the node module and the Ruby gem.
52
+ * 2017-04-25: 7.0.0 Shipped! Performance improvements! Please upgrade! Only "breaking" change is that you have to update both the node module and the Ruby gem.
53
53
  * 2017-04-09: 8.0.0 beta work to include webpacker_lite gem has begun. See [#786](https://github.com/shakacode/react_on_rails/issues/786).
54
54
  * *See [NEWS.md](NEWS.md) for more notes over time.*
55
55
 
@@ -106,6 +106,10 @@ Universal React with Rails: Part I](https://medium.com/@alexfedoseev/isomorphic-
106
106
 
107
107
  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.
108
108
 
109
+ ## Upgrade
110
+
111
+ To upgrade existing apps to react on rails 7 see the [Installation Overview](docs/basics/installation-overview.md)
112
+
109
113
  ## Getting Started
110
114
 
111
115
  **For more detailed instructions**, see the [React on Rails Basic Tutorial](docs/tutorial.md).
@@ -113,7 +117,7 @@ We're definitely not doing that. With react_on_rails, webpack is mainly generati
113
117
  1. Add the following to your Gemfile and `bundle install`.
114
118
 
115
119
  ```ruby
116
- gem "react_on_rails", "~> 6"
120
+ gem "react_on_rails", "~> 7"
117
121
  ```
118
122
 
119
123
  2. Commit this to git (you cannot run the generator unless you do this or pass the option `--ignore-warnings`).
@@ -144,9 +148,9 @@ We're definitely not doing that. With react_on_rails, webpack is mainly generati
144
148
  foreman start -f Procfile.dev
145
149
  ```
146
150
 
147
- 8. Visit [localhost:5000/hello_world](http://localhost:5000/hello_world). Note, `foreman` defaults to PORT 5000 unless you set the value of PORT in your environment. For example, you can `export PORT=3000` to use the Rails default port of 3000.
151
+ 8. Visit [localhost:3000/hello_world](http://localhost:3000/hello_world). Note, `foreman` defaults to PORT 5000 unless you set the value of PORT in your environment. For example, you can `export PORT=3000` to use the Rails default port of 3000. For the hello_world example this is already set.
148
152
 
149
- ### Installation Summary
153
+ ### Installation Overview
150
154
 
151
155
  See the [Installation Overview](docs/basics/installation-overview.md) for a concise set summary of what's in a React on Rails installation.
152
156
 
@@ -159,20 +163,20 @@ Configure the `config/initializers/react_on_rails.rb`. You can adjust some neces
159
163
  + *Normal Mode (React component will be rendered on client):*
160
164
 
161
165
  ```erb
162
- <%= react_component("HelloWorldApp", props: @some_props) %>
166
+ <%= react_component("HelloWorld", props: @some_props) %>
163
167
  ```
164
168
  + *Server-Side Rendering (React component is first rendered into HTML on the server):*
165
169
 
166
170
  ```erb
167
- <%= react_component("HelloWorldApp", props: @some_props, prerender: true) %>
171
+ <%= react_component("HelloWorld", props: @some_props, prerender: true) %>
168
172
  ```
169
173
 
170
- + The `component_name` parameter is a string matching the name you used to expose your React component globally. So, in the above examples, if you had a React component named "HelloWorldApp," you would register it with the following lines:
174
+ + The `component_name` parameter is a string matching the name you used to expose your React component globally. So, in the above examples, if you had a React component named "HelloWorld," you would register it with the following lines:
171
175
 
172
176
  ```js
173
177
  import ReactOnRails from 'react-on-rails';
174
- import HelloWorldApp from './HelloWorldApp';
175
- ReactOnRails.register({ HelloWorldApp });
178
+ import HelloWorld from './HelloWorld';
179
+ ReactOnRails.register({ HelloWorld });
176
180
  ```
177
181
 
178
182
  Exposing your component in this way is how React on Rails is able to reference your component from a Rails view. You can expose as many components as you like, as long as their names do not collide. See below for the details of how you expose your components via the react_on_rails webpack configuration.
@@ -181,7 +185,7 @@ Configure the `config/initializers/react_on_rails.rb`. You can adjust some neces
181
185
 
182
186
  ```ruby
183
187
  # Rails View
184
- <%= react_component("HelloWorldApp", props: { name: "Stranger" }) %>
188
+ <%= react_component("HelloWorld", props: { name: "Stranger" }) %>
185
189
  ```
186
190
 
187
191
  ```javascript
@@ -222,7 +226,7 @@ In the following screenshot you can see the 3 parts of React on Rails rendering:
222
226
  2. The wrapper div `<div id="HelloWorld-react-component-0">` specifies the div where to place the React rendering. It encloses the server-rendered HTML for the React component
223
227
  3. Additional JavaScript is placed to console log any messages, such as server rendering errors. Note, these server side logs can be configured to only be sent to the server logs.
224
228
 
225
- **Note**:
229
+ **Note**:
226
230
 
227
231
  * If server rendering is not used (prerender: false), then the major difference is that the HTML rendered for the React component only contains the outer div: `<div id="HelloWorld-react-component-0"/>`. The first specification of the React component is just the same.
228
232
  * The below image is not yet updated for version 7.0.0 which uses a `<script>` tag for the props. Instead of a hidden div, we have the props inside of the a `<script>` tag.
@@ -323,7 +327,7 @@ Place your JavaScript code inside of the provided `client/app` folder. Use modul
323
327
  This is an example of how to expose a component to the `react_component` view helper.
324
328
 
325
329
  ```javascript
326
- // client/app/bundles/HelloWorld/startup/HelloWorldApp.jsx
330
+ // client/app/bundles/HelloWorld/startup/HelloWorld.jsx
327
331
  import HelloWorld from '../components/HelloWorld';
328
332
  import ReactOnRails from 'react-on-rails';
329
333
  ReactOnRails.register({ HelloWorld });
@@ -333,7 +337,7 @@ This is an example of how to expose a component to the `react_component` view he
333
337
 
334
338
  You may want different initialization for your server rendered components. For example, if you have animation that runs when a component is displayed, you might need to turn that off when server rendering. However, the `railsContext` will tell you if your JavaScript code is running client side or server side. So code that required a different server bundle previously may no longer require this!
335
339
 
336
- If you do want different code to run, you'd setup a separate webpack compilation file and you'd specify a different, server side entry file. ex. 'serverHelloWorldApp.jsx'. Note, you might be initializing HelloWorld with version specialized for server rendering.
340
+ If you do want different code to run, you'd setup a separate webpack compilation file and you'd specify a different, server side entry file. ex. 'serverHelloWorld.jsx'. Note, you might be initializing HelloWorld with version specialized for server rendering.
337
341
 
338
342
  #### Generator Functions
339
343
  Why would you create a function that returns a React component? For example, you may want the ability to use the passed-in props to initialize a redux store or setup react-router. Or you may want to return different components depending on what's in the props. ReactOnRails will automatically detect a registered generator function.
@@ -231,7 +231,7 @@ module ReactOnRailsHelper
231
231
  end
232
232
 
233
233
  def json_safe_and_pretty(hash_or_string)
234
- return if hash_or_string.nil?
234
+ return "{}" if hash_or_string.nil?
235
235
  unless hash_or_string.class.in?([Hash, String])
236
236
  raise "#{__method__} only accepts String or Hash as argument "\
237
237
  "(#{hash_or_string.class} given)."
@@ -1,6 +1,6 @@
1
1
  # Installation Overview
2
2
 
3
- Here's an overview of installation if you're not using the generator.
3
+ Here's an overview of installation if you're not using the generator.
4
4
 
5
5
  Note, the best way to understand how to use ReactOnRails is to study the examples:
6
6
 
@@ -9,23 +9,26 @@ Note, the best way to understand how to use ReactOnRails is to study the example
9
9
 
10
10
  ## Configure the `/client` Directory
11
11
 
12
- This directory has no references to Rails outside of the destination directory for the files created by the various Webpack config files.
12
+ This directory has no references to Rails outside of the destination directory for the files created by the various Webpack config files.
13
13
 
14
14
  The only requirements within this directory for basic React on Rails integration are:
15
15
 
16
16
  1. Your webpack configuration files:
17
- 1. Create outputs in a directory like `/app/assets/webpack`, which is customizable in your `config/initializers/react_on_rails.rb`.
17
+ 1. Create outputs in a directory like `/public/webpack`, which is customizable in your `config/initializers/react_on_rails.rb`.
18
18
  1. Provide server rendering if you wish to use that feature.
19
19
  1. Your JavaScript code "registers" any components and stores per the ReactOnRails APIs of ReactOnRails.register(components) and ReactOnRails.registerStore(stores). See API docs in [README.md](../../README.md) and the [ReactOnRails.js source](../../node_package/src/ReactOnRails.js).
20
20
  1. Set your registration file as an "entry" point in your Webpack configs.
21
+ 1. Add the [Manifest plugin](https://github.com/danethurber/webpack-manifest-plugin) to your config. For examples see [dummy config](../../spec/dummy/client/webpack.client.base.config.js).
22
+ The default path: `public/webpack` can be loaded with webpackConfigLoader as shown in the dummy example.
21
23
  1. You create scripts in `client/package.json` per the example apps. These are used for building your Webpack assets. Also do this for your top level `package.json`.
22
24
 
23
25
  ## Rails Steps (outside of /client)
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)
24
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.
25
28
  1. Configure your Procfiles per the example apps. These are at the root of your Rails installation.
26
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.
27
30
  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)
28
-
31
+
29
32
  1. Configure your `lib/tasks/assets.rake` file to run webpack during asset precompilation.
30
33
  1. If you are deploying to Heroku, see [heroku-deployment.md](/docs/additional-reading/heroku-deployment.md)
31
34
 
@@ -1,2 +1,2 @@
1
1
  web: rails s -p 3000
2
- client: sh -c 'rm app/assets/webpack/* || true && cd client && bundle exec rake react_on_rails:locale && yarn run build:development'
2
+ client: sh -c 'rm -rf public/webpack/* || true && cd client && bundle exec rake react_on_rails:locale && yarn run build:development'
@@ -4,7 +4,7 @@ module ReactOnRails
4
4
  setup_config_values
5
5
  end
6
6
 
7
- DEFAULT_GENERATED_ASSETS_DIR = File.join(%w[public webpack], Rails.env).freeze
7
+ DEFAULT_GENERATED_ASSETS_DIR = File.join(%w(public webpack), Rails.env).freeze
8
8
 
9
9
  def self.setup_config_values
10
10
  ensure_webpack_generated_files_exists
@@ -1,3 +1,3 @@
1
1
  module ReactOnRails
2
- VERSION = "7.1.0.beta.2".freeze
2
+ VERSION = "7.1.0.beta.3".freeze
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "7.1.0-beta.2",
3
+ "version": "7.1.0-beta.3",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
@@ -66,7 +66,7 @@ namespace :run_rspec do
66
66
  end
67
67
 
68
68
  desc "run all tests no examples"
69
- task all_but_examples: [:gem, :dummy, :dummy_no_turbolinks, :dummy_turbolinks_2, :empty, :js_tests] do
69
+ task all_but_examples: [:gem, :dummy_no_turbolinks, :dummy_turbolinks_2, :dummy, :empty, :js_tests] do
70
70
  puts "Completed all RSpec tests"
71
71
  end
72
72
 
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: 7.1.0.beta.2
4
+ version: 7.1.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-27 00:00:00.000000000 Z
11
+ date: 2017-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool