Update yarn files for rails 6
Also allow `yarnpkg` binary for `bin/yarn`
This commit is contained in:
parent
e7e34a8c24
commit
03d2001cf2
2 changed files with 12 additions and 3 deletions
|
|
@ -17,6 +17,9 @@ FileUtils.chdir APP_ROOT do
|
||||||
system! 'gem install bundler --conservative'
|
system! 'gem install bundler --conservative'
|
||||||
system('bundle check') || system!('bundle install')
|
system('bundle check') || system!('bundle install')
|
||||||
|
|
||||||
|
# Install JavaScript dependencies
|
||||||
|
system! 'bin/yarn'
|
||||||
|
|
||||||
# puts "\n== Copying sample files =="
|
# puts "\n== Copying sample files =="
|
||||||
# unless File.exist?('config/database.yml')
|
# unless File.exist?('config/database.yml')
|
||||||
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
||||||
|
|
|
||||||
12
bin/yarn
12
bin/yarn
|
|
@ -1,9 +1,15 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
APP_ROOT = File.expand_path('..', __dir__)
|
APP_ROOT = File.expand_path('..', __dir__)
|
||||||
Dir.chdir(APP_ROOT) do
|
Dir.chdir(APP_ROOT) do
|
||||||
begin
|
yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
|
||||||
exec "yarnpkg", *ARGV
|
select { |dir| File.expand_path(dir) != __dir__ }.
|
||||||
rescue Errno::ENOENT
|
product(["yarn", "yarn.cmd", "yarn.ps1", "yarnpkg"]).
|
||||||
|
map { |dir, file| File.expand_path(file, dir) }.
|
||||||
|
find { |file| File.executable?(file) }
|
||||||
|
|
||||||
|
if yarn
|
||||||
|
exec yarn, *ARGV
|
||||||
|
else
|
||||||
$stderr.puts "Yarn executable was not detected in the system."
|
$stderr.puts "Yarn executable was not detected in the system."
|
||||||
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue