bookstore/bin/yarn

20 lines
612 B
Text
Raw Normal View History

2021-03-19 17:31:38 +02:00
#!/usr/bin/env ruby
2021-03-22 03:16:29 +01:00
# frozen_string_literal: true
2021-03-19 17:31:38 +02:00
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
2021-03-22 03:16:29 +01:00
yarn = ENV['PATH'].split(File::PATH_SEPARATOR)
.reject { |dir| File.expand_path(dir) == __dir__ }
.product(['yarn', 'yarn.cmd', 'yarn.ps1'])
.map { |dir, file| File.expand_path(file, dir) }
.find { |file| File.executable?(file) }
2021-03-19 17:31:38 +02:00
if yarn
exec yarn, *ARGV
else
2021-03-22 03:16:29 +01:00
warn 'Yarn executable was not detected in the system.'
warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
2021-03-19 17:31:38 +02:00
exit 1
end
end