sutty/bin/yarn

20 lines
594 B
Text
Raw Normal View History

2019-07-29 19:19:46 +00:00
#!/usr/bin/env ruby
2020-12-24 18:02:03 +00:00
require 'pathname'
2019-07-29 19:19:46 +00:00
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
2020-12-24 18:02:03 +00:00
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
if executable_path
exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV
else
2019-07-29 19:19:46 +00:00
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1
end
end