Class: ReactOnRails::Generators::ReactNoReduxGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ReactOnRails::Generators::ReactNoReduxGenerator
- Includes:
- GeneratorHelper, DemoPageConfig
- Defined in:
- lib/generators/react_on_rails/react_no_redux_generator.rb
Instance Method Summary collapse
Methods included from DemoPageConfig
#build_hello_server_view_config, #build_hello_world_view_config
Methods included from GeneratorHelper
#add_documentation_reference, #add_npm_dependencies, #component_extension, #copy_file_and_missing_parent_directories, #dest_dir_exists?, #dest_file_exists?, #destination_config_path, #detect_react_version, #empty_directory_with_keep_file, #gem_in_lockfile?, #keep_file, #mark_pro_gem_installed!, #package_json, #print_generator_messages, #pro_gem_installed?, #resolve_server_client_or_both_path, #root_route_present?, #setup_file_error, #shakapacker_version_9_or_higher?, #symlink_dest_file_to_dest_file, #use_pro?, #use_rsc?, #use_rsc_pro_mode?, #using_rspack?, #using_swc?
Instance Method Details
#copy_base_files ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/generators/react_on_rails/react_no_redux_generator.rb', line 26 def copy_base_files base_js_path = "base/base" # Determine which component files to copy based on TypeScript option component_files = [ "app/javascript/src/HelloWorld/ror_components/HelloWorld.client.#{component_extension()}", "app/javascript/src/HelloWorld/ror_components/HelloWorld.server.#{component_extension()}", "app/javascript/src/HelloWorld/ror_components/HelloWorld.module.css" ] component_files.each do |file| copy_file("#{base_js_path}/#{file}", file) end end |
#create_appropriate_templates ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/generators/react_on_rails/react_no_redux_generator.rb', line 41 def create_appropriate_templates base_path = "base/base" # Only create the view template - no manual bundle needed for auto-bundling template("#{base_path}/app/views/hello_world/index.html.erb.tt", "app/views/hello_world/index.html.erb", build_hello_world_view_config( component_name: "HelloWorld", source_path: "app/javascript/src/HelloWorld/", landing_page: new_app_landing_page_available?, redux: false, rsc_demo: false )) end |