Skip to content

Commit

Permalink
Add migration steps and minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Jan 13, 2016
1 parent aadfab4 commit 8455a67
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ All notable changes to this project will be documented in this file. Items under
- JS Linter uses ShakaCode JavaScript style: https://github.com/shakacode/style-guide-javascript
- Generators account these differences.

### Migration Steps
[Example of upgrading](https://github.com/shakacode/react-webpack-rails-tutorial/commit/5b1b8698e8daf0f0b94e987740bc85ee237ef608)

1. Update the `react_on_rails` gem
2. Search you app for 'generator_function' and remove lines in layouts and rb files that contain it. Determination of a generator function is handled automatically.
3. Find your files where you registered client and server globals, and use the new ReactOnRails.register syntax. Optionally rename the files `clientRegistration.jsx` and `serverRegistration.jsx` rather than `Globals`.
4. Update your index.jade to use the new API `ReactOnRails.render("MyApp", !{props}, 'app');`
5. 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.

That's it!

## v1.2.2
### Fixed
- Missing Lodash from generated package.json [#175](https://github.com/shakacode/react_on_rails/pull/175)
Expand Down
2 changes: 1 addition & 1 deletion docs/additional_reading/manual_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = {
//libraryTarget: 'this',
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', 'config.js'],
extensions: ['', '.js', '.jsx'],
},
module: {
loaders: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ module.exports = {
vendor: [
'babel-polyfill',
'jquery',
'react',
'react-dom',
],

// This will contain the app entry points defined by webpack.hot.config and webpack.rails.config
Expand All @@ -26,15 +24,14 @@ module.exports = {
],
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', '.scss', '.css', 'config.js'],
extensions: ['', '.js', '.jsx'],
alias: {
lib: path.join(process.cwd(), 'app', 'lib'),
react: path.resolve('./node_modules/react'),
'react-dom': path.resolve('./node_modules/react-dom'),
},
},
plugins: [

new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(nodeEnv),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ config.entry.vendor.push('jquery-ujs');

// See webpack.common.config for adding modules common to both the webpack dev server and rails
config.module.loaders.push(
{ test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: require.resolve('react'), loader: 'imports?shim=es5-shim/es5-shim&sham=es5-shim/es5-sham' }
{
test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/
},
{
test: require.resolve('react'), loader: 'imports?shim=es5-shim/es5-shim&sham=es5-shim/es5-sham'
},
{
test: require.resolve('jquery-ujs'), loader: 'imports?jQuery=jquery'
}
);

module.exports = config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
path: '../app/assets/javascripts/generated',
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', 'config.js'],
extensions: ['', '.js', '.jsx'],
alias: {
lib: path.join(process.cwd(), 'app', 'lib'),
},
Expand Down

0 comments on commit 8455a67

Please sign in to comment.