From 668c47d7ec4091f7f6857b56037ecc134fcf0569 Mon Sep 17 00:00:00 2001 From: Anton Kandybo Date: Sun, 22 Jan 2017 14:42:08 +0200 Subject: [PATCH] Added yarn support --- README.md | 3 +++ lib/mina/npm/tasks.rb | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b9bd658..1ffbe4a 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Or install it yourself as: invoke 'npm:install' invoke 'bower:install' invoke 'grunt:task' + invoke 'yarn:install' ... end end @@ -38,10 +39,12 @@ Or install it yourself as: set :npm_bin # default: 'npm' set :bower_bin # default: 'bower' set :grunt_bin # default: 'grunt' + set :yarn_bin # default: 'yarn' set :npm_options # default: '--production' set :bower_options # default: '--allow-root' set :grunt_options # default: '' set :grunt_task # default: 'build' + set :yarn_options # default: '--production' ## Contributing diff --git a/lib/mina/npm/tasks.rb b/lib/mina/npm/tasks.rb index 7f36e0d..dabd4d8 100644 --- a/lib/mina/npm/tasks.rb +++ b/lib/mina/npm/tasks.rb @@ -1,11 +1,12 @@ set :npm_bin, 'npm' set :bower_bin, 'bower' set :grunt_bin, 'grunt' +set :yarn_bin, 'yarn' set :npm_options, '--production' set :bower_options, '--allow-root' set :grunt_options, '' set :grunt_task, 'build' - +set :yarn_options, '--production' namespace :npm do desc 'Install node modules using Npm.' @@ -20,6 +21,19 @@ end end +namespace :yarn do + desc 'Install node modules using Yarn.' + task install: :environment do + command %{ + echo "-----> Installing node modules using Yarn" + sub_directory=$(pwd | sed -r "s/.*?$(basename $build_path)//g") + #{echo_cmd %[mkdir -p "#{fetch(:deploy_to)}/#{fetch(:shared_path)}/$sub_directory/node_modules"]} + #{echo_cmd %[ln -s "#{fetch(:deploy_to)}/#{fetch(:shared_path)}/$sub_directory/node_modules" "node_modules"]} + #{echo_cmd %[#{fetch(:yarn_bin)} install #{fetch(:yarn_options)}]} + } + end +end + namespace :bower do desc "Install bower modules." task install: :environment do