Skip to content

Commit

Permalink
Directly check if node is installed in bin/configure (#786)
Browse files Browse the repository at this point in the history
Previously, users who install node with a package manager other than
homebrew would receive a message that the package wasn't installed
via homebrew. Now the code checks whether node is present AND whether
it is the correct version in the same place.

There is a subtle difference in that the previous version would allow
you to continue without installing node but I think this was likely not
intended.
  • Loading branch information
paulhenrich authored Aug 2, 2023
1 parent 5423ae5 commit c3aaefd
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions bin/configure
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,18 @@ end
check_package("postgresql@14")
check_package("redis")
check_package("icu4c")
check_package("node")

if `yarn -v 2> /dev/null`.length > 0
puts "Yarn is installed.".green
else
puts "You don't have Yarn installed. We can't proceed without it. Try `brew install yarn` or see the installation instructions at https://yarnpkg.com/getting-started/install .".red
exit
end


required_node = `cat ./.nvmrc`.strip
actual_node = `node -v`.strip.gsub("v", "")
actual_node = begin
`node -v`.strip.gsub("v", "")
rescue
:not_found
end
message = "Bullet Train requires Node.js #{required_node} and `node -v` returns #{actual_node}."
if Gem::Version.new(actual_node) >= Gem::Version.new(required_node)
if actual_node == :not_found
puts "You don't have Node installed. We can't proceed without it. Try `brew install node`.".red
exit
elsif Gem::Version.new(actual_node) >= Gem::Version.new(required_node)
puts message.green
else
puts message.red
Expand All @@ -113,6 +111,13 @@ else
end
end

if `yarn -v 2> /dev/null`.length > 0
puts "Yarn is installed.".green
else
puts "You don't have Yarn installed. We can't proceed without it. Try `brew install yarn` or see the installation instructions at https://yarnpkg.com/getting-started/install .".red
exit
end

if File.exist?('.github/workflows/main.yml')
puts "Removing default GitHub workflow.".yellow
File.delete('.github/workflows/main.yml')
Expand Down

0 comments on commit c3aaefd

Please sign in to comment.