Skip to content

Commit

Permalink
Merge pull request #8 from crushlovely/master
Browse files Browse the repository at this point in the history
Added npm:prune task.
  • Loading branch information
swalkinshaw committed May 29, 2014
2 parents 917b429 + af024c1 commit 8de970d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/capistrano/tasks/npm.rake
Expand Up @@ -19,11 +19,35 @@ namespace :npm do
end

before 'deploy:updated', 'npm:install'

desc <<-DESC
Remove extraneous packages via npm. This command is executed within \
the same context as npm install using the npm_roles and npm_target_path \
variables.
By default prune will be executed with the --production flag. You can \
override this default by setting the variable shown below.
set :npm_prune_flags, '--production'
This task is strictly opt-in. If you want to run it on every deployment \
before you run npm install, add the following to your deploy.rb.
before 'npm:install', 'npm:prune'
DESC
task :prune do
on roles fetch(:npm_roles) do
within fetch(:npm_target_path, release_path) do
execute :npm, 'prune', fetch(:npm_prune_flags)
end
end
end
end

namespace :load do
task :defaults do
set :npm_flags, '--production --silent'
set :npm_prune_flags, '--production'
set :npm_roles, :all
end
end

0 comments on commit 8de970d

Please sign in to comment.