Skip to content

Correct all deprecation warnings in addons #798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -15,9 +15,10 @@ appraise 'rails-4.0.5' do
gem 'turbolinks'
end

appraise 'rails-4.0-with-therubyracer' do
appraise 'rails-4.0-with-mini_racer' do
gem 'rails', '~> 4.0.13'
gem 'therubyracer', '0.12.0', :platforms => :mri
gem 'mini_racer', :platforms => :mri
gem 'therubyrhino', :platforms => :jruby
gem 'turbolinks'
end

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

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

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

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

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,10 +2,17 @@

#### Breaking Changes

- React Deprecations for 15.4, 15.5, 15.6 in preparation for 16 handled in prebundled version

#### New Features

- Generator now makes modern style `createReactClass`(JS) or `extends React.Component`(ES6, CoffeeScript) code

#### Deprecation

- Next version will drop the addons option as they are not supported with React 16
- 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)

#### Bug Fixes

## 2.3.0
21 changes: 6 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ Now, you can create React components in `.jsx` files:
```js
// app/assets/javascripts/components/post.jsx

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

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

To include `React.addons`, add this config:

```ruby
# config/application.rb
MyApp::Application.configure do
config.react.addons = true # defaults to false
end
```

By default, React's [development version] is provided to `Rails.env.development`. You can override the React build with a config:

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

```js
var Post = React.createClass({
var Post = createReactClass({
propTypes: {
title: React.PropTypes.string,
published: React.PropTypes.bool,
publishedBy: React.PropTypes.instanceOf(Person)
title: PropTypes.string,
published: PropTypes.bool,
publishedBy: PropTypes.instanceOf(Person)
},

render: function() {
@@ -411,7 +402,7 @@ var Post = React.createClass({
</div>
);
}
});
};
```

The generator also accepts options:
10 changes: 10 additions & 0 deletions gemfiles/rails_4.0_with_mini_racer.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "rails", "~> 4.0.13"
gem "mini_racer", platforms: :mri
gem "therubyrhino", platforms: :jruby
gem "turbolinks"

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5_no_sprockets_webpacker_1_1.gemfile
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ source "http://rubygems.org"

gem "rails", "~> 5.0.0"
gem "webpacker", "~> 1.1.0"
gem "therubyracer", platforms: :mri
gem "mini_racer", platforms: :mri
gem "therubyrhino", platforms: :jruby

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5_no_sprockets_webpacker_1_x.gemfile
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ source "http://rubygems.org"

gem "rails", "~> 5.0.0"
gem "webpacker", "~> 1.2"
gem "therubyracer", platforms: :mri
gem "mini_racer", platforms: :mri
gem "therubyrhino", platforms: :jruby

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5_no_sprockets_webpacker_2.gemfile
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ source "http://rubygems.org"

gem "rails", "~> 5.0.0"
gem "webpacker", "~> 2.0"
gem "therubyracer", platforms: :mri
gem "mini_racer", platforms: :mri
gem "therubyrhino", platforms: :jruby

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5_no_sprockets_webpacker_3.gemfile
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ source "http://rubygems.org"

gem "rails", "~> 5.0.0"
gem "webpacker", ">= 3.0"
gem "therubyracer", platforms: :mri
gem "mini_racer", platforms: :mri
gem "therubyrhino", platforms: :jruby

gemspec path: "../"
12 changes: 6 additions & 6 deletions lib/assets/javascripts/JSXTransformer.js
Original file line number Diff line number Diff line change
@@ -15708,22 +15708,22 @@ function addDisplayName(displayName, object, state) {
/**
* Transforms the following:
*
* var MyComponent = React.createClass({
* var MyComponent = createReactClass({
* render: ...
* });
*
* into:
*
* var MyComponent = React.createClass({
* var MyComponent = createReactClass({
* displayName: 'MyComponent',
* render: ...
* });
*
* Also catches:
*
* MyComponent = React.createClass(...);
* exports.MyComponent = React.createClass(...);
* module.exports = {MyComponent: React.createClass(...)};
* MyComponent = createReactClass(...);
* exports.MyComponent = createReactClass(...);
* module.exports = {MyComponent: createReactClass(...)};
*/
function visitReactDisplayName(traverse, object, path, state) {
var left, right;
@@ -15916,4 +15916,4 @@ function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {
module.exports = inlineSourceMap;

},{"buffer":3}]},{},[1])(1)
});
});
Loading