Skip to content

Commit 3657729

Browse files
authored
Merge pull request #798 from BookOfGreg/update-react-15-to-no-deprecations
Correct all deprecation warnings in addons
2 parents e2b435d + bac7702 commit 3657729

File tree

91 files changed

+4028
-4519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+4028
-4519
lines changed

Appraisals

+7-6
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ appraise 'rails-4.0.5' do
1515
gem 'turbolinks'
1616
end
1717

18-
appraise 'rails-4.0-with-therubyracer' do
18+
appraise 'rails-4.0-with-mini_racer' do
1919
gem 'rails', '~> 4.0.13'
20-
gem 'therubyracer', '0.12.0', :platforms => :mri
20+
gem 'mini_racer', :platforms => :mri
21+
gem 'therubyrhino', :platforms => :jruby
2122
gem 'turbolinks'
2223
end
2324

@@ -55,7 +56,7 @@ appraise 'rails-5_no_sprockets_webpacker_1_1' do
5556
gem 'webpacker', '~> 1.1.0'
5657
# This ExecJS backend provides stateful context
5758
# which the default nodejs backend does not
58-
gem 'therubyracer', :platforms => :mri
59+
gem 'mini_racer', :platforms => :mri
5960
gem 'therubyrhino', :platforms => :jruby
6061
end
6162

@@ -64,7 +65,7 @@ appraise 'rails-5_no_sprockets_webpacker_1_x' do
6465
gem 'webpacker', '~> 1.2'
6566
# This ExecJS backend provides stateful context
6667
# which the default nodejs backend does not
67-
gem 'therubyracer', :platforms => :mri
68+
gem 'mini_racer', :platforms => :mri
6869
gem 'therubyrhino', :platforms => :jruby
6970
end
7071

@@ -73,7 +74,7 @@ appraise 'rails-5_no_sprockets_webpacker_2' do
7374
gem 'webpacker', '~> 2.0'
7475
# This ExecJS backend provides stateful context
7576
# which the default nodejs backend does not
76-
gem 'therubyracer', :platforms => :mri
77+
gem 'mini_racer', :platforms => :mri
7778
gem 'therubyrhino', :platforms => :jruby
7879
end
7980

@@ -82,7 +83,7 @@ appraise 'rails-5_no_sprockets_webpacker_3' do
8283
gem 'webpacker', '>= 3.0'
8384
# This ExecJS backend provides stateful context
8485
# which the default nodejs backend does not
85-
gem 'therubyracer', :platforms => :mri
86+
gem 'mini_racer', :platforms => :mri
8687
gem 'therubyrhino', :platforms => :jruby
8788
end
8889

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22

33
#### Breaking Changes
44

5+
- React Deprecations for 15.4, 15.5, 15.6 in preparation for 16 handled in prebundled version
6+
57
#### New Features
68

9+
- Generator now makes modern style `createReactClass`(JS) or `extends React.Component`(ES6, CoffeeScript) code
10+
711
#### Deprecation
812

13+
- Next version will drop the addons option as they are not supported with React 16
14+
- TheRubyRacer's newest version (0.12.3 at time of writing) only supports libV8 (3.16.14.15) which is too old for some new JS features, future versions of this gem will need more modern ExecJS runtimes such as mini_racer (currently on libV8 5.9.x)
15+
916
#### Bug Fixes
1017

1118
## 2.3.0

README.md

+6-15
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Now, you can create React components in `.jsx` files:
9999
```js
100100
// app/assets/javascripts/components/post.jsx
101101

102-
window.Post = React.createClass({
102+
window.Post = createReactClass({
103103
render: function() {
104104
return <h1>{this.props.title}</h1>
105105
}
@@ -139,15 +139,6 @@ Components must be accessible from the top level, but they may be namespaced, fo
139139

140140
`//= require react` brings `React` into your project.
141141

142-
To include `React.addons`, add this config:
143-
144-
```ruby
145-
# config/application.rb
146-
MyApp::Application.configure do
147-
config.react.addons = true # defaults to false
148-
end
149-
```
150-
151142
By default, React's [development version] is provided to `Rails.env.development`. You can override the React build with a config:
152143

153144
```ruby
@@ -395,11 +386,11 @@ rails g react:component Post title:string published:bool published_by:instanceOf
395386
would generate:
396387

397388
```js
398-
var Post = React.createClass({
389+
var Post = createReactClass({
399390
propTypes: {
400-
title: React.PropTypes.string,
401-
published: React.PropTypes.bool,
402-
publishedBy: React.PropTypes.instanceOf(Person)
391+
title: PropTypes.string,
392+
published: PropTypes.bool,
393+
publishedBy: PropTypes.instanceOf(Person)
403394
},
404395

405396
render: function() {
@@ -411,7 +402,7 @@ var Post = React.createClass({
411402
</div>
412403
);
413404
}
414-
});
405+
};
415406
```
416407
417408
The generator also accepts options:
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file was generated by Appraisal
2+
3+
source "http://rubygems.org"
4+
5+
gem "rails", "~> 4.0.13"
6+
gem "mini_racer", platforms: :mri
7+
gem "therubyrhino", platforms: :jruby
8+
gem "turbolinks"
9+
10+
gemspec path: "../"

gemfiles/rails_5_no_sprockets_webpacker_1_1.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source "http://rubygems.org"
44

55
gem "rails", "~> 5.0.0"
66
gem "webpacker", "~> 1.1.0"
7-
gem "therubyracer", platforms: :mri
7+
gem "mini_racer", platforms: :mri
88
gem "therubyrhino", platforms: :jruby
99

1010
gemspec path: "../"

gemfiles/rails_5_no_sprockets_webpacker_1_x.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source "http://rubygems.org"
44

55
gem "rails", "~> 5.0.0"
66
gem "webpacker", "~> 1.2"
7-
gem "therubyracer", platforms: :mri
7+
gem "mini_racer", platforms: :mri
88
gem "therubyrhino", platforms: :jruby
99

1010
gemspec path: "../"

gemfiles/rails_5_no_sprockets_webpacker_2.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source "http://rubygems.org"
44

55
gem "rails", "~> 5.0.0"
66
gem "webpacker", "~> 2.0"
7-
gem "therubyracer", platforms: :mri
7+
gem "mini_racer", platforms: :mri
88
gem "therubyrhino", platforms: :jruby
99

1010
gemspec path: "../"

gemfiles/rails_5_no_sprockets_webpacker_3.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source "http://rubygems.org"
44

55
gem "rails", "~> 5.0.0"
66
gem "webpacker", ">= 3.0"
7-
gem "therubyracer", platforms: :mri
7+
gem "mini_racer", platforms: :mri
88
gem "therubyrhino", platforms: :jruby
99

1010
gemspec path: "../"

lib/assets/javascripts/JSXTransformer.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -15708,22 +15708,22 @@ function addDisplayName(displayName, object, state) {
1570815708
/**
1570915709
* Transforms the following:
1571015710
*
15711-
* var MyComponent = React.createClass({
15711+
* var MyComponent = createReactClass({
1571215712
* render: ...
1571315713
* });
1571415714
*
1571515715
* into:
1571615716
*
15717-
* var MyComponent = React.createClass({
15717+
* var MyComponent = createReactClass({
1571815718
* displayName: 'MyComponent',
1571915719
* render: ...
1572015720
* });
1572115721
*
1572215722
* Also catches:
1572315723
*
15724-
* MyComponent = React.createClass(...);
15725-
* exports.MyComponent = React.createClass(...);
15726-
* module.exports = {MyComponent: React.createClass(...)};
15724+
* MyComponent = createReactClass(...);
15725+
* exports.MyComponent = createReactClass(...);
15726+
* module.exports = {MyComponent: createReactClass(...)};
1572715727
*/
1572815728
function visitReactDisplayName(traverse, object, path, state) {
1572915729
var left, right;
@@ -15916,4 +15916,4 @@ function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {
1591615916
module.exports = inlineSourceMap;
1591715917

1591815918
},{"buffer":3}]},{},[1])(1)
15919-
});
15919+
});

0 commit comments

Comments
 (0)