diff --git a/.gitignore b/.gitignore
index a9a2ff05c..51d63287a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,5 @@ npm-debug.*
spec/dummy/client/npm-debug.log.*
/gen-examples
+
+.DS_Store
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1043f21ed..59d05acc1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,14 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
## [Unreleased]
##### Added
- Non-digested version of assets in public folder [#413](https://github.com/shakacode/react_on_rails/pull/413) by [alleycat-at-git]
+##### Changed
+- Only one webpack config is generated for server and client config. Package.json files were changed to reflect this [#398](https://github.com/shakacode/react_on_rails/pull/398).
+- Added npm_build_test_command to allow developers to change what npm command is automatically run from rspec [#398](https://github.com/shakacode/react_on_rails/pull/398).
+##### Removed
+- Server rendering is no longer an option in the generator and is always accessible [#398](https://github.com/shakacode/react_on_rails/pull/398).
+- removed lodash, jquery, and loggerMiddleware from the generated code [#398](https://github.com/shakacode/react_on_rails/pull/398).
+- removed webpack watch check for test helper automatic compilation [#398](https://github.com/shakacode/react_on_rails/pull/398).
+
##### Changed
- Replace URI with Addressable gem. See [#405](https://github.com/shakacode/react_on_rails/pull/405) by [lucke84]
diff --git a/README.md b/README.md
index d43cad766..872993a56 100644
--- a/README.md
+++ b/README.md
@@ -161,8 +161,6 @@ In most cases, you should use the `prerender: false` (default behavior) with the
Now the server will interpret your JavaScript using [ExecJS](https://github.com/rails/execjs) and pass the resulting HTML to the client. We recommend using [therubyracer](https://github.com/cowboyd/therubyracer) as ExecJS's runtime. The generator will automatically add it to your Gemfile for you.
-Note that **server-rendering requires globally exposing your components by setting them to `global`, not `window`** (as is the case with client-rendering). If using the generator, you can pass the `--server-rendering` option to configure your application for server-side rendering.
-
In the following screenshot you can see the 3 parts of React on Rails rendering:
1. A hidden HTML div that contains the properties of the React component, such as the registered name and any props. A JavaScript function runs after the page loads to convert take this data and build initialize React components.
@@ -265,27 +263,30 @@ In this case, a prop and value for `somethingUseful` will go into the railsConte
### Globally Exposing Your React Components
Place your JavaScript code inside of the provided `client/app` folder. Use modules just as you would when using webpack alone. The difference here is that instead of mounting React components directly to an element using `React.render`, you **expose your components globally and then mount them with helpers inside of your Rails views**.
-+ *Normal Mode (JavaScript is Rendered on client):*
- If you are not server rendering, `clientRegistration.jsx` will have
+
+*Default Mode (works for server and client rendering):*
+ This is an example of how to expose a component to the `react_component` view helper.
```javascript
+ // client/app/bundles/HelloWorld/startup/HelloWorldApp.jsx
import HelloWorld from '../components/HelloWorld';
import ReactOnRails from 'react-on-rails';
ReactOnRails.register({ HelloWorld });
```
-+ *Server-Side Rendering:*
-
- If you are server rendering, `serverRegistration.jsx` will have this. Note, you might be initializing HelloWorld with version specialized for server rendering.
+*Separated Server-Side Rendering:*
+
+ You can add a separate webpack configuration file for server rendering that has a separate entry file. ex. 'serverHelloWorldApp.jsx'. Note, you might be initializing HelloWorld with version specialized for server rendering.
+
```javascript
import HelloWorld from '../components/HelloWorld';
import ReactOnRails from 'react-on-rails';
ReactOnRails.register({ HelloWorld });
```
-
+
In general, you may want different initialization for your server rendered components.
-
+
See below section on how to setup redux stores that allow multiple components to talk to the same store.
## ReactOnRails View Helpers API
diff --git a/app/helpers/react_on_rails_helper.rb b/app/helpers/react_on_rails_helper.rb
index 5c852abd2..3e601255d 100644
--- a/app/helpers/react_on_rails_helper.rb
+++ b/app/helpers/react_on_rails_helper.rb
@@ -270,7 +270,7 @@ def server_rendered_react_component_html(props, react_component_name, dom_id,
# On server `location` option is added (`location = request.fullpath`)
# React Router needs this to match the current route
- # Make sure that we use up-to-date server-bundle
+ # Make sure that we use up-to-date webpack-bundle
ReactOnRails::ServerRenderingPool.reset_pool_if_server_bundle_was_modified
# Since this code is not inserted on a web page, we don't need to escape props
diff --git a/docs/additional-reading/heroku-deployment.md b/docs/additional-reading/heroku-deployment.md
index b4e312843..46d4b17dc 100644
--- a/docs/additional-reading/heroku-deployment.md
+++ b/docs/additional-reading/heroku-deployment.md
@@ -84,9 +84,7 @@ namespace :assets do
desc "Compile assets with webpack"
task :webpack do
- sh "cd client && npm run build:client"
- # If you are doing server rendering
- # sh "cd client && npm run build:server"
+ sh "cd client && npm run build:production"
end
task :clobber do
diff --git a/docs/additional-reading/node-server-rendering.md b/docs/additional-reading/node-server-rendering.md
index 647b0761b..f12c719a7 100644
--- a/docs/additional-reading/node-server-rendering.md
+++ b/docs/additional-reading/node-server-rendering.md
@@ -3,7 +3,7 @@
### Warning: this is an experimental feature
The default server rendering exploits ExecJS to render react components.
-Node server rendering allows you to use separate NodeJS process as a renderer. The process loads server-bundle.js and
+Node server rendering allows you to use separate NodeJS process as a renderer. The process loads webpack-bundle.js and
then executes javascript to render the component inside its environment. The communication between rails and node occurs
via socket (`client/node/node.sock`)
diff --git a/docs/additional-reading/rspec-configuration.md b/docs/additional-reading/rspec-configuration.md
index 70018c776..de99e0f10 100644
--- a/docs/additional-reading/rspec-configuration.md
+++ b/docs/additional-reading/rspec-configuration.md
@@ -12,10 +12,10 @@ RSpec.configure do |config|
You can pass an RSpec metatag as an optional second parameter to this helper method if you want this helper to run on examples other than where `js: true` (default). The helper will compile webpack files at most once per test run. The helper will not compile the webpack files unless they are out of date (stale).
Please take note of the following:
-- This utility assumes your build tasks for the static generated files are `npm run build:client` and `npm run build:server` and do not have the `--watch` option enabled.
+- This utility uses your `npm_build_test_command' to build the static generated files. This command should not include the `--watch` option.
- By default, the webpack processes look for the `app/assets/webpack` folders. If this folder is missing, is empty, or contains files with `mtime`s older than any of the files in your `client` folder, the helper will recompile your assets. You can override this inside of `config/initializers/react_on_rails.rb` by passing a filepath (relative to the root of the app) to the `generated_assets_dir` configuration option.
-If you want to speed up the re-compiling process, you can call `npm run build:dev:client` (and `npm run build:dev:server` if doing server rendering) to have webpack run in "watch" mode and recompile these files in the background, which will be much faster when making incremental changes than compiling from scratch.
+If you want to speed up the re-compiling process, you can call `npm run build:development` to have webpack run in "watch" mode and recompile these files in the background, which will be much faster when making incremental changes than compiling from scratch.
[spec/dummy](../../spec/dummy) contains examples of how to set the proc files for this purpose.
diff --git a/docs/additional-reading/webpack.md b/docs/additional-reading/webpack.md
index b996ad139..6291427ab 100644
--- a/docs/additional-reading/webpack.md
+++ b/docs/additional-reading/webpack.md
@@ -12,8 +12,6 @@ You need both include `react-dom/server` and `react` as values for `entry`, like
// See use of 'vendor' in the CommonsChunkPlugin inclusion below.
vendor: [
'babel-core/polyfill',
- 'jquery',
- 'jquery-ujs',
'react',
'react-dom',
],
@@ -25,14 +23,6 @@ and you need to expose them:
// React is necessary for the client rendering:
{test: require.resolve('react'), loader: 'expose?React'},
{test: require.resolve('react-dom'), loader: 'expose?ReactDOM'},
- {test: require.resolve('jquery'), loader: 'expose?jQuery'},
- {test: require.resolve('jquery'), loader: 'expose?$'},
-```
-
-`webpack.server.config.js` is similar, but substitute:
-
-```
- entry: ['./yourCode', 'react-dom/server', 'react'],
```
and use this line rather than `{test: require.resolve('react-dom'), loader: 'expose?ReactDOM'},`:
diff --git a/docs/api/ruby-api-hot-reload-view-helpers.md b/docs/api/ruby-api-hot-reload-view-helpers.md
index 9f0940530..12f2a8759 100644
--- a/docs/api/ruby-api-hot-reload-view-helpers.md
+++ b/docs/api/ruby-api-hot-reload-view-helpers.md
@@ -13,8 +13,7 @@ static vs. hot is picked based on whether `ENV["REACT_ON_RAILS_ENV"] == "HOT"`
- <%= env_javascript_include_tag(hot: ['http://localhost:3500/vendor-bundle.js',
- 'http://localhost:3500/app-bundle.js']) %>
+ <%= env_javascript_include_tag(hot: ['http://localhost:3500/webpack-bundle.js') %>
<%= env_javascript_include_tag(static: 'application_static',
diff --git a/docs/basics/generator.md b/docs/basics/generator.md
index 80961ae14..97471b7ea 100644
--- a/docs/basics/generator.md
+++ b/docs/basics/generator.md
@@ -14,7 +14,6 @@ Usage:
Options:
-R, [--redux], [--no-redux] # Install Redux gems and Redux version of Hello World Example
- -S, [--server-rendering], [--no-server-rendering] # Add necessary files and configurations for server-side rendering
Runtime options:
-f, [--force] # Overwrite files that already exist
@@ -33,7 +32,7 @@ The generated client code follows our organization scheme. Each unique set of fu
Inside of the generated "HelloWorld" domain you will find the following folders:
-+ `startup`: two types of files, one that return a container component and implement any code that differs between client and server code (if using server-rendering), and a `clientRegistration` file that exposes the aforementioned files (as well as a `serverRegistration` file if using server rendering). These registration files are what webpack is using as an entry point.
++ `startup`: This contains the entry point files for webpack. It defaults to a single file that is used for server and client compilation, but if these need to be different, then you can create two webpack configurations with separate endpoints.
+ `containers`: "smart components" (components that have functionality and logic that is passed to child "dumb components").
+ `components`: includes "dumb components", or components that simply render their properties and call functions given to them as properties by a parent component. Ultimately, at least one of these dumb components will have a parent container component.
diff --git a/lib/generators/USAGE b/lib/generators/USAGE
index 3dcbd689a..c44323a39 100644
--- a/lib/generators/USAGE
+++ b/lib/generators/USAGE
@@ -1,10 +1,6 @@
Description:
-The react_on_rails:install generator combined with the example pull requests of
-generator runs will get you up and running efficiently. There's a fair bit of
-setup involved when integrating Webpack with Rails. Defaults for options
-are such that the default is for the flag to be off. For example, the default for
-`-R` is that redux is off, and the default of -b is that skip-bootstrap is off.
+The react_on_rails:install generator integrates webpack with rails with ease. You can pass the redux option if you'd like to have redux setup for you automatically.
* Redux
@@ -12,88 +8,6 @@ are such that the default is for the flag to be off. For example, the default fo
to integrate the Redux state container framework. The necessary node modules
will be automatically included for you.
- The generator uses the organizational `paradigm of "bundles"`. These are like
- application domains and are used for grouping your code into webpack bundles
- in case you decide to create different bundles for deployment. This is also
- useful for separating out logical parts of your application. We recommend that
- that each bundle will have it's own Redux store. If you have code that you
- want to reuse across bundles, such as middleware or common utilities, place them
- under `/client/app/lib`. You can then import them in your client code:
- `import MyModule from 'lib/MyModule'`; since we have configured webpack to
- automatically resolve the word lib to point to this folder.
-
-* Using Images and Fonts
-
- The generator has amended the folders created in `client/assets/` to Rails's
- asset path. We recommend that if you have any existing assets that you want
- to use with your client code, you should move them to these folders and use
- webpack as normal. This allows webpack's development server to have access
- to your assets, as it will not be able to see any assets in the default Rails
- directories which are above the `/client` directory.
-
- Alternatively, if you have many existing assets and don't wish to move them,
- you could consider creating symlinks from `client/assets` that point to your
- Rails assets folders inside of `app/assets/`. The assets there will then be
- visible to both Rails and webpack.
-
-* Bootstrap Integration
-
- React on Rails ships with Twitter Bootstrap already integrated into the build.
- Note that the generator removes require_tree in both the application.js and
- application.css.scss files. This is to ensure the correct load order for the
- bootstrap integration, and is usually a good idea in general. You will therefore
- need to explicitly require your files.
-
- How the Bootstrap library is loaded depends upon whether one is using the Rails
- server or the HMR development server.
-
- 1. Bootstrap via Rails Server
-
- The Rails server loads bootstrap-sprockets, provided
- by the bootstrap-sass ruby gem (added automatically to your Gemfile by
- the generator), via the `app/assets/stylesheets/_bootstrap-custom.scss`
- partial.
-
- This allows for using Bootstrap in your regular Rails stylesheets. If you
- wish to customize any of the Bootstrap variables, you can do so via the
- `client/assets/stylesheets/_pre-bootstrap.scss` partial.
-
- 2. Bootstrap via Webpack Dev Server
-
- The webpack dev server does not go through Rails but instead loads bootstrap
- via the `bootstrap-sass-loader` webpack loader. You can configure the loader
- via the `client/bootstrap-sass-config.js` file.
-
- 3. Keeping Custom Bootstrap Configurations Synced
-
- Because the webpack dev server and Rails each load Bootstrap via a different
- file (explained in the two sections immediately above), any changes to
- the way components are loaded in one file must also be made to the other
- file in order to keep styling consistent between the two. For example,
- if an import is excluded in _bootstrap-custom.scss, the same import should
- be excluded in `bootstrap-sass-config.js` so that styling in the Rails
- server and the webpack dev server will be the same.
-
- 4. Skip Bootstrap Integration
-
- Bootstrap integration is enabled by default, but can be disabled by passing
- the --skip-bootstrap flag (alias -b). When you don't need Bootstrap in your
- existing project, just skip it as needed.
-
-* JavaScript Linters
-
- JavaScript linters are enabled by default, but can be disabled by passing the
- --skip-js-linters flag (alias j), and those that run in Node have been added to
- `client/package.json` under devDependencies.
-
-* Ruby Linters
-
- Ruby linters are disabled by default, but can be enabled by passing the
- `--ruby-linters` flag when generating. These linters have been added to your
- Gemfile in addition to the the appropriate Rake tasks.
-
- We really love using all the linters! Give them a try.
-
*******************************************************************************
After running the generator, you will want to:
@@ -102,14 +16,7 @@ After running the generator, you will want to:
Then you may run
- npm run
-
-And you will see several useful commands:
-
- express-server
- echo 'visit http://localhost:4000' && cd client && npm start
- rails-server
- echo 'visit http://localhost:3000/hello_world' && foreman start -f Procfile.dev
+ foreman start -f Procfile.dev
More Details:
diff --git a/lib/generators/react_on_rails/base_generator.rb b/lib/generators/react_on_rails/base_generator.rb
index 4a9d05352..e32ca2c0b 100644
--- a/lib/generators/react_on_rails/base_generator.rb
+++ b/lib/generators/react_on_rails/base_generator.rb
@@ -4,7 +4,7 @@
module ReactOnRails
module Generators
- class BaseGenerator < Rails::Generators::Base # rubocop:disable Metrics/ClassLength
+ class BaseGenerator < Rails::Generators::Base
include GeneratorHelper
Rails::Generators.hide_namespace(namespace)
source_root(File.expand_path("../templates", __FILE__))
@@ -15,12 +15,6 @@ class BaseGenerator < Rails::Generators::Base # rubocop:disable Metrics/ClassLen
default: false,
desc: "Install Redux gems and Redux version of Hello World Example",
aliases: "-R"
- # --server-rendering
- class_option :server_rendering,
- type: :boolean,
- default: false,
- desc: "Configure for server-side rendering of webpack JavaScript",
- aliases: "-S"
def add_hello_world_route
route "get 'hello_world', to: 'hello_world#index'"
@@ -45,14 +39,7 @@ def update_git_ignore
def update_application_js
data = <<-DATA.strip_heredoc
- // DO NOT REQUIRE jQuery or jQuery-ujs in this file!
- // DO NOT REQUIRE TREE!
-
- // CRITICAL that vendor-bundle must be BEFORE bootstrap-sprockets and turbolinks
- // since it is exposing jQuery and jQuery-ujs
-
- //= require vendor-bundle
- //= require app-bundle
+ //= require webpack-bundle
DATA
@@ -65,13 +52,6 @@ def update_application_js
end
end
- def strip_application_js_of_incompatible_sprockets_statements
- application_js = File.join(destination_root, "app/assets/javascripts/application.js")
- gsub_file(application_js, "//= require jquery_ujs", "// require jquery_ujs")
- gsub_file(application_js, %r{//= require jquery$}, "// require jquery")
- gsub_file(application_js, %r{//= require_tree \.$}, "// require_tree .")
- end
-
def strip_application_js_of_double_blank_lines
application_js = File.join(destination_root, "app/assets/javascripts/application.js")
gsub_file(application_js, /^\n^\n/, "\n")
@@ -86,10 +66,7 @@ def copy_base_files
base_path = "base/base/"
base_files = %w(app/controllers/hello_world_controller.rb
client/.babelrc
- client/webpack.client.base.config.js
- client/webpack.client.rails.config.js
- REACT_ON_RAILS.md
- client/REACT_ON_RAILS_CLIENT_README.md)
+ client/webpack.config.js)
base_files.each { |file| copy_file(base_path + file, file) }
end
@@ -104,31 +81,20 @@ def template_base_files
end
def add_base_gems_to_gemfile
- return unless options.server_rendering?
append_to_file("Gemfile", "\ngem 'therubyracer', platforms: :ruby\n")
end
- def template_client_registration_file
- filename = "clientRegistration.jsx"
- location = "client/app/bundles/HelloWorld/startup"
- template("base/base/#{location}/clientRegistration.jsx.tt", "#{location}/#{filename}")
- end
-
- def install_server_rendering_files_if_enabled
- return unless options.server_rendering?
- base_path = "base/server_rendering/"
- %w(client/webpack.server.rails.config.js
- client/app/bundles/HelloWorld/startup/serverRegistration.jsx
- client/node/package.json
+ def install_node_files
+ base_path = "base/base/"
+ %w(client/node/package.json
client/node/server.js).each do |file|
copy_file(base_path + file, file)
end
-
- copy_file("base/base/lib/tasks/load_test.rake", "lib/tasks/load_test.rake")
end
def template_assets_rake_file
template("base/base/lib/tasks/assets.rake.tt", "lib/tasks/assets.rake")
+ copy_file("base/base/lib/tasks/load_test.rake", "lib/tasks/load_test.rake")
end
ASSETS_RB_APPEND = <<-DATA.strip_heredoc
@@ -136,7 +102,7 @@ def template_assets_rake_file
# If you do not want to move existing images and fonts from your Rails app
# you could also consider creating symlinks there that point to the original
# rails directories. In that case, you would not add these paths here.
-Rails.application.config.assets.precompile += %w( server-bundle.js )
+Rails.application.config.assets.precompile += %w( webpack-bundle.js )
# Add folder with webpack generated assets to assets.paths
Rails.application.config.assets.paths << Rails.root.join("app", "assets", "webpack")
diff --git a/lib/generators/react_on_rails/dev_tests_generator.rb b/lib/generators/react_on_rails/dev_tests_generator.rb
index 8602620fb..599ea1215 100644
--- a/lib/generators/react_on_rails/dev_tests_generator.rb
+++ b/lib/generators/react_on_rails/dev_tests_generator.rb
@@ -8,6 +8,12 @@ class DevTestsGenerator < Rails::Generators::Base
Rails::Generators.hide_namespace(namespace)
source_root(File.expand_path("../templates/dev_tests", __FILE__))
+ # --example-server-rendering
+ class_option :example_server_rendering,
+ type: :boolean,
+ default: false,
+ desc: "Setup prerender true for server rendered examples"
+
def copy_rspec_files
%w(spec/spec_helper.rb
spec/rails_helper.rb
@@ -40,7 +46,7 @@ def change_webpack_client_base_config_to_include_fallback
plugins: [
TEXT
sentinel = /^\s\s},\n\s\splugins: \[\n/
- config = File.join(destination_root, "client", "webpack.client.base.config.js")
+ config = File.join(destination_root, "client", "webpack.config.js")
old_contents = File.read(config)
new_contents = old_contents.gsub(sentinel, text)
File.open(config, "w+") { |f| f.puts new_contents }
@@ -53,6 +59,16 @@ def add_test_related_gems_to_gemfile
gem("coveralls", require: false)
gem("poltergeist")
end
+
+ def gsub_prerender_if_server_rendering
+ return unless options.example_server_rendering
+ hello_world_index = File.join(destination_root, "app", "views", "hello_world", "index.html.erb")
+ hello_world_contents = File.read(hello_world_index)
+ new_hello_world_contents = hello_world_contents.gsub(/prerender: false/,
+ "prerender: true")
+
+ File.open(hello_world_index, "w+") { |f| f.puts new_hello_world_contents }
+ end
end
end
end
diff --git a/lib/generators/react_on_rails/install_generator.rb b/lib/generators/react_on_rails/install_generator.rb
index a3210f0ad..580978715 100644
--- a/lib/generators/react_on_rails/install_generator.rb
+++ b/lib/generators/react_on_rails/install_generator.rb
@@ -16,12 +16,6 @@ class InstallGenerator < Rails::Generators::Base
default: false,
desc: "Install Redux gems and Redux version of Hello World Example. Default: false",
aliases: "-R"
- # --server-rendering
- class_option :server_rendering,
- type: :boolean,
- default: false,
- desc: "Add necessary files and configurations for server-side rendering. Default: false",
- aliases: "-S"
# --ignore-warnings
class_option :ignore_warnings,
diff --git a/lib/generators/react_on_rails/react_no_redux_generator.rb b/lib/generators/react_on_rails/react_no_redux_generator.rb
index e559db20d..ed633f7bf 100644
--- a/lib/generators/react_on_rails/react_no_redux_generator.rb
+++ b/lib/generators/react_on_rails/react_no_redux_generator.rb
@@ -8,30 +8,16 @@ class ReactNoReduxGenerator < Rails::Generators::Base
Rails::Generators.hide_namespace(namespace)
source_root(File.expand_path("../templates", __FILE__))
- # --server-rendering
- class_option :server_rendering,
- type: :boolean,
- default: false,
- desc: "Configure for server-side rendering of webpack JavaScript",
- aliases: "-S"
-
def copy_base_files
base_path = "no_redux/base/"
file = "client/app/bundles/HelloWorld/containers/HelloWorld.jsx"
copy_file(base_path + file, file)
end
- def copy_server_rendering_files_if_appropriate
- return unless options.server_rendering?
- base_path = "no_redux/server_rendering/"
- file = "client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx"
- copy_file(base_path + file, file)
- end
-
- def template_appropriate_version_of_hello_world_app_client
- filename = "HelloWorldAppClient.jsx"
+ def template_appropriate_version_of_hello_world_app
+ filename = "HelloWorldApp.jsx"
location = "client/app/bundles/HelloWorld/startup"
- template("no_redux/base/#{location}/HelloWorldAppClient.jsx.tt", "#{location}/#{filename}")
+ template("no_redux/base/#{location}/HelloWorldApp.jsx.tt", "#{location}/#{filename}")
end
end
end
diff --git a/lib/generators/react_on_rails/react_with_redux_generator.rb b/lib/generators/react_on_rails/react_with_redux_generator.rb
index 884335990..f15acc686 100644
--- a/lib/generators/react_on_rails/react_with_redux_generator.rb
+++ b/lib/generators/react_on_rails/react_with_redux_generator.rb
@@ -6,18 +6,9 @@ class ReactWithReduxGenerator < Rails::Generators::Base
Rails::Generators.hide_namespace(namespace)
source_root(File.expand_path("../templates", __FILE__))
- # --server-rendering
- class_option :server_rendering,
- type: :boolean,
- default: false,
- desc: "Configure for server-side rendering of webpack JavaScript",
- aliases: "-S"
-
def create_redux_directories
dirs = %w(actions constants reducers store)
dirs.each { |name| empty_directory("client/app/bundles/HelloWorld/#{name}") }
-
- empty_directory("client/app/lib/middlewares")
end
def copy_base_redux_files
@@ -27,23 +18,15 @@ def copy_base_redux_files
client/app/bundles/HelloWorld/constants/helloWorldConstants.jsx
client/app/bundles/HelloWorld/reducers/helloWorldReducer.jsx
client/app/bundles/HelloWorld/reducers/index.jsx
- client/app/bundles/HelloWorld/store/helloWorldStore.jsx
- client/app/lib/middlewares/loggerMiddleware.js).each do |file|
+ client/app/bundles/HelloWorld/store/helloWorldStore.jsx).each do |file|
copy_file(base_path + file, file)
end
end
- def copy_server_rendering_redux_files
- return unless options.server_rendering?
- base_path = "redux/server_rendering/"
- file = "client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx"
- copy_file(base_path + file, file)
- end
-
- def template_appropriate_version_of_hello_world_app_client
- filename = "HelloWorldAppClient.jsx"
+ def template_appropriate_version_of_hello_world_app
+ filename = "HelloWorldApp.jsx"
location = "client/app/bundles/HelloWorld/startup"
- template("redux/base/#{location}/HelloWorldAppClient.jsx.tt", "#{location}/#{filename}")
+ template("redux/base/#{location}/HelloWorldApp.jsx.tt", "#{location}/#{filename}")
end
end
end
diff --git a/lib/generators/react_on_rails/templates/base/base/.DS_Store b/lib/generators/react_on_rails/templates/base/base/.DS_Store
new file mode 100644
index 000000000..5008ddfcf
Binary files /dev/null and b/lib/generators/react_on_rails/templates/base/base/.DS_Store differ
diff --git a/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt b/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt
index f9436206c..88d4c4ac5 100644
--- a/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt
+++ b/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt
@@ -1,6 +1,3 @@
web: rails s
-client: sh -c 'rm app/assets/webpack/* || true && cd client && npm run build:dev:client'
-<%- if options.server_rendering? %>
-server: sh -c 'cd client && npm run build:dev:server'
+client: sh -c 'rm app/assets/webpack/* || true && cd client && npm run build:development'
node: sh -c 'cd client/node && npm start'
-<%- end %>
diff --git a/lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md b/lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md
deleted file mode 100644
index da6741e7a..000000000
--- a/lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md
+++ /dev/null
@@ -1,16 +0,0 @@
-The `react_on_rails` gem has been installed. You can view the documentation online at
-[React on Rails](https://github.com/shakacode/react_on_rails).
-
-Also, check out the [example application](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/client/server.js)
-for a live example and code.
-
-The "Hello World" example has been installed.
-
-+ The view is located at `app/views/hello_world/index.html.erb`
-+ The controller is located at `app/controllers/hello_world_controller.rb`
-
-See [the documentation](https://github.com/shakacode/react_on_rails) for how to build your bundles and
-install your packages. Then you can view the example as follows:
-
-- Rails Server: [localhost:3000/hello_world](http://localhost:3000/hello_world)
-- Webpack Development Server with HMR: [localhost:4000/hello_world](http://localhost:4000/hello_world)
diff --git a/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt b/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt
index 6f0e76018..266bc15d6 100644
--- a/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt
+++ b/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt
@@ -1,4 +1,3 @@
-