Skip to content

Commit a8f8d83

Browse files
author
Robert Mosolgo
committed
Merge pull request #228 from rmosolgo/react-versioning
feat(versions) add VERSIONS.md for gem/React versions
2 parents 2731a71 + a9b2359 commit a8f8d83

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ end
7878

7979
After restarting your Rails server, `//= require react` will provide the build of React.js which was specified by the configurations.
8080

81-
In a pinch, you can also provide your own copies of React.js and JSXTransformer. Just add `react.js` or `JSXTransformer.js` (case-sensitive) files to `app/vendor/assets/javascripts/react/` and restart your development server. If you need different versions of React in different environments, put them in directories that match `config.react.variant`. For example, if you set `config.react.variant = :development`, you could put a copy of `react.js` in `/vendor/assets/react/development/`.
81+
`react-rails` offers a few other options for versions & builds of React.js. See [VERSIONS.md](https://github.com/reactjs/react-rails/blob/master/VERSIONS.md) for more info about using the `react-source` gem or dropping in your own copies of React.js.
8282

8383
### JSX
8484

VERSIONS.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Versions
2+
3+
There are three ways to control what version of React.js (and JSXTransformer) is used by `react-rails`:
4+
5+
- Use the [bundled version](#bundled-versions) that comes with the gem
6+
- Specify a [react-source verison](#react-source-version)
7+
- [Drop in a copy](#drop-in-version) of React.js
8+
9+
## Bundled Versions
10+
11+
| Gem | React.js |
12+
|----------|----------|
13+
| master | ~> 0.13 |
14+
| 0.13.0.0 | 0.13.0 |
15+
| 0.12.2.0 | 0.12.2 |
16+
| 0.12.1.0 | 0.12.1 |
17+
| 0.12.0.0 | 0.12.0 |
18+
19+
20+
## React-Source Version
21+
22+
The [`react-source` gem](https://rubygems.org/gems/react-source) provides JS files to `react-rails`.
23+
24+
You can specify a React.js version by locking to a specific `react-source` in your Gemfile. For example:
25+
26+
```ruby
27+
gem 'react-rails'
28+
# always use React version 0.13.1:
29+
gem 'react-source', '0.13.1'
30+
```
31+
32+
## Drop-in Version
33+
34+
You can also provide your own copies of React.js and JSXTransformer. Just add `react.js` or `JSXTransformer.js` (case-sensitive) files in directories where `react-rails` expects to find them.
35+
36+
To use the _same version in all environments_, put files in `app/vendor/assets/react/`.
37+
38+
If you need _different versions in different environments_, put them in directories that match `config.react.variant`. For example, if you set `config.react.variant = :development`, you could put a copy of `react.js` in `app/vendor/assets/react/development/`.
39+
40+
41+
42+
43+

lib/react/rails/version.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module React
22
module Rails
3+
# If you change this, make sure to update VERSIONS.md
34
VERSION = '1.0.0.pre'
45
end
56
end

react-rails.gemspec

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
2727
s.add_dependency 'execjs'
2828
s.add_dependency 'coffee-script-source', '~>1.8'
2929
s.add_dependency 'rails', '>= 3.1'
30+
# If you change this, make sure to update VERSIONS.md:
3031
s.add_dependency 'react-source', '~> 0.13'
3132
s.add_dependency 'connection_pool'
3233

0 commit comments

Comments
 (0)