]> git.openstreetmap.org Git - rails.git/blob - bin/yarn
Add frozen_string_literal comments to ruby files
[rails.git] / bin / yarn
1 #!/usr/bin/env ruby
2 # frozen_string_literal: true
3
4 APP_ROOT = File.expand_path("..", __dir__)
5 Dir.chdir(APP_ROOT) do
6   yarn = ENV["PATH"].split(File::PATH_SEPARATOR)
7                     .reject { |dir| File.expand_path(dir) == __dir__ }
8                     .product(["yarnpkg", "yarn", "yarn.cmd", "yarn.ps1"])
9                     .map { |dir, file| File.expand_path(file, dir) }
10                     .find { |file| File.executable?(file) }
11
12   if yarn
13     exec yarn, "--ignore-engines", *ARGV
14   else
15     warn "Yarn executable was not detected in the system."
16     warn "Download Yarn at https://yarnpkg.com/en/docs/install"
17     exit 1
18   end
19 end