Skip to content

Commit

Permalink
Update bin/shakapacker to auto-generate (#1630)
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 authored Jun 12, 2024
1 parent 75c6602 commit 7b3aab7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 188 deletions.
1 change: 1 addition & 0 deletions Gemfile.development_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ gem "amazing_print"

group :development, :test do
gem "listen"
gem "debug"
gem "pry"
gem "pry-byebug"
gem "pry-doc"
Expand Down
4 changes: 4 additions & 0 deletions spec/dummy/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ GEM
tins (~> 1.6)
crass (1.0.6)
date (3.3.4)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
diff-lcs (1.5.0)
docile (1.4.0)
drb (2.2.0)
Expand Down Expand Up @@ -390,6 +393,7 @@ DEPENDENCIES
capybara
capybara-screenshot
coveralls
debug
equivalent-xml
generator_spec
jbuilder
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/Procfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# You can run these commands in separate shells
rails: bundle exec rails s -p 3000
wp-client: bin/shakapacker-dev-server
wp-server: SERVER_BUNDLE_ONLY=yes bin/shakapacker --watch
wp-server: SERVER_BUNDLE_ONLY=true bin/shakapacker --watch

# Bundle ReScript .res files
rescript: yarn build:rescript:dev
10 changes: 10 additions & 0 deletions spec/dummy/bin/shakapacker
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ ENV["RAILS_ENV"] ||= "development"
ENV["NODE_ENV"] ||= ENV["RAILS_ENV"]
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)

require "rake"

# Recommendation is to generate packs before compilation.
# SERVER_BUNDLE_ONLY is true when also running the bin/shakapacker-dev-server,
# so no need to run twice.
unless ENV["SERVER_BUNDLE_ONLY"] == "true"
Rake.application.load_rakefile
Rake::Task["react_on_rails:generate_packs"].invoke
end

APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Shakapacker::WebpackRunner.run(ARGV)
Expand Down
4 changes: 4 additions & 0 deletions spec/dummy/bin/shakapacker-dev-server
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ require "bundler/setup"
require "shakapacker"
require "shakapacker/dev_server_runner"

# Recommendation is to generate packs before compilation
Rake.application.load_rakefile
Rake::Task["react_on_rails:generate_packs"].invoke

APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Shakapacker::DevServerRunner.run(ARGV)
Expand Down
Loading

0 comments on commit 7b3aab7

Please sign in to comment.