Skip to content

Commit e7881e9

Browse files
authored
Allow NPM use for install/build (#179)
1 parent 880a1bd commit e7881e9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/tasks/jsbundling/build.rake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ module Jsbundling
2424

2525
def install_command
2626
return "bun install" if File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock'))
27-
return "yarn install" if File.exist?('yarn.lock') || tool_exists?('yarn')
27+
return "yarn install" if File.exist?('yarn.lock') || (tool_exists?('yarn') && !File.exist?('package-lock.json'))
28+
return "npm install" if File.exist?('package-lock.json') || tool_exists?('npm')
2829
raise "jsbundling-rails: No suitable tool found for installing JavaScript dependencies"
2930
end
3031

3132
def build_command
3233
return "bun run build" if File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock'))
33-
return "yarn build" if File.exist?('yarn.lock') || tool_exists?('yarn')
34+
return "yarn build" if File.exist?('yarn.lock') || (tool_exists?('yarn') && !File.exist?('package-lock.json'))
35+
return "npm run build" if File.exist?('package-lock.json') || tool_exists?('npm')
3436
raise "jsbundling-rails: No suitable tool found for building JavaScript"
3537
end
3638

0 commit comments

Comments
 (0)