astral1/rails-webpack

View on GitHub
lib/tasks/npm.rake

Summary

Maintainability
Test Coverage
namespace :npm do
  desc 'Run npm install'
  task :install => 'webpack:sync' do
    Dir.chdir 'app/webpack' do
      sh 'npm install', verbose: false do |ok, _|
        fail 'Error running npm install.' unless ok
      end
    end
  end

  desc 'Clean npm node_modules'
  task :clean do
    Dir.chdir 'app/webpack' do
      FileUtils.rm_rf 'node_modules'
    end
  end

  namespace :install do
    desc 'Run a clean npm install'
    task :clean => %w(npm:clean npm:install)
  end
end