annotate bin/yarn @ 486:5419f1c6a291

Readd node_modules assets load path
author nanaya <me@nanaya.pro>
date Sat, 15 Jan 2022 02:09:35 +0900
parents 88fd5722fcb3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
459
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
1 #!/usr/bin/env ruby
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
2 APP_ROOT = File.expand_path('..', __dir__)
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
3 Dir.chdir(APP_ROOT) do
481
88fd5722fcb3 Update defaults
nanaya <me@nanaya.pro>
parents: 459
diff changeset
4 yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
88fd5722fcb3 Update defaults
nanaya <me@nanaya.pro>
parents: 459
diff changeset
5 select { |dir| File.expand_path(dir) != __dir__ }.
88fd5722fcb3 Update defaults
nanaya <me@nanaya.pro>
parents: 459
diff changeset
6 product(["yarn", "yarn.exe"]).
88fd5722fcb3 Update defaults
nanaya <me@nanaya.pro>
parents: 459
diff changeset
7 map { |dir, file| File.expand_path(file, dir) }.
88fd5722fcb3 Update defaults
nanaya <me@nanaya.pro>
parents: 459
diff changeset
8 find { |file| File.executable?(file) }
88fd5722fcb3 Update defaults
nanaya <me@nanaya.pro>
parents: 459
diff changeset
9
88fd5722fcb3 Update defaults
nanaya <me@nanaya.pro>
parents: 459
diff changeset
10 if yarn
88fd5722fcb3 Update defaults
nanaya <me@nanaya.pro>
parents: 459
diff changeset
11 exec yarn, *ARGV
88fd5722fcb3 Update defaults
nanaya <me@nanaya.pro>
parents: 459
diff changeset
12 else
459
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
13 $stderr.puts "Yarn executable was not detected in the system."
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
14 $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
15 exit 1
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
16 end
07d6c6639adf Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
diff changeset
17 end