From b54a8458d5029b3494165b7430e21b3ae34ecc0c Mon Sep 17 00:00:00 2001 From: hellekin Date: Fri, 22 Jan 2021 05:32:15 +0100 Subject: Upgrade Rails and add StimulusJS support --- bin/yarn | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bin/yarn') diff --git a/bin/yarn b/bin/yarn index 460dd56..4700a9e 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). + select { |dir| File.expand_path(dir) != __dir__ }. + product(["yarn", "yarn.exe"]). + map { |dir, file| File.expand_path(file, dir) }. + find { |file| File.executable?(file) } + + if yarn + exec yarn, *ARGV + else $stderr.puts "Yarn executable was not detected in the system." $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" exit 1 -- cgit v1.2.3