From 2c460e935ba46287da9d36916b304421bebb354e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Maniaci?= Date: Tue, 23 Feb 2021 00:40:09 +0000 Subject: [PATCH] cap: get Capistrano to run yarn install --- config/deploy.rb | 2 ++ lib/capistrano/tasks/yarn.rake | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 lib/capistrano/tasks/yarn.rake diff --git a/config/deploy.rb b/config/deploy.rb index 5a3652b..f001451 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -31,4 +31,6 @@ set :keep_releases, 2 +before 'deploy:assets:precompile', 'deploy:yarn_install' + after 'deploy:migrate', 'seed' diff --git a/lib/capistrano/tasks/yarn.rake b/lib/capistrano/tasks/yarn.rake new file mode 100644 index 0000000..4a8e624 --- /dev/null +++ b/lib/capistrano/tasks/yarn.rake @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +namespace :deploy do + desc 'Run rake yarn install' + task :yarn_install do + on roles(:web) do + within release_path do + execute("cd #{release_path} && yarn install --silent --no-progress --no-audit --no-optional") + end + end + end +end