rails / jsbundling-rails

Bundle and transpile JavaScript in Rails with esbuild, rollup.js, or Webpack.
MIT License
831 stars 143 forks source link

Use Thor's `apply` instead of prerequisite tasks #183

Closed jonathanhefner closed 7 months ago

jonathanhefner commented 8 months ago

The javascript:install:shared and javascript:install:node_shared tasks serve only as prerequisites for the other installer tasks; they should not be run on their own (nor listed with rake --tasks). By replacing those tasks with corresponding calls to Thor's apply method, we avoid the overhead of running bin/rails app:template (and bundle install) multiple times.

This commit also renames install_node.rb to install_procfile.rb since it is concerned with generating a Procfile.dev file.


As a point of comparison, running the tests from #182 without this PR:

  $ time bundle exec appraisal rake test
  real  0m50.328s
  user  7m3.732s
  sys   1m24.657s

And running them with this PR:

  $ time bundle exec appraisal rake test
  real  0m28.588s
  user  3m46.645s
  sys   0m47.999s