diff --git a/.github/workflows/js_test.yml b/.github/workflows/js_test.yml index b88d4ba18..ba48c5371 100644 --- a/.github/workflows/js_test.yml +++ b/.github/workflows/js_test.yml @@ -44,5 +44,8 @@ jobs: - name: Build i18n libraries run: bundle exec rake react_on_rails:locale + - name: Generate React on Rails packs + run: bundle exec rails react_on_rails:generate_packs + - name: Run js tests run: bundle exec rake ci:js diff --git a/.github/workflows/lint_test.yml b/.github/workflows/lint_test.yml index 48dea7f32..777aaa2b0 100644 --- a/.github/workflows/lint_test.yml +++ b/.github/workflows/lint_test.yml @@ -43,5 +43,8 @@ jobs: - name: Build i18n libraries run: bundle exec rake react_on_rails:locale + - name: Generate React on Rails packs + run: bundle exec rails react_on_rails:generate_packs + - name: Run lint run: bundle exec rake lint diff --git a/.github/workflows/rspec_test.yml b/.github/workflows/rspec_test.yml index ff3a60228..4d5625ec3 100644 --- a/.github/workflows/rspec_test.yml +++ b/.github/workflows/rspec_test.yml @@ -73,6 +73,9 @@ jobs: - name: Build i18n libraries run: bundle exec rake react_on_rails:locale + - name: Generate React on Rails packs + run: bundle exec rails react_on_rails:generate_packs + - name: Build Rescript components run: yarn res:build diff --git a/.gitignore b/.gitignore index 7567a8b74..222f098b5 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,8 @@ lib/bs /lib/ocaml client/app/bundles/comments/rescript/**/*.bs.js + +# Generated React on Rails packs +**/generated/** + +.claude/ diff --git a/Gemfile b/Gemfile index 7d87b495d..bce79a77f 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "3.3.4" gem "react_on_rails", "16.0.1.rc.4" -gem "shakapacker", "8.2.0" +gem "shakapacker", "8.4.0" # Bundle edge Rails instead: gem "rails", github: "rails/rails" gem "listen" diff --git a/Gemfile.lock b/Gemfile.lock index f415362f6..ab2386849 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,29 +8,29 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (8.0.2.1) - actionpack (= 8.0.2.1) - activesupport (= 8.0.2.1) + actioncable (8.0.3) + actionpack (= 8.0.3) + activesupport (= 8.0.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.0.2.1) - actionpack (= 8.0.2.1) - activejob (= 8.0.2.1) - activerecord (= 8.0.2.1) - activestorage (= 8.0.2.1) - activesupport (= 8.0.2.1) + actionmailbox (8.0.3) + actionpack (= 8.0.3) + activejob (= 8.0.3) + activerecord (= 8.0.3) + activestorage (= 8.0.3) + activesupport (= 8.0.3) mail (>= 2.8.0) - actionmailer (8.0.2.1) - actionpack (= 8.0.2.1) - actionview (= 8.0.2.1) - activejob (= 8.0.2.1) - activesupport (= 8.0.2.1) + actionmailer (8.0.3) + actionpack (= 8.0.3) + actionview (= 8.0.3) + activejob (= 8.0.3) + activesupport (= 8.0.3) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.0.2.1) - actionview (= 8.0.2.1) - activesupport (= 8.0.2.1) + actionpack (8.0.3) + actionview (= 8.0.3) + activesupport (= 8.0.3) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -38,35 +38,35 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.0.2.1) - actionpack (= 8.0.2.1) - activerecord (= 8.0.2.1) - activestorage (= 8.0.2.1) - activesupport (= 8.0.2.1) + actiontext (8.0.3) + actionpack (= 8.0.3) + activerecord (= 8.0.3) + activestorage (= 8.0.3) + activesupport (= 8.0.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.0.2.1) - activesupport (= 8.0.2.1) + actionview (8.0.3) + activesupport (= 8.0.3) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (8.0.2.1) - activesupport (= 8.0.2.1) + activejob (8.0.3) + activesupport (= 8.0.3) globalid (>= 0.3.6) - activemodel (8.0.2.1) - activesupport (= 8.0.2.1) - activerecord (8.0.2.1) - activemodel (= 8.0.2.1) - activesupport (= 8.0.2.1) + activemodel (8.0.3) + activesupport (= 8.0.3) + activerecord (8.0.3) + activemodel (= 8.0.3) + activesupport (= 8.0.3) timeout (>= 0.4.0) - activestorage (8.0.2.1) - actionpack (= 8.0.2.1) - activejob (= 8.0.2.1) - activerecord (= 8.0.2.1) - activesupport (= 8.0.2.1) + activestorage (8.0.3) + actionpack (= 8.0.3) + activejob (= 8.0.3) + activerecord (= 8.0.3) + activesupport (= 8.0.3) marcel (~> 1.0) - activesupport (8.0.2.1) + activesupport (8.0.3) base64 benchmark (>= 0.3) bigdecimal @@ -82,7 +82,7 @@ GEM addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.3) - autoprefixer-rails (10.4.16.0) + autoprefixer-rails (10.4.21.0) execjs (~> 2) awesome_print (1.9.2) base64 (0.3.0) @@ -92,7 +92,7 @@ GEM binding_of_caller (1.0.1) debug_inspector (>= 1.2.0) builder (3.3.0) - byebug (11.1.3) + byebug (12.0.0) capybara (3.40.0) addressable matrix @@ -105,7 +105,8 @@ GEM capybara-screenshot (1.0.26) capybara (>= 1.0, < 4) launchy - childprocess (5.0.0) + childprocess (5.1.0) + logger (~> 1.5) code_analyzer (0.5.5) sexp_processor coderay (1.1.3) @@ -124,37 +125,43 @@ GEM thor (>= 0.20.3, < 2.0) tins (~> 1.16) crass (1.0.6) - database_cleaner (2.0.2) + database_cleaner (2.1.0) database_cleaner-active_record (>= 2, < 3) - database_cleaner-active_record (2.1.0) + database_cleaner-active_record (2.2.2) activerecord (>= 5.a) - database_cleaner-core (~> 2.0.0) + database_cleaner-core (~> 2.0) database_cleaner-core (2.0.1) date (3.4.1) - debug (1.9.2) + debug (1.11.0) irb (~> 1.10) reline (>= 0.3.8) debug_inspector (1.2.0) - diff-lcs (1.5.1) - docile (1.4.0) + diff-lcs (1.6.2) + docile (1.4.1) drb (2.2.3) erb (5.0.2) erubi (1.13.1) erubis (2.7.0) execjs (2.10.0) - factory_bot (6.4.6) - activesupport (>= 5.0.0) - factory_bot_rails (6.4.3) - factory_bot (~> 6.4) - railties (>= 5.0.0) - ffi (1.17.0) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86_64-linux-gnu) - foreman (0.88.1) + factory_bot (6.5.5) + activesupport (>= 6.1.0) + factory_bot_rails (6.5.1) + factory_bot (~> 6.5) + railties (>= 6.1.0) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm-linux-musl) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) + foreman (0.90.0) + thor (~> 1.4) generator_spec (0.10.0) activesupport (>= 3.0.0) railties (>= 3.0.0) - globalid (1.2.1) + globalid (1.3.0) activesupport (>= 6.1) i18n (1.14.7) concurrent-ruby (~> 1.0) @@ -164,14 +171,15 @@ GEM pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - jbuilder (2.12.0) - actionview (>= 5.0.0) - activesupport (>= 5.0.0) - json (2.14.1) + jbuilder (2.14.1) + actionview (>= 7.0.0) + activesupport (>= 7.0.0) + json (2.15.0) language_server-protocol (3.17.0.5) - launchy (3.0.1) + launchy (3.1.1) addressable (~> 2.8) childprocess (~> 5.0) + logger (~> 1.6) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -185,13 +193,11 @@ GEM net-pop net-smtp marcel (1.1.0) - matrix (0.4.2) + matrix (0.4.3) method_source (1.1.0) mini_mime (1.1.5) - mini_portile2 (2.8.9) minitest (5.25.5) - mize (0.4.1) - protocol (~> 2.0) + mize (0.6.1) net-imap (0.5.10) date net-protocol @@ -200,32 +206,45 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.4) - nokogiri (1.18.10) - mini_portile2 (~> 2.8.2) + nokogiri (1.18.10-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.10-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.10-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.10-arm-linux-musl) racc (~> 1.4) nokogiri (1.18.10-arm64-darwin) racc (~> 1.4) + nokogiri (1.18.10-x86_64-darwin) + racc (~> 1.4) nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) + nokogiri (1.18.10-x86_64-linux-musl) + racc (~> 1.4) package_json (0.1.0) parallel (1.27.0) parser (3.3.9.0) ast (~> 2.4.1) racc - pg (1.5.6) + pg (1.6.2) + pg (1.6.2-aarch64-linux) + pg (1.6.2-aarch64-linux-musl) + pg (1.6.2-arm64-darwin) + pg (1.6.2-x86_64-darwin) + pg (1.6.2-x86_64-linux) + pg (1.6.2-x86_64-linux-musl) pp (0.6.2) prettyprint prettyprint (0.2.0) prism (1.5.1) - protocol (2.0.0) - ruby_parser (~> 3.0) - pry (0.14.2) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.10.1) - byebug (~> 11.0) - pry (>= 0.13, < 0.15) - pry-doc (1.5.0) + pry-byebug (3.11.0) + byebug (~> 12.0) + pry (>= 0.13, < 0.16) + pry-doc (1.6.0) pry (~> 0.11) yard (~> 0.9.11) pry-rails (0.3.11) @@ -240,7 +259,7 @@ GEM date stringio public_suffix (6.0.2) - puma (6.4.2) + puma (7.0.4) nio4r (~> 2.0) racc (1.8.1) rack (3.2.1) @@ -253,20 +272,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (8.0.2.1) - actioncable (= 8.0.2.1) - actionmailbox (= 8.0.2.1) - actionmailer (= 8.0.2.1) - actionpack (= 8.0.2.1) - actiontext (= 8.0.2.1) - actionview (= 8.0.2.1) - activejob (= 8.0.2.1) - activemodel (= 8.0.2.1) - activerecord (= 8.0.2.1) - activestorage (= 8.0.2.1) - activesupport (= 8.0.2.1) + rails (8.0.3) + actioncable (= 8.0.3) + actionmailbox (= 8.0.3) + actionmailer (= 8.0.3) + actionpack (= 8.0.3) + actiontext (= 8.0.3) + actionview (= 8.0.3) + activejob (= 8.0.3) + activemodel (= 8.0.3) + activerecord (= 8.0.3) + activestorage (= 8.0.3) + activesupport (= 8.0.3) bundler (>= 1.15.0) - railties (= 8.0.2.1) + railties (= 8.0.3) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest @@ -282,13 +301,14 @@ GEM json require_all (~> 3.0) ruby-progressbar - railties (8.0.2.1) - actionpack (= 8.0.2.1) - activesupport (= 8.0.2.1) + railties (8.0.3) + actionpack (= 8.0.3) + activesupport (= 8.0.3) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.3.0) @@ -305,23 +325,22 @@ GEM rails (>= 5.2) rainbow (~> 3.0) shakapacker (>= 6.0) - redcarpet (3.6.0) - redis (5.3.0) + redcarpet (3.6.1) + redis (5.4.1) redis-client (>= 0.22.0) - redis-client (0.22.2) + redis-client (0.26.0) connection_pool regexp_parser (2.11.3) reline (0.6.2) io-console (~> 0.5) require_all (3.0.0) - rexml (3.3.1) - strscan - rspec-core (3.13.0) + rexml (3.4.4) + rspec-core (3.13.5) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) + rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (6.0.4) @@ -332,7 +351,7 @@ GEM rspec-expectations (~> 3.12) rspec-mocks (~> 3.12) rspec-support (~> 3.12) - rspec-support (3.13.1) + rspec-support (3.13.6) rubocop (1.69.0) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -343,7 +362,7 @@ GEM rubocop-ast (>= 1.36.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.47.0) + rubocop-ast (1.47.1) parser (>= 3.3.7.2) prism (~> 1.4) rubocop-performance (1.23.1) @@ -357,10 +376,7 @@ GEM rubocop-rspec (3.4.0) rubocop (~> 1.61) ruby-progressbar (1.13.0) - ruby_parser (3.21.0) - racc (~> 1.5) - sexp_processor (~> 4.16) - rubyzip (2.3.2) + rubyzip (3.1.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -378,18 +394,18 @@ GEM tilt scss_lint (0.60.0) sass (~> 3.5, >= 3.5.5) - sdoc (2.6.1) + sdoc (2.6.4) rdoc (>= 5.0) securerandom (0.4.1) - selenium-webdriver (4.22.0) + selenium-webdriver (4.35.0) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) + rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) semantic_range (3.1.0) - sexp_processor (4.17.1) - shakapacker (8.2.0) + sexp_processor (4.17.4) + shakapacker (8.4.0) activesupport (>= 5.2) package_json rack-proxy (>= 0.6.1) @@ -399,38 +415,39 @@ GEM docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) - spring (4.2.1) + spring (4.4.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (4.2.1) + sprockets (4.2.2) concurrent-ruby (~> 1.0) + logger rack (>= 2.2.4, < 4) - sprockets-rails (3.5.1) + sprockets-rails (3.5.2) actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - stimulus-rails (1.3.3) + stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.7) - strscan (3.1.0) sync (0.5.0) - term-ansicolor (1.10.2) - mize - tins (~> 1.0) + term-ansicolor (1.11.3) + tins (~> 1) thor (1.4.0) - tilt (2.4.0) + tilt (2.6.1) timeout (0.4.3) - tins (1.33.0) + tins (1.44.1) bigdecimal + mize (~> 0.6) sync - turbo-rails (2.0.11) - actionpack (>= 6.0.0) - railties (>= 6.0.0) + tsort (0.2.0) + turbo-rails (2.0.16) + actionpack (>= 7.1.0) + railties (>= 7.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uglifier (4.2.0) + uglifier (4.2.1) execjs (>= 0.3.0, < 3) unicode-display_width (3.2.0) unicode-emoji (~> 4.1) @@ -442,20 +459,26 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - websocket (1.2.10) + websocket (1.2.11) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.36) + yard (0.9.37) zeitwerk (2.7.3) PLATFORMS - arm64-darwin-22 - ruby - x86_64-linux + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES autoprefixer-rails @@ -497,7 +520,7 @@ DEPENDENCIES scss_lint sdoc selenium-webdriver (~> 4) - shakapacker (= 8.2.0) + shakapacker (= 8.4.0) spring spring-commands-rspec stimulus-rails (~> 1.3) @@ -509,4 +532,4 @@ RUBY VERSION ruby 3.3.4p94 BUNDLED WITH - 2.4.17 + 2.5.11 diff --git a/Procfile.dev b/Procfile.dev index 90a931b08..20453bbe6 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -2,6 +2,6 @@ # You can run these commands in separate shells rescript: yarn res:dev redis: redis-server -rails: bin/rails s -p 3000 +rails: bundle exec rails s -p 3000 wp-client: HMR=true RAILS_ENV=development NODE_ENV=development bin/shakapacker-dev-server wp-server: bundle exec rake react_on_rails:locale && HMR=true SERVER_BUNDLE_ONLY=yes bin/shakapacker --watch diff --git a/Procfile.dev-prod-assets b/Procfile.dev-prod-assets index 096efc60e..0d812eb9c 100644 --- a/Procfile.dev-prod-assets +++ b/Procfile.dev-prod-assets @@ -1,10 +1,9 @@ -# You can run these commands in separate shells -web: bin/rails s -p 3001 -redis: redis-server +# Procfile for development with production assets +# Uses production-optimized, precompiled assets with development environment +# Uncomment additional processes as needed for your app -# Next line runs a watch process with webpack to compile the changed files. -# When making frequent changes to client side assets, you will prefer building webpack assets -# upon saving rather than when you refresh your browser page. -# Note, if using React on Rails localization you will need to run -# `bundle exec rake react_on_rails:locale` before you run bin/shakapacker -webpack: sh -c 'bundle exec rake react_on_rails:locale && rm -rf public/packs/* || true && bin/shakapacker -w' +rails: bundle exec rails s -p 3001 +rescript: yarn res:dev +# sidekiq: bundle exec sidekiq -C config/sidekiq.yml +# redis: redis-server # Redis is already running system-wide +# mailcatcher: mailcatcher --foreground diff --git a/Procfile.dev-static b/Procfile.dev-static deleted file mode 100644 index 31ced8e21..000000000 --- a/Procfile.dev-static +++ /dev/null @@ -1,10 +0,0 @@ -# You can run these commands in separate shells -web: rails s -p 3000 -redis: redis-server - -# Next line runs a watch process with webpack to compile the changed files. -# When making frequent changes to client side assets, you will prefer building webpack assets -# upon saving rather than when you refresh your browser page. -# Note, if using React on Rails localization you will need to run -# `bundle exec rake react_on_rails:locale` before you run bin/shakapacker -webpack: sh -c 'bundle exec rake react_on_rails:locale && rm -rf public/packs/* || true && bin/shakapacker -w' diff --git a/Procfile.dev-static-assets b/Procfile.dev-static-assets index 4561761aa..4d0a7c958 100644 --- a/Procfile.dev-static-assets +++ b/Procfile.dev-static-assets @@ -1,10 +1,12 @@ +# Procfile for development with static asset compilation # You can run these commands in separate shells -web: bin/rails s -p 3000 -redis: redis-server +web: bin/rails server -p 3000 +rescript: yarn res:dev +# redis: redis-server # Redis is already running system-wide # Next line runs a watch process with webpack to compile the changed files. # When making frequent changes to client side assets, you will prefer building webpack assets # upon saving rather than when you refresh your browser page. # Note, if using React on Rails localization you will need to run # `bundle exec rake react_on_rails:locale` before you run bin/shakapacker -webpack: sh -c 'bundle exec rake react_on_rails:locale && rm -rf public/packs/* || true && bin/shakapacker -w' +js: sh -c 'bundle exec rake react_on_rails:locale && rm -rf public/packs/* || true && bin/shakapacker -w' diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 45dbfa272..a79a30a27 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,13 +5,9 @@