lib/vite_ruby/cli/build.rb in vite_ruby-1.2.10 vs lib/vite_ruby/cli/build.rb in vite_ruby-1.2.11

- old
+ new

@@ -1,25 +1,13 @@ # frozen_string_literal: true -class ViteRuby::CLI::Build < Dry::CLI::Command - CURRENT_ENV = ENV['RACK_ENV'] || ENV['RAILS_ENV'] +class ViteRuby::CLI::Build < ViteRuby::CLI::Vite DEFAULT_ENV = CURRENT_ENV || 'production' - def self.shared_options - 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 - desc 'Bundle all entrypoints using Vite.' shared_options option(:force, desc: 'Force the build even if assets have not changed', type: :boolean) - 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 } - block_given? ? yield(args) : ViteRuby.commands.build_from_task(*args) + def call(**options) + super { |args| ViteRuby.commands.build_from_task(*args) } end end