Sha256: b6b2423adc56603ac0b62aec5acf20b4218e762278a6f000ed0dfbc274c9fdba

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

namespace :npm do
  task :install do
    on roles fetch(:npm_roles) do
      within fetch(:npm_target_path, release_path) do
        with fetch(:npm_env_variables, {}) do
          execute :npm, 'install', fetch(:npm_flags)
          # execute "sh -c \"cd #{fetch(:deploy_to)}/current/ && #{fetch(:build_command)}\""
        end
      end
    end
  end

  task :build do
    on roles fetch(:npm_roles) do
      within fetch(:npm_target_path, release_path) do
        with fetch(:npm_env_variables, {}) do
          execute "sh -c \"cd #{release_path} && #{fetch(:build_command)}\""
        end
      end
    end
  end

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

  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

  task :rebuild do
    on roles fetch(:npm_roles) do
      within fetch(:npm_target_path, release_path) do
        with fetch(:npm_env_variables, {}) do
          execute :npm, 'rebuild'
        end
      end
    end
  end
end

namespace :load do
  task :defaults do
    set :npm_flags, %w(--production --silent --no-progress)
    set :npm_prune_flags, '--production'
    set :npm_roles, :all
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-npm-build-2.0.2 lib/capistrano/tasks/npm_build.rake