Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add package_manager config option, experimental support for bun #481

Merged
merged 5 commits into from
Jul 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: simplify installation now that it can be skipped with an en…
…v flag
  • Loading branch information
ElMassimo committed Jul 17, 2024
commit 2b96e7d13512b048983741c165061e5a0c609090
11 changes: 7 additions & 4 deletions vite_ruby/lib/tasks/vite.rake
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ namespace :vite do
desc 'Ensure build dependencies like Vite are installed before bundling'
task :install_dependencies do
install_env_args = ENV['VITE_RUBY_SKIP_INSTALL_DEV_DEPENDENCIES'] == 'true' ? {} : { 'NODE_ENV' => 'development' }
cmd = ViteRuby.commands.legacy_npm_version? ? 'npx ci --yes' : 'npx --yes ci'
result = system(install_env_args, cmd)
# Fallback to `yarn` if `npx` is not available.
system(install_env_args, 'yarn install --frozen-lockfile') if result.nil?

install_cmd = case (pkg = ViteRuby.config.package_manager)
when "npm" then "npm ci"
else "#{pkg} install --frozen-lockfile"
end

system(install_env_args, install_cmd)
end

desc "Provide information on ViteRuby's environment"
Expand Down
Loading