yarn 533 B

123456789101112131415161718
  1. #!/usr/bin/env ruby
  2. APP_ROOT = File.expand_path('..', __dir__)
  3. Dir.chdir(APP_ROOT) do
  4. yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
  5. select { |dir| File.expand_path(dir) != __dir__ }.
  6. product(["yarn", "yarn.cmd", "yarn.ps1"]).
  7. map { |dir, file| File.expand_path(file, dir) }.
  8. find { |file| File.executable?(file) }
  9. if yarn
  10. exec yarn, *ARGV
  11. else
  12. $stderr.puts "Yarn executable was not detected in the system."
  13. $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
  14. exit 1
  15. end
  16. end