Class: Quilt::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Quilt::InstallGenerator
- Defined in:
- lib/generators/quilt/install_generator.rb
Instance Method Summary collapse
- #create_app_file ⇒ Object
- #create_route_file ⇒ Object
- #create_tsconfig ⇒ Object
- #install_js_dependencies ⇒ Object
Instance Method Details
#create_app_file ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/generators/quilt/install_generator.rb', line 31 def create_app_file app_path = "app/ui/index.tsx" unless File.exist?(app_path) copy_file "App.tsx", app_path log("React App at #{app_path}", 'wrote') end end |
#create_route_file ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/generators/quilt/install_generator.rb', line 41 def create_route_file routes_path = "config/routes.rb" if File.exist?(routes_path) route "mount Quilt::Engine, at: '/'" else copy_file "routes.rb", routes_path end say "Added Quilt engine mount" end |
#create_tsconfig ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/generators/quilt/install_generator.rb', line 21 def create_tsconfig tsconfig_path = "tsconfig.json" unless File.exist?(tsconfig_path) copy_file "tsconfig.json", tsconfig_path log(tsconfig_path, 'wrote') end end |
#install_js_dependencies ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generators/quilt/install_generator.rb', line 9 def install_js_dependencies say "Installing @shopify/react-server and @shopify/sewing-kit dependencies" system("yarn add "\ "@shopify/sewing-kit "\ "@shopify/react-server "\ "typescript "\ "react "\ "react-dom "\ "@types/react "\ "@types/react-dom") unless Rails.env.test? end |