Class: ViteRuby::CLI::Vite
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- ViteRuby::CLI::Vite
- Defined in:
- lib/vite_ruby/cli/vite.rb
Constant Summary collapse
- CURRENT_ENV =
ENV['RACK_ENV'] || ENV['RAILS_ENV']
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.shared_options ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/vite_ruby/cli/vite.rb', line 6 def self. option(:mode, default: self::DEFAULT_ENV, values: %w[development production test], aliases: ['m'], desc: 'The build mode for Vite') option(:clobber, desc: 'Clear cache and previous builds', type: :boolean, aliases: %w[clean clear]) option(:debug, desc: 'Run Vite in verbose mode, printing all debugging output', aliases: ['verbose'], type: :boolean) option(:inspect, desc: 'Run Vite in a debugging session with node --inspect-brk', aliases: ['inspect-brk'], type: :boolean) option(:trace_deprecation, desc: 'Run Vite in debugging mode with node --trace-deprecation', aliases: ['trace-deprecation'], type: :boolean) end |
Instance Method Details
#call(mode:, args: [], clobber: false, **boolean_opts) {|args| ... } ⇒ Object
14 15 16 17 18 19 |
# File 'lib/vite_ruby/cli/vite.rb', line 14 def call(mode:, args: [], clobber: false, **boolean_opts) ViteRuby.env['VITE_RUBY_MODE'] = mode ViteRuby.commands.clobber if clobber boolean_opts.map { |name, value| args << "--#{ name }" if value } yield(args) end |