lib/tasks/vite.rake in vite_ruby-3.1.7 vs lib/tasks/vite.rake in vite_ruby-3.2.0.beta0
- old
+ new
@@ -40,11 +40,12 @@
ViteRuby.commands.verify_install
end
desc 'Ensure build dependencies like Vite are installed before bundling'
task :install_dependencies do
- cmd = ViteRuby.commands.legacy_npm_version? ? 'npx ci --yes' : 'npx --yes ci'
+ legacy_flag = `npm --version`.to_i < 7 rescue false
+ cmd = legacy_flag ? 'npx ci --yes' : 'npx --yes ci'
system({ 'NODE_ENV' => 'development' }, cmd)
end
desc "Provide information on ViteRuby's environment"
task :info do
@@ -79,12 +80,8 @@
end
end
# Any prerequisite task that installs packages should also install build dependencies.
if ARGV.include?('assets:precompile')
- if ViteRuby.commands.legacy_npm_version?
- ENV['NPM_CONFIG_PRODUCTION'] = 'false'
- else
- ENV['NPM_CONFIG_INCLUDE'] = 'dev'
- end
+ ENV['NPM_CONFIG_PRODUCTION'] = 'false'
ENV['YARN_PRODUCTION'] = 'false'
end