Skip to content

Commit a4bd5b3

Browse files
authored
Update code base based on sp7 (#1285)
* Remove the function to correct misconfiguration in webpacker.yml * Update the codebase based on Shakapacker * Update dependencies * Update tests * Update ujs * Fix webpackConfig import * Update Changelog * Update missing shakapacker spelling change * Remove bundle config * Remove unneeded test for `data-reactroot` This is an internal attribute of React and it is removed since React 16. Despite this, it gets added in some cases, specially when we use the bundled react with Sprocket. We don't need to depend our tests on the existance of such attributes * Update yarn.lock in dummy app
1 parent f02d973 commit a4bd5b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1706
-174
lines changed

Diff for: Appraisals

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ end
1616

1717
appraise 'shakapacker' do
1818
gem 'rails', '~> 7.0.x'
19-
gem 'shakapacker', '6.6.0'
19+
gem 'shakapacker', '7.0.2'
2020
end
2121

2222
appraise 'base' do

Diff for: CHANGELOG.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ Changes since last non-beta release.
1010
_Please add entries here for your pull requests that are not yet released._
1111

1212
### Breaking Changes
13-
- Remove support & testing for Webpacker 3/4.
14-
- Add support & testing for Shakapacker v6
15-
- Requires separate compilations for server & client bundles (see [Webpack config](https://github.com/reactjs/react-rails/tree/master/test/dummy/config/webpack))
16-
- 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.
17-
- All in one PR! #1274
13+
- Remove support & testing for Webpacker 3 and 4 #1274
14+
- Requires separate compilations for server & client bundles (see [Webpack config](https://github.com/reactjs/react-rails/tree/master/test/dummy/config/webpack)) #1274
15+
- 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. #1274
16+
17+
### Added
18+
- Add support & testing for Shakapacker 7 #1274 and #1285
1819

1920
#### Changed
2021
- The `react:component` generator now generates a function component by default #1271

Diff for: README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For version 2.7 documentation checkout [2.7-stable](https://github.com/reactjs/r
1212
## Summary
1313
React-Rails is a flexible tool to use [React](http://facebook.github.io/react/) with Rails. The benefits:
1414
* Automatically renders React server-side and client-side
15-
* Supports [Shakapacker](https://github.com/shakacode/shakapacker) v6.x
15+
* Supports [Shakapacker](https://github.com/shakacode/shakapacker) v7
1616
* Supports Sprockets 4.x, 3.x
1717
* Lets you use [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html), [ES6](http://es6-features.org/), [TypeScript](https://www.typescriptlang.org/), [CoffeeScript](http://coffeescript.org/)
1818

@@ -92,20 +92,20 @@ _Alternatively, get started with [Sprockets](#use-with-asset-pipeline)_
9292
Prevent installing default javascript dependencies by using `--skip-javascript` option:
9393

9494
```bash
95-
$ rails new my-app --skip-javascript
96-
$ cd my-app
95+
rails new my-app --skip-javascript
96+
cd my-app
9797
```
9898

9999
2. Install `shakapacker`:
100100
```bash
101-
$ bundle add shakapacker --strict
102-
$ rails webpacker:install
101+
bundle add shakapacker --strict
102+
rails shakapacker:install
103103
```
104104

105105
3. Install `react` and some other required npm packages:
106106
```bash
107-
$ yarn add react react-dom @babel/preset-react prop-types \
108-
css-loader style-loader mini-css-extract-plugin css-minimizer-webpack-plugin
107+
yarn add react react-dom @babel/preset-react prop-types \
108+
css-loader style-loader mini-css-extract-plugin css-minimizer-webpack-plugin
109109
```
110110

111111
Also update the Babel configuration in the `package.json` file:
@@ -169,7 +169,7 @@ Output: greeting: Hello from react-rails", inspect webpage in your browser to se
169169
In order to run dev server with HMR feature you need to parallely run:
170170

171171
```bash
172-
$ ./bin/webpacker-dev-server
172+
$ ./bin/shakapacker-dev-server
173173
```
174174

175175
Note: On Rails 6 you need to specify `webpack-dev-server` host. To this end, update `config/initializers/content_security_policy.rb` and uncomment relevant lines.
@@ -780,7 +780,7 @@ For example, to change the [ES6 Component template](https://github.com/reactjs/r
780780

781781
### 2.7 to 3.0
782782
- Keep your `react_ujs` up to date: `yarn upgrade`
783-
- **Drop support for Webpacker:** Before any ReactRails upgrade, make sure upgrading from Webpacker to Shakapacker 6.x.
783+
- **Drop support for Webpacker:** Before any ReactRails upgrade, make sure upgrading from Webpacker to Shakapacker 7. For more information check out Shakapacker
784784
- **SSR:** ReactRails 3.x requires separate compilations for server & client bundles. See [Webpack config](https://github.com/reactjs/react-rails/tree/master/test/dummy/config/webpack) directory in the dummy app to addapt the new implementation.
785785

786786
### 2.3 to 2.4

Diff for: gemfiles/base.gemfile.lock

+2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ GEM
173173
racc (~> 1.4)
174174
nokogiri (1.13.8-x86_64-linux)
175175
racc (~> 1.4)
176+
nokogiri (1.13.8-x86_64-linux)
177+
racc (~> 1.4)
176178
notiffany (0.1.3)
177179
nenv (~> 0.1)
178180
shellany (~> 0.0)

Diff for: gemfiles/shakapacker.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
source "http://rubygems.org"
44

55
gem "rails", "~> 7.0.x"
6-
gem "shakapacker", "6.6.0"
6+
gem "shakapacker", "7.0.2"
77

88
gemspec path: "../"

Diff for: gemfiles/shakapacker.gemfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ GEM
227227
rubyzip (>= 1.2.2, < 3.0)
228228
websocket (~> 1.0)
229229
semantic_range (3.0.0)
230-
shakapacker (6.6.0)
230+
shakapacker (7.0.2)
231231
activesupport (>= 5.2)
232232
rack-proxy (>= 0.6.1)
233233
railties (>= 5.2)
@@ -276,7 +276,7 @@ DEPENDENCIES
276276
rails (~> 7.0.x)
277277
react-rails!
278278
selenium-webdriver
279-
shakapacker (= 6.6.0)
279+
shakapacker (= 7.0.2)
280280
test-unit (~> 2.5)
281281
webdrivers
282282

Diff for: lib/assets/javascripts/react_ujs.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)