Skip to content

SSR Fixes and better tests for v3.0.0 #1274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 44 additions & 13 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby

on: [push]
jobs:
check_react_and_ujs:
Expand All @@ -17,12 +16,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Save root node_modules to cache
uses: actions/cache@v3
with:
path: node_modules
key: package-node-modules-cache-${{ hashFiles('yarn.lock') }}
- name: Save react-builds/node_modules to cache
uses: actions/cache@v3
with:
path: react-builds/node_modules
key: dummy-app-node-modules-cache-${{ hashFiles('react-builds/yarn.lock') }}
- uses: ruby/setup-ruby@v1
with:
bundler: 2.4.9
ruby-version: ${{ matrix.ruby }}
- uses: actions/setup-node@v3
- run: bundle install
- name: Save dummy app ruby gems to cache
uses: actions/cache@v3
with:
path: vendor/bundle
key: root-gem-cache-${{ hashFiles('Gemfile.lock') }}
- name: Install Ruby Gems
run: bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle _2.4.9_ install --path=vendor/bundle --jobs=4 --retry=3
- run: yarn
- run: bundle exec rake react:update
- run: bundle exec rake ujs:update
Expand All @@ -35,13 +50,12 @@ jobs:
matrix:
ruby: [2.7]
gemfile:
# These have webpacker:
- rails_5.2_no_sprockets
- rails_5.2_no_sprockets_webpacker_3
- rails_5.2_no_sprockets_webpacker_4
# These don't have webpacker:
- rails_5.2_sprockets_3
- rails_5.2_sprockets_4
# These have shakapacker:
- no_sprockets
- no_sprockets_shakapacker
# These don't have shakapacker:
- sprockets_3
- sprockets_4
runs-on: ubuntu-latest
env:
# $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
Expand All @@ -52,13 +66,30 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm -g install yalc
- run: yalc publish
- name: Save root node_modules to cache
uses: actions/cache@v3
with:
path: node_modules
key: package-node-modules-cache-${{ hashFiles('yarn.lock') }}
- name: Save test/dummy/node_modules to cache
uses: actions/cache@v3
with:
path: test/dummy/node_modules
key: dummy-app-node-modules-cache-${{ hashFiles('test/dummy/yarn.lock') }}
- uses: ruby/setup-ruby@v1
with:
bundler: 2.4.9
ruby-version: ${{ matrix.ruby }}
# TODO: Impalement caching
# bundler-cache: true
- run: bundle install
- name: Save dummy app ruby gems to cache
uses: actions/cache@v3
with:
path: test/dummy/vendor/bundle
key: dummy-app-gem-cache-${{ hashFiles('${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile.lock') }}
- name: Install Ruby Gems for dummy app
run: bundle lock --add-platform 'x86_64-linux' && bundle check --path=test/dummy/vendor/bundle || bundle _2.4.9_ install --path=test/dummy/vendor/bundle --jobs=4 --retry=3
- run: cd test/dummy && yalc add react_ujs && yarn
- run: bundle exec rake test
env:
NODE_OPTIONS: --openssl-legacy-provider
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ test/*/public/packs
**/node_modules
react-builds/build
coverage/
**/.yalc/**
yalc.lock
/vendor/bundle
.bundle/config
31 changes: 11 additions & 20 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
appraise 'rails-5.2-sprockets_4' do
gem 'rails', '~> 5.2.x'
appraise 'sprockets_4' do
gem 'rails', '~> 7.0.x'
gem 'sprockets', '~> 4.0.x'
gem 'sprockets-rails'
gem 'turbolinks', '~> 5'
gem 'mini_racer', :platforms => :mri
gem 'therubyrhino', :platforms => :jruby
end

appraise 'rails-5.2-sprockets_3' do
gem 'rails', '~> 5.2.x'
appraise 'sprockets_3' do
gem 'rails', '~> 7.0.x'
gem 'sprockets', '~> 3.5'
gem 'sprockets-rails'
gem 'turbolinks', '~> 5'
gem 'mini_racer', :platforms => :mri
gem 'therubyrhino', :platforms => :jruby
end

appraise 'rails-5.2_no_sprockets_webpacker_3' do
gem 'rails', '~> 5.2.x'
gem 'webpacker', '~> 3.0'
gem 'mini_racer', :platforms => :mri
gem 'therubyrhino', :platforms => :jruby
end

appraise 'rails-5.2_no_sprockets_webpacker_4' do
gem 'rails', '~> 5.2.x'
gem 'webpacker', '~> 4.0'
gem 'mini_racer', :platforms => :mri
gem 'therubyrhino', :platforms => :jruby
appraise 'no_sprockets_shakapacker' do
gem 'rails', '~> 7.0.x'
gem 'shakapacker', '6.6.0'
end

appraise 'rails-5.2-no_sprockets' do
appraise 'no_sprockets' do
# Appraisal adds `turbolinks` to this gemfile because it is
# present in `./Gemfile`.
# But it causes this gemfile to break, so it must be removed
# from `./gemfiles/rails_5_no_sprockets.gemfile` manually.
gem 'rails', '~> 5.2.x'
gem 'rails', '~> 7.0.x'
end
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ Changes since last non-beta release.

_Please add entries here for your pull requests that are not yet released._

### Breaking Changes
- Remove support & testing for Webpacker 3/4.
- Add support & testing for Shakapacker v6
- Requires separate compilations for server & client bundles (see [Webpack config](https://github.com/reactjs/react-rails/blob/judahmeek/workingCI/test/dummy/config/webpack))
- Replaces WebpackManifestContainer, which searched for assets in the webpack manifest, with SeparateServerBundleContainer, which expects a single server bundle file & does not use the webpack manifest at all.
- All in one PR! #1274

## [2.7.1] - 2023-05-19

#### Bug Fixes
Expand Down
79 changes: 3 additions & 76 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,55 +11,19 @@ PATH
GEM
remote: http://rubygems.org/
specs:
actioncable (6.0.2.1)
actionpack (= 6.0.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.2.1)
actionpack (= 6.0.2.1)
activejob (= 6.0.2.1)
activerecord (= 6.0.2.1)
activestorage (= 6.0.2.1)
activesupport (= 6.0.2.1)
mail (>= 2.7.1)
actionmailer (6.0.2.1)
actionpack (= 6.0.2.1)
actionview (= 6.0.2.1)
activejob (= 6.0.2.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.2.1)
actionview (= 6.0.2.1)
activesupport (= 6.0.2.1)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.2.1)
actionpack (= 6.0.2.1)
activerecord (= 6.0.2.1)
activestorage (= 6.0.2.1)
activesupport (= 6.0.2.1)
nokogiri (>= 1.8.5)
actionview (6.0.2.1)
activesupport (= 6.0.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.2.1)
activesupport (= 6.0.2.1)
globalid (>= 0.3.6)
activemodel (6.0.2.1)
activesupport (= 6.0.2.1)
activerecord (6.0.2.1)
activemodel (= 6.0.2.1)
activesupport (= 6.0.2.1)
activestorage (6.0.2.1)
actionpack (= 6.0.2.1)
activejob (= 6.0.2.1)
activerecord (= 6.0.2.1)
marcel (~> 0.3.1)
activesupport (6.0.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
Expand Down Expand Up @@ -110,8 +74,6 @@ GEM
ffi (1.15.5)
formatador (1.1.0)
gem-release (2.2.2)
globalid (1.0.1)
activesupport (>= 5.0)
guard (2.18.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
Expand All @@ -138,23 +100,17 @@ GEM
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.2.8)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
matrix (0.4.2)
method_source (1.0.0)
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_mime (1.0.2)
mini_portile2 (2.8.1)
minitest (5.17.0)
nenv (0.3.0)
nio4r (2.5.2)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
Expand All @@ -169,21 +125,6 @@ GEM
rack (2.2.6.4)
rack-test (2.0.2)
rack (>= 1.3)
rails (6.0.2.1)
actioncable (= 6.0.2.1)
actionmailbox (= 6.0.2.1)
actionmailer (= 6.0.2.1)
actionpack (= 6.0.2.1)
actiontext (= 6.0.2.1)
actionview (= 6.0.2.1)
activejob (= 6.0.2.1)
activemodel (= 6.0.2.1)
activerecord (= 6.0.2.1)
activestorage (= 6.0.2.1)
activesupport (= 6.0.2.1)
bundler (>= 1.3.0)
railties (= 6.0.2.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand Down Expand Up @@ -212,35 +153,23 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sprockets (4.0.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
test-unit (2.5.5)
thor (1.2.1)
thread_safe (0.3.6)
tilt (2.1.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.10)
thread_safe (~> 0.1)
webdrivers (5.2.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.6)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
appraisal
Expand All @@ -255,11 +184,9 @@ DEPENDENCIES
jbuilder
listen (~> 3.0.0)
pry-byebug
rails (>= 3.2)
react-rails!
selenium-webdriver
test-unit (~> 2.5)
turbolinks
webdrivers

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Ruby](https://github.com/reactjs/react-rails/actions/workflows/ruby.yml/badge.svg)](https://github.com/reactjs/react-rails/actions/workflows/ruby.yml)

## News
v2.7.1 is released. Please try it out and report any issues. We'll try to address any critical issues ASAP. We're going shortly release 3.0 which improves support for SSR, but it's a breaking change because it requires updating dependencies, such as going from `webpacker` to `shakapacker`.
v2.7.1 is released. Please try it out and report any issues. We'll try to address any critical issues ASAP. We're going shortly release 3.0, which fully support Shakapacker v6, including SSR.

## Summary
React-Rails is a flexible tool to use [React](http://facebook.github.io/react/) with Rails. The benefits:
Expand Down
5 changes: 1 addition & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ task default: :test

task :test_setup do
load 'webdrivers/Rakefile'
Dir.chdir('./test/dummy_sprockets') do
`yarn install`
end
Dir.chdir('./test/dummy_webpacker3') do
Dir.chdir('./test/dummy') do
`yarn install`
end
end
Expand Down
2 changes: 0 additions & 2 deletions gemfiles/.bundle/config

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "http://rubygems.org"

gem "rails", "~> 5.2.x"
gem "rails", "~> 7.0.x"

gemspec path: "../"
Loading