react_on_rails 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b65b6529dca9ed1cf1b205cec960efe38885a17
4
- data.tar.gz: e5d5bf65c4c63282de650747d26795f7517b4d3f
3
+ metadata.gz: ff569925f1a426faa8225029a9aafe82ecf5fa79
4
+ data.tar.gz: 4ce5a157fb81a422afa0f180d65fde5ec5a77e8f
5
5
  SHA512:
6
- metadata.gz: 1f9cbb2bada17276368ebae143d7a16c72c7f5fcda30f06bcbaf42049f4bf427af6e3d98f55ed651a212dfd9591f40ac37bbed52adbd2e36b869ca2f86962806
7
- data.tar.gz: e440d984febebef5f5685f447788e83caf01cd1be2486c091a5a6ae5db6fc723a67ff40347098ae95ae5ac94f97790612107e39d35e018fa3bb8afa308af1dc2
6
+ metadata.gz: 001b480c4688afd9509688efce9ae15843a1fff806c743eed38d3a83d8fec795b57ee65f97da805275d1a929be75cff1fbbd67caa31d5a130ae3c9d063da7a0e
7
+ data.tar.gz: c923e3c422e59c109e04f77ccbd27f63473c0927d80258b5b7883eb5fb648a174ec5997f01b166b6a508e8e2d7a2f40bc21edac04bf19e1143027a6c51ad1881
data/CHANGELOG.md CHANGED
@@ -4,10 +4,18 @@ All notable changes to this project will be documented in this file. Items under
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
6
  ## [Unreleased]
7
+
8
+ ## [2.2.0] - 2016-01-29
9
+ ##### Added
10
+ - New JavaScript API for debugging TurboLinks issues. Be sure to see [turbolinks docs](docs/additional_reading/turbolinks.md). `ReactOnRails.setOptions({ traceTurbolinks: true });`. Removed the file `debug_turbolinks` added in 2.1.1. See [#243](https://github.com/shakacode/react_on_rails/pull/243).
11
+
12
+ ## [2.1.1] - 2016-01-28
13
+
7
14
  ##### Fixed
8
15
  - Fixed regression where apps that were not using Turbolinks would not render components on page load.
9
16
 
10
17
  ##### Added
18
+ - `ReactOnRails.render` returns a virtualDomElement Reference to your React component's backing instance. See [#234](https://github.com/shakacode/react_on_rails/pull/234).
11
19
  - `debug_turbolinks` helper for debugging turbolinks issues. See [turbolinks](docs/additional_reading/turbolinks.md).
12
20
  - Enhanced regression testing for non-turbolinks apps. Runs all tests for dummy app with turbolinks both disabled and enabled.
13
21
 
@@ -72,7 +80,7 @@ Best done with Object destructing:
72
80
  - JS Linter uses ShakaCode JavaScript style: https://github.com/shakacode/style-guide-javascript
73
81
  - Generators account these differences.
74
82
 
75
- ##### Migration Steps
83
+ ##### Migration Steps v1 to v2
76
84
  [Example of upgrading](https://github.com/shakacode/react-webpack-rails-tutorial/commit/5b1b8698e8daf0f0b94e987740bc85ee237ef608)
77
85
 
78
86
  1. Update the `react_on_rails` gem.
@@ -82,7 +90,8 @@ Best done with Object destructing:
82
90
  5. Update your index.jade to use the new API `ReactOnRails.render("MyApp", !{props}, 'app');`
83
91
  6. Update your webpack files per the example commit. Remove globally exposing React and ReactDom, as well as their inclusion in the `entry` section. These are automatically included now.
84
92
  7. Run `cd client && npm i --save react-on-rails` to get react-on-rails into your `client/package.json`.
85
- 8. You should also update any other dependencies if possible to match up with the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/).
93
+ 8. You should also update any other dependencies if possible to match up with the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). This includes updating to Babel 6.
94
+ 9. If you want to stick with Babel 5 for a bit, see [Issue #238](https://github.com/shakacode/react_on_rails/issues/238).
86
95
 
87
96
  ---
88
97
 
@@ -119,7 +128,9 @@ Best done with Object destructing:
119
128
  ##### Fixed
120
129
  - Fix several generator related issues.
121
130
 
122
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/v2.1.0...HEAD
131
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/2.2.0...HEAD
132
+ [2.2.0]: https://github.com/shakacode/react_on_rails/compare/2.1.1...2.2.0
133
+ [2.1.1]: https://github.com/shakacode/react_on_rails/compare/v2.1.0...2.1.1
123
134
  [2.1.0]: https://github.com/shakacode/react_on_rails/compare/v2.0.2...v2.1.0
124
135
  [2.0.2]: https://github.com/shakacode/react_on_rails/compare/v2.0.1...v2.0.2
125
136
  [2.0.1]: https://github.com/shakacode/react_on_rails/compare/v2.0.0...v2.0.1
data/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  # NEWS
4
4
 
5
- * 2.1 has shipped on Tuesday, 2/26/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).
5
+ * 2.2 has shipped on Tuesday, 1/29/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).
6
6
  * Highlights:
7
- 1. Fixed a **critical** problem with TurboLinks.
7
+ 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.
8
8
  2. Provides a convenient helper to ensure that JavaScript assets are compiled before running tests.
9
9
  * React on Rails does not yet have *generator* support for building new apps that use CSS modules and hot reloading via the Rails server as is demonstrated in the [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). *We do support this, but we don't generate the code.* If you did generate a fresh app from react_on_rails and want to move to CSS Modules, then see [PR 175: Babel 6 / CSS Modules / Rails hot reloading](https://github.com/shakacode/react-webpack-rails-tutorial/pull/175). Note, while there are probably fixes after this PR was accepted, this has the majority of the changes. See [the tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/#news) for more information. Ping us if you want to help!
10
10
  * [ShakaCode](http://www.shakacode.com) is doing Skype plus Slack/Github based coaching for "React on Rails". [Click here](http://www.shakacode.com/work/index.html) for more information.
@@ -378,6 +378,7 @@ Note: If you have components from react-rails you want to use, then you will nee
378
378
 
379
379
  ## Additional Reading
380
380
  + [The React on Rails Doctrine](http://www.shakacode.com/2016/01/26/the-react-on-rails-doctrine.html)
381
+ + [Babel](docs/additional_reading/babel.md)
381
382
  + [Generated Client Code](docs/additional_reading/generated_client_code.md)
382
383
  + [Heroku Deployment](docs/additional_reading/heroku_deployment.md)
383
384
  + [Manual Installation](docs/additional_reading/manual_installation.md)
@@ -0,0 +1,3 @@
1
+ # Babel
2
+
3
+ As of React on Rails 2.0, we recommend Babel 6. If you want to stick with Babel 5 for a bit, see [Issue #238](https://github.com/shakacode/react_on_rails/issues/238).
@@ -19,8 +19,39 @@ the JavaScript and stylesheets are cached by the browser, as they will still req
19
19
  ```javascript
20
20
  //= require turbolinks
21
21
  ```
22
+ Note, in the future, we might change to installing this via npm.
22
23
 
23
24
  ## Troubleshooting
24
- To turn on tracing of Turbolinks events, require `debug_turbolinks` (provided by ReactOnRails) inside of `app/assets/javascripts/application.js` **at the beginning of the file**. This will print out events related to the initialization of the components created with the view helper `react_component`.
25
+ To turn on tracing of Turbolinks events, put this in your registration file, where you register your components.
26
+
27
+ ```js
28
+ ReactOnRails.setOptions({
29
+ traceTurbolinks: true,
30
+ });
31
+ ```
32
+
33
+ Rather than setting the value to true, you could set it to TRACE_TURBOLINKS, and then you could place this in your `webpack.client.base.config.js`:
34
+
35
+ Define this const at the top of the file:
36
+ ```js
37
+ const devBuild = process.env.NODE_ENV !== 'production';
38
+ ```
39
+
40
+ Add this DefinePlugin option:
41
+ ```js
42
+ plugins: [
43
+ new webpack.DefinePlugin({
44
+ TRACE_TURBOLINKS: devBuild,
45
+ }),
46
+ ```
47
+
48
+ At Webpack compile time, the value of devBuild is inserted into your file.
49
+
50
+ Once you do that, you'll see messages prefixed with **TURBO:** like this in the browser console:
51
+
52
+ ```
53
+ TURBO: WITH TURBOLINKS: document page:before-unload and page:change handlers installed. (program)
54
+ TURBO: reactOnRailsPageLoaded
55
+ ```
25
56
 
26
57
  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.
data/docs/contributing.md CHANGED
@@ -41,13 +41,33 @@ npm i
41
41
  npm run build
42
42
  ```
43
43
 
44
- Use either npm-link (described below), or use a relative path in your `package.json`, like this:
45
-
46
- ```js
47
- "react-on-rails": "../path-to-react-on-rails".
44
+ Use a relative path in your `package.json`, like this:
45
+ ```sh
46
+ cd client
47
+ npm install --save "react-on-rails@../../react_on_rails"
48
48
  ```
49
49
 
50
- If you use a relative path, be sure to run `npm i` whenever you rebuild the node package.
50
+ When you use a relative path, be sure to run the above `npm install` command whenever you change the node package for react-on-rails.
51
+
52
+ Wihle we'd prefer to us `npm link`, we get errors. If you can figure out how to get `npm link react-on-rails` to work with this project, please file an issue or PR! This used to work with babel 5.
53
+
54
+ This is the error:
55
+
56
+ ```
57
+ 16:34:11 rails-client-assets.1 | ERROR in /react_on_rails/node_package/lib/ReactOnRails.js
58
+ 16:34:11 rails-client-assets.1 | Module build failed: ReferenceError: Unknown plugin "react-transform" specified in "base" at 0, attempted to resolve relative to "/react_on_rails/node_package/lib"
59
+ 16:34:11 rails-client-assets.1 | at /react-webpack-rails-tutorial/client/node_modules/babel-core/lib/transformation/file/options/option-manager.js:193:17
60
+ 16:34:11 rails-client-assets.1 | at Array.map (native)
61
+ 16:34:11 rails-client-assets.1 | at Function.normalisePlugins (/react-webpack-rails-tutorial/client/node_modules/babel-core/lib/transformation/file/options/option-manager.js:173:20)
62
+ 16:34:11 rails-client-assets.1 | at OptionManager.mergeOptions (/react-webpack-rails-tutorial/client/node_modules/babel-core/lib/transformation/file/options/option-manager.js:271:36)
63
+ 16:34:11 rails-client-assets.1 | at OptionManager.init (/react-webpack-rails-tutorial/client/node_modules/babel-core/lib/transformation/file/options/option-manager.js:416:10)
64
+ 16:34:11 rails-client-assets.1 | at File.initOptions (/react-webpack-rails-tutorial/client/node_modules/babel-core/lib/transformation/file/index.js:191:75)
65
+ 16:34:11 rails-client-assets.1 | at new File (/react-webpack-rails-tutorial/client/node_modules/babel-core/lib/transformation/file/index.js:122:22)
66
+ 16:34:11 rails-client-assets.1 | at Pipeline.transform (/react-webpack-rails-tutorial/client/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
67
+ 16:34:11 rails-client-assets.1 | at transpile (/react-webpack-rails-tutorial/client/node_modules/babel-loader/index.js:14:22)
68
+ 16:34:11 rails-client-assets.1 | at Object.module.exports (/react-webpack-rails-tutorial/client/node_modules/babel-loader/index.js:88:12)
69
+ 16:34:11 rails-client-assets.1 | @ ./app/bundles/comments/startup/clientRegistration.jsx 15:20-45
70
+ ```
51
71
 
52
72
  # Development Setup for Gem and Node Package Contributors
53
73
 
@@ -164,6 +184,10 @@ All linting is performed from the docker container for CI. You will need docker
164
184
  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.
165
185
 
166
186
  ### Linting Commands
187
+ Run `rake lint`.
188
+
189
+ Alternately with Docker:
190
+
167
191
  Run `rake -D docker` to see all docker linting commands for rake. `rake docker:lint` will run all linters. For individual rake linting commands please refer to `rake -D docker` for the list.
168
192
 
169
193
  You can run specific linting for directories or files by using `docker-compose run lint rubocop (file path or directory)`, etc.
@@ -1,3 +1,3 @@
1
1
  module ReactOnRails
2
- VERSION = "2.1.1".freeze
2
+ VERSION = "2.2.0".freeze
3
3
  end
@@ -61,7 +61,7 @@ module ReactOnRails
61
61
  end
62
62
 
63
63
  def relative_path?
64
- raw.match(/\.\./).present?
64
+ raw.match(%r{(\.\.|\Afile:///)}).present?
65
65
  end
66
66
 
67
67
  def major
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
@@ -50,6 +50,7 @@
50
50
  "symlink-node-package": "node_package/scripts/symlink-node-package",
51
51
  "prepublish": "npm run build",
52
52
  "build": "node_package/scripts/build",
53
+ "build-watch": "$(npm bin)/babel --watch --out-dir node_package/lib node_package/src",
53
54
  "eslint": "eslint . --ext .jsx and .js",
54
55
  "jscs": "jscs . -e -v",
55
56
  "lint": "npm run eslint && npm run jscs",
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: 2.1.1
4
+ version: 2.2.0
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-01-28 00:00:00.000000000 Z
11
+ date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -285,10 +285,10 @@ files:
285
285
  - Gemfile
286
286
  - README.md
287
287
  - Rakefile
288
- - app/assets/javascripts/debug_turbolinks.js
289
288
  - app/helpers/react_on_rails_helper.rb
290
289
  - docker-compose.yml
291
290
  - docs/LICENSE
291
+ - docs/additional_reading/babel.md
292
292
  - docs/additional_reading/heroku_deployment.md
293
293
  - docs/additional_reading/manual_installation.md
294
294
  - docs/additional_reading/node_dependencies_and_npm.md
@@ -1,4 +0,0 @@
1
- window.DEBUG_TURBOLINKS = true;
2
- console.log('window.DEBUG_TURBOLINKS = true;');
3
- console.log('To disable Turbolinks debugging, remove the debug_turbolinks require' +
4
- ' from app/assets/javascripts/application.js');