X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/420a7289a0b08eee091f6650c2e83166df3fbe69..fc2af47f17c5f21e269c5cfea76b22701a3ab21a:/bin/yarn diff --git a/bin/yarn b/bin/yarn index 38f278aa0..72c7b5d97 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,9 +1,15 @@ #!/usr/bin/env ruby APP_ROOT = File.expand_path("..", __dir__) Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT + yarn = ENV["PATH"].split(File::PATH_SEPARATOR) + .reject { |dir| File.expand_path(dir) == __dir__ } + .product(["yarnpkg", "yarn", "yarn.cmd", "yarn.ps1"]) + .map { |dir, file| File.expand_path(file, dir) } + .find { |file| File.executable?(file) } + + if yarn + exec yarn, "--ignore-engines", *ARGV + else warn "Yarn executable was not detected in the system." warn "Download Yarn at https://yarnpkg.com/en/docs/install" exit 1