diff --git a/lib/generators/react_on_rails/base_generator.rb b/lib/generators/react_on_rails/base_generator.rb index 08f76b53f..14148dfc9 100644 --- a/lib/generators/react_on_rails/base_generator.rb +++ b/lib/generators/react_on_rails/base_generator.rb @@ -40,8 +40,7 @@ def copy_base_files def copy_js_bundle_files base_path = "base/base/" base_files = %w[app/javascript/packs/server-bundle.js - app/javascript/bundles/HelloWorld/components/HelloWorldServer.js - app/javascript/bundles/HelloWorld/components/HelloWorld.module.css] + app/javascript/bundles/HelloWorld/components/HelloWorldServer.js] base_files.each { |file| copy_file("#{base_path}#{file}", file) } end diff --git a/lib/generators/react_on_rails/install_generator.rb b/lib/generators/react_on_rails/install_generator.rb index a3d7c36f2..651af8d04 100644 --- a/lib/generators/react_on_rails/install_generator.rb +++ b/lib/generators/react_on_rails/install_generator.rb @@ -54,7 +54,7 @@ def invoke_generators invoke "react_on_rails:react_no_redux" end - invoke "react_on_rails:adapt_for_older_shakapacker" unless using_shakapacker_7? + invoke "react_on_rails:adapt_for_older_shakapacker" unless using_shakapacker_7_or_above? end # NOTE: other requirements for existing files such as .gitignore or application. @@ -95,7 +95,7 @@ def add_bin_scripts def add_post_install_message message = GeneratorMessages.helpful_message_after_installation - unless using_shakapacker_7? + unless using_shakapacker_7_or_above? message = message.gsub("config/shakapacker", "config/webpacker") message = message.gsub("bin/shakapacker", "bin/webpacker") end @@ -103,9 +103,9 @@ def add_post_install_message GeneratorMessages.add_info(message) end - def using_shakapacker_7? + def using_shakapacker_7_or_above? shakapacker_gem = Gem::Specification.find_by_name("shakapacker") - shakapacker_gem.version.segments.first == 7 + shakapacker_gem.version.segments.first >= 7 rescue Gem::MissingSpecError # In case using Webpacker false diff --git a/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx b/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx index 70cff370f..e6e19dfe4 100644 --- a/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +++ b/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx @@ -1,6 +1,5 @@ import PropTypes from 'prop-types'; import React, { useState } from 'react'; -import style from './HelloWorld.module.css'; const HelloWorld = (props) => { const [name, setName] = useState(props.name); @@ -10,7 +9,7 @@ const HelloWorld = (props) => {