Skip to content

Commit 7b3aab7

Browse files
authored
Update bin/shakapacker to auto-generate (#1630)
1 parent 75c6602 commit 7b3aab7

File tree

6 files changed

+22
-188
lines changed

6 files changed

+22
-188
lines changed

Gemfile.development_dependencies

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ gem "amazing_print"
2424

2525
group :development, :test do
2626
gem "listen"
27+
gem "debug"
2728
gem "pry"
2829
gem "pry-byebug"
2930
gem "pry-doc"

spec/dummy/Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ GEM
118118
tins (~> 1.6)
119119
crass (1.0.6)
120120
date (3.3.4)
121+
debug (1.9.2)
122+
irb (~> 1.10)
123+
reline (>= 0.3.8)
121124
diff-lcs (1.5.0)
122125
docile (1.4.0)
123126
drb (2.2.0)
@@ -390,6 +393,7 @@ DEPENDENCIES
390393
capybara
391394
capybara-screenshot
392395
coveralls
396+
debug
393397
equivalent-xml
394398
generator_spec
395399
jbuilder

spec/dummy/Procfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# You can run these commands in separate shells
33
rails: bundle exec rails s -p 3000
44
wp-client: bin/shakapacker-dev-server
5-
wp-server: SERVER_BUNDLE_ONLY=yes bin/shakapacker --watch
5+
wp-server: SERVER_BUNDLE_ONLY=true bin/shakapacker --watch
66

77
# Bundle ReScript .res files
88
rescript: yarn build:rescript:dev

spec/dummy/bin/shakapacker

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ ENV["RAILS_ENV"] ||= "development"
99
ENV["NODE_ENV"] ||= ENV["RAILS_ENV"]
1010
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)
1111

12+
require "rake"
13+
14+
# Recommendation is to generate packs before compilation.
15+
# SERVER_BUNDLE_ONLY is true when also running the bin/shakapacker-dev-server,
16+
# so no need to run twice.
17+
unless ENV["SERVER_BUNDLE_ONLY"] == "true"
18+
Rake.application.load_rakefile
19+
Rake::Task["react_on_rails:generate_packs"].invoke
20+
end
21+
1222
APP_ROOT = File.expand_path("..", __dir__)
1323
Dir.chdir(APP_ROOT) do
1424
Shakapacker::WebpackRunner.run(ARGV)

spec/dummy/bin/shakapacker-dev-server

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ require "bundler/setup"
1212
require "shakapacker"
1313
require "shakapacker/dev_server_runner"
1414

15+
# Recommendation is to generate packs before compilation
16+
Rake.application.load_rakefile
17+
Rake::Task["react_on_rails:generate_packs"].invoke
18+
1519
APP_ROOT = File.expand_path("..", __dir__)
1620
Dir.chdir(APP_ROOT) do
1721
Shakapacker::DevServerRunner.run(ARGV)

0 commit comments

Comments
 (0)