X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/1ca77d6ddac1910e85eb7ef4dedf6f1e885307e1..ae00fa84c8f981e909c61ab31b6115bb96e859cc:/bin/yarn diff --git a/bin/yarn b/bin/yarn index 99e5e7728..72c7b5d97 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,9 +1,17 @@ #!/usr/bin/env ruby APP_ROOT = File.expand_path("..", __dir__) Dir.chdir(APP_ROOT) do - exec "yarnpkg", *ARGV -rescue Errno::ENOENT - warn "Yarn executable was not detected in the system." - warn "Download Yarn at https://yarnpkg.com/en/docs/install" - exit 1 + 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 + end end