mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Update bin/yarn template
Prevent script from looping onto itself
This commit is contained in:
parent
f75546891a
commit
ca81d23c2c
1 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,14 @@
|
|||
require 'pathname'
|
||||
|
||||
APP_ROOT = File.expand_path('..', __dir__)
|
||||
Dir.chdir(APP_ROOT) do
|
||||
exec "yarn", *ARGV
|
||||
executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path|
|
||||
normalized_path = File.expand_path(path)
|
||||
|
||||
normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn'))
|
||||
end
|
||||
|
||||
exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV
|
||||
rescue Errno::ENOENT
|
||||
$stderr.puts "Yarn executable was not detected in the system."
|
||||
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||
|
|
Loading…
Reference in a new issue