react_on_rails 10.0.0 → 10.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -88
- data/README.md +2 -2
- data/app/helpers/react_on_rails_helper.rb +4 -0
- data/docs/basics/upgrading-react-on-rails.md +175 -0
- data/lib/react_on_rails/configuration.rb +5 -7
- data/lib/react_on_rails/locales_to_js.rb +1 -1
- data/lib/react_on_rails/server_rendering_pool/exec.rb +2 -2
- data/lib/react_on_rails/utils.rb +0 -1
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +2 -2
- data/react_on_rails.gemspec +10 -10
- data/yarn.lock +7 -7
- metadata +42 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f77778a2d3e3388aa655c1f8906194318eec9203
|
4
|
+
data.tar.gz: 9b6d46e1d7a5cff954ad3cec4c3bb5aa3255cadb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0be5ab13362813d72c3674dd67df1df1d22069a665df7cde5ad7bc52c572ef45d213dd14bdc862d8b8471b1995e93c19297644dd233978131bfde8b6932357da
|
7
|
+
data.tar.gz: dc5c2c1c68fc9913a3e7c5305ad907a739e530a8f190e9695c7e37dc5a28f9a846abd90c6b6066cd9a71307690135a820e45ef37736069802e6a5f421577f81c
|
data/CHANGELOG.md
CHANGED
@@ -6,7 +6,15 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
|
|
6
6
|
## [Unreleased]
|
7
7
|
Changes since last non-beta release.
|
8
8
|
|
9
|
-
*Please add entries here for your pull requests.*
|
9
|
+
*Please add entries here for your pull requests that are not yet released.*
|
10
|
+
|
11
|
+
### [10.0.1] - 2017-10-28
|
12
|
+
#### Fixed
|
13
|
+
- Fixed `react_component_hash` functionality in cases of prerendering errors: [PR 960](https://github.com/shakacode/react_on_rails/pull/960) by [Judahmeek](https://github.com/Judahmeek).
|
14
|
+
- Fix to add missing dependency to run generator spec individually: [PR 962](https://github.com/shakacode/react_on_rails/pull/962) by [tricknotes](https://github.com/tricknotes).
|
15
|
+
- Fixes check for i18n_dir in LocalesToJs returning false when i18n_dir was set. [PR 899](https://github.com/shakacode/react_on_rails/pull/899) by [hakongit](https://github.com/hakongit).
|
16
|
+
- Fixed mistake in rubocop comments that led to errors when handling exceptions in ReactOnRails::ServerRendering::Exec [PR 963](https://github.com/shakacode/react_on_rails/pull/963) by [railsme](https://github.com/railsme).
|
17
|
+
- Fixed and improved I18n directories checks: [PR 967](https://github.com/shakacode/react_on_rails/pull/967) by [railsme](https://github.com/railsme)
|
10
18
|
|
11
19
|
### [10.0.0] - 2017-10-08
|
12
20
|
#### Created
|
@@ -14,108 +22,27 @@ Changes since last non-beta release.
|
|
14
22
|
#### Deprecated
|
15
23
|
- Deprecated `react_component` functionality for react_helmet support.
|
16
24
|
To clarify, the method itself is not deprecated, only certain functionality which has been moved to `react_component_hash`
|
17
|
-
[PR 951](https://github.com/shakacode/react_on_rails/pull/951) by [Judahmeek](https://github.com/Judahmeek)
|
25
|
+
[PR 951](https://github.com/shakacode/react_on_rails/pull/951) by [Judahmeek](https://github.com/Judahmeek).
|
18
26
|
|
19
27
|
### [9.0.3] - 2017-09-20
|
20
28
|
#### Improved
|
21
|
-
- Improved comments in generated Procfile.dev-server. [PR 940](https://github.com/shakacode/react_on_rails/pull/940) by [justin808](https://github.com/justin808
|
29
|
+
- Improved comments in generated Procfile.dev-server. [PR 940](https://github.com/shakacode/react_on_rails/pull/940) by [justin808](https://github.com/justin808).
|
22
30
|
|
23
31
|
### [9.0.2] - 2017-09-10
|
24
32
|
#### Fixed
|
25
|
-
- Improved post install doc comments for generator. [PR 933](https://github.com/shakacode/react_on_rails/pull/933) by [justin808](https://github.com/justin808
|
33
|
+
- Improved post install doc comments for generator. [PR 933](https://github.com/shakacode/react_on_rails/pull/933) by [justin808](https://github.com/justin808).
|
26
34
|
|
27
35
|
### [9.0.1] - 2017-09-10
|
28
36
|
|
29
37
|
#### Fixed
|
30
|
-
- Fixes Rails 3.2 compatability issues. [PR 926](https://github.com/shakacode/react_on_rails/pull/926) by [morozovm](https://github.com/morozovm
|
38
|
+
- Fixes Rails 3.2 compatability issues. [PR 926](https://github.com/shakacode/react_on_rails/pull/926) by [morozovm](https://github.com/morozovm).
|
31
39
|
|
32
40
|
### [9.0.0] - 2017-09-06
|
33
41
|
Updated React on Rails to depend on [rails/webpacker](https://github.com/rails/webpacker). [PR 908](https://github.com/shakacode/react_on_rails/pull/908) by [justin808](https://github.com/justin808).
|
34
42
|
|
35
43
|
|
36
44
|
#### 9.0 from 8.x. Upgrade Instructions
|
37
|
-
|
38
|
-
For an example of upgrading, see [react-webpack-rails-tutorial/pull/416](https://github.com/shakacode/react-webpack-rails-tutorial/pull/416).
|
39
|
-
|
40
|
-
- Breaking Configuration Changes
|
41
|
-
1. Added `config.node_modules_location` which defaults to `""` if Webpacker is installed. You may want to set this to 'client'` to `config/initializers/react_on_rails.rb` to keep your node_modules inside of `/client`
|
42
|
-
2. Renamed
|
43
|
-
* config.npm_build_test_command ==> config.build_test_command
|
44
|
-
* config.npm_build_production_command ==> config.build_production_command
|
45
|
-
|
46
|
-
- Update the gemfile. Switch over to using the webpacker gem.
|
47
|
-
|
48
|
-
```rb
|
49
|
-
gem "webpacker"
|
50
|
-
```
|
51
|
-
|
52
|
-
- Update for the renaming in the `WebpackConfigLoader` in your webpack configuration.
|
53
|
-
You will need to rename the following object properties:
|
54
|
-
- webpackOutputPath ==> output.path
|
55
|
-
- webpackPublicOutputDir ==> output.publicPath
|
56
|
-
- hotReloadingUrl ==> output.publicPathWithHost
|
57
|
-
- hotReloadingHostname ==> settings.dev_server.host
|
58
|
-
- hotReloadingPort ==> settings.dev_server.port
|
59
|
-
- hmr ==> settings.dev_server.hmr
|
60
|
-
- manifest ==> Remove this one. We use the default for Webpack of manifest.json
|
61
|
-
- env ==> Use `const { env } = require('process');`
|
62
|
-
- devBuild ==> Use `const devBuild = process.env.NODE_ENV !== 'production';`
|
63
|
-
|
64
|
-
- Edit your Webpack.config files:
|
65
|
-
- Change your Webpack output to be like this. **Be sure to have the hash or chunkhash in the filename,** unless the bundle is server side.:
|
66
|
-
```
|
67
|
-
const webpackConfigLoader = require('react-on-rails/webpackConfigLoader');
|
68
|
-
const configPath = resolve('..', 'config');
|
69
|
-
const { output, settings } = webpackConfigLoader(configPath);
|
70
|
-
const hmr = settings.dev_server.hmr;
|
71
|
-
const devBuild = process.env.NODE_ENV !== 'production';
|
72
|
-
|
73
|
-
output: {
|
74
|
-
filename: isHMR ? '[name]-[hash].js' : '[name]-[chunkhash].js',
|
75
|
-
chunkFilename: '[name]-[chunkhash].chunk.js',
|
76
|
-
|
77
|
-
publicPath: output.publicPath,
|
78
|
-
path: output.path,
|
79
|
-
},
|
80
|
-
```
|
81
|
-
- Change your ManifestPlugin definition to something like the following
|
82
|
-
```
|
83
|
-
new ManifestPlugin({
|
84
|
-
publicPath: output.publicPath,
|
85
|
-
writeToFileEmit: true
|
86
|
-
}),
|
87
|
-
|
88
|
-
```
|
89
|
-
|
90
|
-
- Find your `webpacker_lite.yml` and rename it to `webpacker.yml`
|
91
|
-
- Consider copying a default webpacker.yml setup such as https://github.com/shakacode/react-on-rails-v9-rc-generator/blob/master/config/webpacker.yml
|
92
|
-
- If you are not using the webpacker webpacker setup, be sure to put in `compile: false` in the `default` section.
|
93
|
-
- Alternately, if you are updating from webpacker_lite, you can manually change these:
|
94
|
-
- Add a default setting
|
95
|
-
```
|
96
|
-
cache_manifest: false
|
97
|
-
```
|
98
|
-
- For production, set:
|
99
|
-
```
|
100
|
-
cache_manifest: true
|
101
|
-
```
|
102
|
-
- Add a section like this under your development env:
|
103
|
-
```
|
104
|
-
dev_server:
|
105
|
-
host: localhost
|
106
|
-
port: 3035
|
107
|
-
hmr: false
|
108
|
-
```
|
109
|
-
Set hmr to your preference.
|
110
|
-
- See the example `spec/dummy/config/webpacker.yml`.
|
111
|
-
- Remove keys `hot_reloading_host` and `hot_reloading_enabled_by_default`. These are replaced by the `dev_server` key.
|
112
|
-
- Rename `webpack_public_output_dir` to `public_output_path`.
|
113
|
-
|
114
|
-
- Edit your Procfile.dev
|
115
|
-
- Remove the env value WEBPACKER_DEV_SERVER as it's not used
|
116
|
-
- For hot loading:
|
117
|
-
- Set the `hmr` key in your `webpacker.yml` to `true`.
|
118
|
-
|
45
|
+
Moved to [our additional reading documentation](https://github.com/shakacode/react_on_rails/blob/master/docs/additional-reading/upgrading-react-on-rails#from-version-8).
|
119
46
|
|
120
47
|
### [8.0.7] - 2017-08-16
|
121
48
|
#### Fixed
|
@@ -739,7 +666,9 @@ Best done with Object destructing:
|
|
739
666
|
##### Fixed
|
740
667
|
- Fix several generator related issues.
|
741
668
|
|
742
|
-
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/
|
669
|
+
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/10.0.1...master
|
670
|
+
[10.0.1]: https://github.com/shakacode/react_on_rails/compare/10.0.0...10.0.1
|
671
|
+
[10.0.0]: https://github.com/shakacode/react_on_rails/compare/9.0.3...10.0.0
|
743
672
|
[9.0.3]: https://github.com/shakacode/react_on_rails/compare/9.0.2...9.0.3
|
744
673
|
[9.0.2]: https://github.com/shakacode/react_on_rails/compare/9.0.1...9.0.2
|
745
674
|
[9.0.1]: https://github.com/shakacode/react_on_rails/compare/9.0.0...9.0.1
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
[ShakaCode is hiring team members](http://www.shakacode.com/about/#work-with-us) for our own app, [Friends and Guests](https://www.friendsandguests.com).
|
6
6
|
|
7
|
-
# React on Rails
|
7
|
+
# React on Rails v10 is based on Webpacker 3.0!
|
8
8
|
|
9
9
|
* See the article [Introducing React on Rails v9 with Webpacker Support](https://blog.shakacode.com/introducing-react-on-rails-v9-with-webpacker-support-f2584c6c8fa4) for an overview of the integration of React on Rails with Webpacker.
|
10
10
|
* [Video of running the v9 installer with Webpacker v3](https://youtu.be/M0WUM_XPaII).
|
@@ -190,7 +190,7 @@ To upgrade existing apps to React on Rails 8 see the [Installation Overview](doc
|
|
190
190
|
1. Add the following to your Gemfile and `bundle install`. We recommend fixing the version of React on Rails, as you will need to keep the exact version in sync with the version in your `client/package.json` file.
|
191
191
|
|
192
192
|
```ruby
|
193
|
-
gem "react_on_rails", "
|
193
|
+
gem "react_on_rails", "10.0.0"
|
194
194
|
gem "webpacker", "~> 3.0"
|
195
195
|
```
|
196
196
|
|
@@ -129,6 +129,10 @@ module ReactOnRailsHelper
|
|
129
129
|
server_rendered_html = internal_result["result"]["html"]
|
130
130
|
console_script = internal_result["result"]["consoleReplayScript"]
|
131
131
|
|
132
|
+
if server_rendered_html.is_a?(String) && internal_result["result"]["hasErrors"]
|
133
|
+
server_rendered_html = { COMPONENT_HTML_KEY => internal_result["result"]["html"] }
|
134
|
+
end
|
135
|
+
|
132
136
|
if server_rendered_html.is_a?(Hash)
|
133
137
|
build_react_component_result_for_server_rendered_hash(
|
134
138
|
server_rendered_html: server_rendered_html,
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# Upgrading React on Rails
|
2
|
+
|
3
|
+
## Upgrading to version 10
|
4
|
+
|
5
|
+
Pretty simple:
|
6
|
+
* Follow the steps to migrate to version 9 (except installing 10.x instead of 9.x)
|
7
|
+
* If you have `react_component` returning hashes, then switch to `react_component_hash` instead
|
8
|
+
|
9
|
+
## Upgrading to version 9
|
10
|
+
|
11
|
+
### Why Webpacker?
|
12
|
+
Webpacker provides areas of value:
|
13
|
+
* View helpers that support bypassing the asset pipeline, which allows you to avoid double minification and enable source maps in production. This is 100% a best practice as source maps in production greatly increases the value of services such as HoneyBadger or Sentry.
|
14
|
+
* A default Webpack config so that you only need to do minimal modifications and customizations. However, if you're doing server rendering, you may not want to give up control. Since Webpacker's default webpack config is changing often, we at Shakacode can give you definitive advice on webpack configuration best practices. In general, if you're happy with doing your own Webpack configuration, then we suggest using the `client` strategy discussed below. Most corporate projects will prefer having more control than direct dependence on webpacker easily allows.
|
15
|
+
|
16
|
+
### Integrating Webpacker
|
17
|
+
Reason for doing this: This enables your webpack bundles to bypass the Rails asset pipeline and it's extra minification, enabling you to use source-maps in production, while still maintaining total control over everything in the client directory
|
18
|
+
|
19
|
+
#### From version 7 or lower
|
20
|
+
|
21
|
+
##### ...while keeping your `client` directory
|
22
|
+
Unfortunately, this requires quite a few steps:
|
23
|
+
* `.gitignore`: add `/public/webpack/*`
|
24
|
+
* `Gemfile`: bump `react_on_rails` and add `webpacker`
|
25
|
+
* layout views: anything bundled by webpack will need to be requested by a `javascript_pack_tag` or `stylesheet_pack_tag`
|
26
|
+
* `config/initializers/assets.rb`: we no longer need to modify `Rails.application.config.assets.paths` or append anything to `Rails.application.config.assets.precompile`.
|
27
|
+
* `config/initializers/react_on_rails.rb`:
|
28
|
+
* Delete `config.generated_assets_dir`. Webpacker's config now supplies this information
|
29
|
+
* Replace `config.npm_build_(test|production)_command` with `config.build_(test|production)_command`
|
30
|
+
* `config/webpacker.yml`: start with our [example config](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/config/webpacker.yml) (feel free to modify it as needed). I recommend setting dev_server.hmr to false however since HMR is currently broken.
|
31
|
+
* `client/package.json`: bump `react_on_rails` (I recommend bumping `webpack` as well). You'll also need `js-yaml` if you're not already using `eslint` and `webpack-manifest-plugin` regardless.
|
32
|
+
|
33
|
+
###### Client Webpack config:
|
34
|
+
* You'll need the following code to read data from the webpacker config:
|
35
|
+
|
36
|
+
```
|
37
|
+
const path = require('path');
|
38
|
+
const ManifestPlugin = require('webpack-manifest-plugin'); // we'll use this later
|
39
|
+
|
40
|
+
const webpackConfigLoader = require('react-on-rails/webpackConfigLoader');
|
41
|
+
const configPath = path.resolve('..', 'config');
|
42
|
+
const { output } = webpackConfigLoader(configPath);
|
43
|
+
```
|
44
|
+
|
45
|
+
* That output variable will be used for webpack's `output` rules:
|
46
|
+
|
47
|
+
```
|
48
|
+
output: {
|
49
|
+
filename: '[name]-[chunkhash].js', // [chunkhash] because we've got to do our own cache-busting now
|
50
|
+
path: output.path,
|
51
|
+
publicPath: output.publicPath,
|
52
|
+
},
|
53
|
+
```
|
54
|
+
|
55
|
+
* ...as well as for the output of plugins like `webpack-manifest-plugin`:
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
new ManifestPlugin({
|
60
|
+
publicPath: output.publicPath,
|
61
|
+
writeToFileEmit: true
|
62
|
+
}),
|
63
|
+
```
|
64
|
+
|
65
|
+
* If you're using referencing files or images with `url-loader` & `file-loader`, their publicpaths will have to change as well: `publicPath: '/webpack/',`
|
66
|
+
* If you're using `css-loader`, `webpack.optimize.CommonsChunkPlugin`, or `extract-text-webpack-plugin`, they will also need cache-busting!
|
67
|
+
|
68
|
+
...and you're finally done!
|
69
|
+
|
70
|
+
##### ...while replacing your `client` directory
|
71
|
+
* Make the same changes to `config/initializers/react_on_rails.rb as described above`
|
72
|
+
* Upgrade RoR & add Webpacker in the Gemfile
|
73
|
+
* Upgrade RoR in the `client/package.json`
|
74
|
+
* Run `bundle`
|
75
|
+
* Run `rails webpacker:install`
|
76
|
+
* Run `rails webpacker:install:react`
|
77
|
+
* Run `rails g react_on_rails:install`
|
78
|
+
* Move your entry point files to `app/javascript/packs`
|
79
|
+
* Either:
|
80
|
+
* Move all your source code to `app/javascript/bundles`, move your linter configs to the root directory, and then delete the `client` directory
|
81
|
+
* or just delete the webpack config and remove webpack, its loaders, and plugins from your `client/package.json`.
|
82
|
+
|
83
|
+
...and you're done.
|
84
|
+
|
85
|
+
#### From version 8
|
86
|
+
|
87
|
+
For an example of upgrading, see [react-webpack-rails-tutorial/pull/416](https://github.com/shakacode/react-webpack-rails-tutorial/pull/416).
|
88
|
+
|
89
|
+
- Breaking Configuration Changes
|
90
|
+
1. Added `config.node_modules_location` which defaults to `""` if Webpacker is installed. You may want to set this to 'client'` to `config/initializers/react_on_rails.rb` to keep your node_modules inside of `/client`
|
91
|
+
2. Renamed
|
92
|
+
* config.npm_build_test_command ==> config.build_test_command
|
93
|
+
* config.npm_build_production_command ==> config.build_production_command
|
94
|
+
|
95
|
+
- Update the gemfile. Switch over to using the webpacker gem.
|
96
|
+
|
97
|
+
```rb
|
98
|
+
gem "webpacker"
|
99
|
+
```
|
100
|
+
|
101
|
+
- Update for the renaming in the `WebpackConfigLoader` in your webpack configuration.
|
102
|
+
You will need to rename the following object properties:
|
103
|
+
- webpackOutputPath ==> output.path
|
104
|
+
- webpackPublicOutputDir ==> output.publicPath
|
105
|
+
- hotReloadingUrl ==> output.publicPathWithHost
|
106
|
+
- hotReloadingHostname ==> settings.dev_server.host
|
107
|
+
- hotReloadingPort ==> settings.dev_server.port
|
108
|
+
- hmr ==> settings.dev_server.hmr
|
109
|
+
- manifest ==> Remove this one. We use the default for Webpack of manifest.json
|
110
|
+
- env ==> Use `const { env } = require('process');`
|
111
|
+
- devBuild ==> Use `const devBuild = process.env.NODE_ENV !== 'production';`
|
112
|
+
|
113
|
+
- Edit your Webpack.config files:
|
114
|
+
- Change your Webpack output to be like this. **Be sure to have the hash or chunkhash in the filename,** unless the bundle is server side.:
|
115
|
+
```
|
116
|
+
const webpackConfigLoader = require('react-on-rails/webpackConfigLoader');
|
117
|
+
const configPath = resolve('..', 'config');
|
118
|
+
const { output, settings } = webpackConfigLoader(configPath);
|
119
|
+
const hmr = settings.dev_server.hmr;
|
120
|
+
const devBuild = process.env.NODE_ENV !== 'production';
|
121
|
+
|
122
|
+
output: {
|
123
|
+
filename: isHMR ? '[name]-[hash].js' : '[name]-[chunkhash].js',
|
124
|
+
chunkFilename: '[name]-[chunkhash].chunk.js',
|
125
|
+
|
126
|
+
publicPath: output.publicPath,
|
127
|
+
path: output.path,
|
128
|
+
},
|
129
|
+
```
|
130
|
+
- Change your ManifestPlugin definition to something like the following
|
131
|
+
```
|
132
|
+
new ManifestPlugin({
|
133
|
+
publicPath: output.publicPath,
|
134
|
+
writeToFileEmit: true
|
135
|
+
}),
|
136
|
+
|
137
|
+
```
|
138
|
+
|
139
|
+
- Find your `webpacker_lite.yml` and rename it to `webpacker.yml`
|
140
|
+
- Consider copying a default webpacker.yml setup such as https://github.com/shakacode/react-on-rails-v9-rc-generator/blob/master/config/webpacker.yml
|
141
|
+
- If you are not using the webpacker webpacker setup, be sure to put in `compile: false` in the `default` section.
|
142
|
+
- Alternately, if you are updating from webpacker_lite, you can manually change these:
|
143
|
+
- Add a default setting
|
144
|
+
```
|
145
|
+
cache_manifest: false
|
146
|
+
```
|
147
|
+
- For production, set:
|
148
|
+
```
|
149
|
+
cache_manifest: true
|
150
|
+
```
|
151
|
+
- Add a section like this under your development env:
|
152
|
+
```
|
153
|
+
dev_server:
|
154
|
+
host: localhost
|
155
|
+
port: 3035
|
156
|
+
hmr: false
|
157
|
+
```
|
158
|
+
Set hmr to your preference.
|
159
|
+
- See the example `spec/dummy/config/webpacker.yml`.
|
160
|
+
- Remove keys `hot_reloading_host` and `hot_reloading_enabled_by_default`. These are replaced by the `dev_server` key.
|
161
|
+
- Rename `webpack_public_output_dir` to `public_output_path`.
|
162
|
+
|
163
|
+
- Edit your Procfile.dev
|
164
|
+
- Remove the env value WEBPACKER_DEV_SERVER as it's not used
|
165
|
+
- For hot loading:
|
166
|
+
- Set the `hmr` key in your `webpacker.yml` to `true`.
|
167
|
+
|
168
|
+
### Without integrating webpacker
|
169
|
+
* Bump your ReactOnRails versions in `Gemfile` & `package.json`
|
170
|
+
* In `/config/initializers/react_on_rails.rb`:
|
171
|
+
* Rename `config.npm_build_test_command` ==> `config.build_test_command`
|
172
|
+
* Rename `config.npm_build_production_command` ==> `config.build_production_command`
|
173
|
+
* Add `config.node_modules_location = "client"`
|
174
|
+
|
175
|
+
...and you're done.
|
@@ -21,7 +21,7 @@ module ReactOnRails
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.check_i18n_directory_exists
|
24
|
-
return if @configuration.i18n_dir.
|
24
|
+
return if @configuration.i18n_dir.nil?
|
25
25
|
return if Dir.exist?(@configuration.i18n_dir)
|
26
26
|
|
27
27
|
raise "Error configuring /config/react_on_rails.rb: invalid value for `config.i18n_dir`. "\
|
@@ -30,7 +30,7 @@ module ReactOnRails
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.check_i18n_yml_directory_exists
|
33
|
-
return if @configuration.i18n_yml_dir.
|
33
|
+
return if @configuration.i18n_yml_dir.nil?
|
34
34
|
return if Dir.exist?(@configuration.i18n_yml_dir)
|
35
35
|
|
36
36
|
raise "Error configuring /config/react_on_rails.rb: invalid value for `config.i18n_yml_dir`. "\
|
@@ -83,7 +83,7 @@ module ReactOnRails
|
|
83
83
|
|
84
84
|
def self.configuration
|
85
85
|
@configuration ||= Configuration.new(
|
86
|
-
node_modules_location:
|
86
|
+
node_modules_location: nil,
|
87
87
|
generated_assets_dirs: nil,
|
88
88
|
|
89
89
|
# generated_assets_dirs is deprecated
|
@@ -105,8 +105,6 @@ module ReactOnRails
|
|
105
105
|
server_render_method: "ExecJS",
|
106
106
|
symlink_non_digested_assets_regex: nil,
|
107
107
|
build_test_command: "",
|
108
|
-
i18n_dir: "",
|
109
|
-
i18n_yml_dir: "",
|
110
108
|
build_production_command: ""
|
111
109
|
)
|
112
110
|
end
|
@@ -122,7 +120,7 @@ module ReactOnRails
|
|
122
120
|
:i18n_dir, :i18n_yml_dir,
|
123
121
|
:server_render_method, :symlink_non_digested_assets_regex
|
124
122
|
|
125
|
-
def initialize(node_modules_location:
|
123
|
+
def initialize(node_modules_location: nil, server_bundle_js_file: nil, prerender: nil,
|
126
124
|
replay_console: nil,
|
127
125
|
trace: nil, development_mode: nil,
|
128
126
|
logging_on_server: nil, server_renderer_pool_size: nil,
|
@@ -133,7 +131,7 @@ module ReactOnRails
|
|
133
131
|
build_production_command: nil,
|
134
132
|
i18n_dir: nil, i18n_yml_dir: nil,
|
135
133
|
server_render_method: "ExecJS", symlink_non_digested_assets_regex: nil)
|
136
|
-
self.node_modules_location = node_modules_location
|
134
|
+
self.node_modules_location = node_modules_location.present? ? node_modules_location : Rails.root
|
137
135
|
self.server_bundle_js_file = server_bundle_js_file
|
138
136
|
self.generated_assets_dirs = generated_assets_dirs
|
139
137
|
self.generated_assets_dir = generated_assets_dir
|
@@ -98,7 +98,7 @@ module ReactOnRails
|
|
98
98
|
# bundle_js_code = File.read(server_js_file)
|
99
99
|
begin
|
100
100
|
bundle_js_code = open(server_js_file, &:read)
|
101
|
-
rescue # rubocop:disable Lint/RescueWithoutErrorClass
|
101
|
+
rescue => e # rubocop:disable Lint/RescueWithoutErrorClass
|
102
102
|
msg = "You specified server rendering JS file: #{server_js_file}, but it cannot be "\
|
103
103
|
"read. You may set the server_bundle_js_file in your configuration to be \"\" to "\
|
104
104
|
"avoid this warning.\nError is: #{e}"
|
@@ -115,7 +115,7 @@ module ReactOnRails
|
|
115
115
|
begin
|
116
116
|
trace_messsage(base_js_code, file_name)
|
117
117
|
ExecJS.compile(base_js_code)
|
118
|
-
rescue # rubocop:disable Lint/RescueWithoutErrorClass
|
118
|
+
rescue => e # rubocop:disable Lint/RescueWithoutErrorClass
|
119
119
|
msg = "ERROR when compiling base_js_code! "\
|
120
120
|
"See file #{file_name} to "\
|
121
121
|
"correlate line numbers of error. Error is\n\n#{e.message}"\
|
data/lib/react_on_rails/utils.rb
CHANGED
@@ -122,7 +122,6 @@ exitstatus: #{status.exitstatus}#{stdout_msg}#{stderr_msg}
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def self.prepend_cd_node_modules_directory(cmd)
|
125
|
-
return cmd if ReactOnRails.configuration.node_modules_location.blank?
|
126
125
|
"cd #{ReactOnRails.configuration.node_modules_location} && #{cmd}"
|
127
126
|
end
|
128
127
|
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-on-rails",
|
3
|
-
"version": "10.0.
|
3
|
+
"version": "10.0.1",
|
4
4
|
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",
|
5
5
|
"main": "node_package/lib/ReactOnRails.js",
|
6
6
|
"directories": {
|
@@ -88,7 +88,7 @@
|
|
88
88
|
},
|
89
89
|
"homepage": "https://github.com/shakacode/react_on_rails#readme",
|
90
90
|
"dependencies": {
|
91
|
-
"react-on-rails": "^
|
91
|
+
"react-on-rails": "^10.0.0",
|
92
92
|
"react-redux": "^5.0.6"
|
93
93
|
}
|
94
94
|
}
|
data/react_on_rails.gemspec
CHANGED
@@ -25,26 +25,26 @@ Gem::Specification.new do |s|
|
|
25
25
|
|
26
26
|
s.required_ruby_version = ">= 2.0.0"
|
27
27
|
|
28
|
-
s.add_dependency "
|
28
|
+
s.add_dependency "addressable"
|
29
29
|
s.add_dependency "connection_pool"
|
30
30
|
s.add_dependency "execjs", "~> 2.5"
|
31
31
|
s.add_dependency "rails", ">= 3.2"
|
32
|
-
s.add_dependency "
|
32
|
+
s.add_dependency "rainbow", "~> 2.2"
|
33
33
|
|
34
|
-
s.add_development_dependency "
|
34
|
+
s.add_development_dependency "awesome_print"
|
35
35
|
s.add_development_dependency "bundler", "~> 1.10"
|
36
|
-
s.add_development_dependency "rake", "~> 10.0"
|
37
|
-
s.add_development_dependency "listen"
|
38
|
-
s.add_development_dependency "rspec"
|
39
36
|
s.add_development_dependency "coveralls"
|
37
|
+
s.add_development_dependency "gem-release"
|
40
38
|
s.add_development_dependency "generator_spec"
|
39
|
+
s.add_development_dependency "listen"
|
41
40
|
s.add_development_dependency "pry"
|
42
41
|
s.add_development_dependency "pry-byebug"
|
43
|
-
s.add_development_dependency "pry-stack_explorer"
|
44
42
|
s.add_development_dependency "pry-doc"
|
43
|
+
s.add_development_dependency "pry-rescue"
|
44
|
+
s.add_development_dependency "pry-stack_explorer"
|
45
45
|
s.add_development_dependency "pry-state"
|
46
46
|
s.add_development_dependency "pry-toys"
|
47
|
-
s.add_development_dependency "
|
48
|
-
s.add_development_dependency "
|
49
|
-
s.add_development_dependency "
|
47
|
+
s.add_development_dependency "rails", "~> 5.1.2"
|
48
|
+
s.add_development_dependency "rake", "~> 10.0"
|
49
|
+
s.add_development_dependency "rspec"
|
50
50
|
end
|
data/yarn.lock
CHANGED
@@ -2449,13 +2449,6 @@ js-tokens@^3.0.0, js-tokens@^3.0.2:
|
|
2449
2449
|
version "3.0.2"
|
2450
2450
|
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
|
2451
2451
|
|
2452
|
-
js-yaml@^3.10.0:
|
2453
|
-
version "3.10.0"
|
2454
|
-
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc"
|
2455
|
-
dependencies:
|
2456
|
-
argparse "^1.0.7"
|
2457
|
-
esprima "^4.0.0"
|
2458
|
-
|
2459
2452
|
js-yaml@^3.5.1:
|
2460
2453
|
version "3.9.1"
|
2461
2454
|
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.1.tgz#08775cebdfdd359209f0d2acd383c8f86a6904a0"
|
@@ -3248,6 +3241,13 @@ react-dom@^15.6.1:
|
|
3248
3241
|
object-assign "^4.1.0"
|
3249
3242
|
prop-types "^15.5.10"
|
3250
3243
|
|
3244
|
+
react-on-rails@^10.0.0:
|
3245
|
+
version "10.0.0"
|
3246
|
+
resolved "https://registry.yarnpkg.com/react-on-rails/-/react-on-rails-10.0.0.tgz#afc658bf23f5dfe3fd836adc178eb4672727a89d"
|
3247
|
+
dependencies:
|
3248
|
+
react-on-rails "^9.0.3"
|
3249
|
+
react-redux "^5.0.6"
|
3250
|
+
|
3251
3251
|
react-on-rails@^9.0.0-beta.12:
|
3252
3252
|
version "9.0.1"
|
3253
3253
|
resolved "https://registry.yarnpkg.com/react-on-rails/-/react-on-rails-9.0.1.tgz#49bf7520866214e410e6f88b298e889183d93786"
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.0.
|
4
|
+
version: 10.0.1
|
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-10-
|
11
|
+
date: 2017-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: addressable
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: connection_pool
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,33 +67,33 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rainbow
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.2'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '2.2'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: awesome_print
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,21 +109,21 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.10'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: coveralls
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: gem-release
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: generator_spec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: listen
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -165,7 +165,7 @@ dependencies:
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: pry
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
@@ -179,7 +179,7 @@ dependencies:
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name: pry
|
182
|
+
name: pry-byebug
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
@@ -193,7 +193,7 @@ dependencies:
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name: pry-
|
196
|
+
name: pry-doc
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - ">="
|
@@ -207,7 +207,7 @@ dependencies:
|
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
|
-
name: pry-
|
210
|
+
name: pry-rescue
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
213
|
- - ">="
|
@@ -221,7 +221,7 @@ dependencies:
|
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
|
-
name: pry-
|
224
|
+
name: pry-stack_explorer
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
227
|
- - ">="
|
@@ -263,35 +263,35 @@ dependencies:
|
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0'
|
265
265
|
- !ruby/object:Gem::Dependency
|
266
|
-
name:
|
266
|
+
name: rails
|
267
267
|
requirement: !ruby/object:Gem::Requirement
|
268
268
|
requirements:
|
269
|
-
- - "
|
269
|
+
- - "~>"
|
270
270
|
- !ruby/object:Gem::Version
|
271
|
-
version:
|
271
|
+
version: 5.1.2
|
272
272
|
type: :development
|
273
273
|
prerelease: false
|
274
274
|
version_requirements: !ruby/object:Gem::Requirement
|
275
275
|
requirements:
|
276
|
-
- - "
|
276
|
+
- - "~>"
|
277
277
|
- !ruby/object:Gem::Version
|
278
|
-
version:
|
278
|
+
version: 5.1.2
|
279
279
|
- !ruby/object:Gem::Dependency
|
280
|
-
name:
|
280
|
+
name: rake
|
281
281
|
requirement: !ruby/object:Gem::Requirement
|
282
282
|
requirements:
|
283
|
-
- - "
|
283
|
+
- - "~>"
|
284
284
|
- !ruby/object:Gem::Version
|
285
|
-
version: '0'
|
285
|
+
version: '10.0'
|
286
286
|
type: :development
|
287
287
|
prerelease: false
|
288
288
|
version_requirements: !ruby/object:Gem::Requirement
|
289
289
|
requirements:
|
290
|
-
- - "
|
290
|
+
- - "~>"
|
291
291
|
- !ruby/object:Gem::Version
|
292
|
-
version: '0'
|
292
|
+
version: '10.0'
|
293
293
|
- !ruby/object:Gem::Dependency
|
294
|
-
name:
|
294
|
+
name: rspec
|
295
295
|
requirement: !ruby/object:Gem::Requirement
|
296
296
|
requirements:
|
297
297
|
- - ">="
|
@@ -370,6 +370,7 @@ files:
|
|
370
370
|
- docs/basics/i18n.md
|
371
371
|
- docs/basics/installation-overview.md
|
372
372
|
- docs/basics/migrating-from-react-rails.md
|
373
|
+
- docs/basics/upgrading-react-on-rails.md
|
373
374
|
- docs/coding-style/style.md
|
374
375
|
- docs/contributor-info/generator-testing.md
|
375
376
|
- docs/contributor-info/linters.md
|