shakapacker 6.0.0.rc.12 → 6.0.0.rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +16 -17
- data/docs/customizing_babel_config.md +3 -3
- data/docs/developing_webpacker.md +1 -1
- data/docs/troubleshooting.md +2 -2
- data/docs/v6_upgrade.md +13 -5
- data/lib/install/config/webpack/webpack.config.js +1 -1
- data/lib/install/package.json +1 -1
- data/lib/install/template.rb +5 -5
- data/lib/shakapacker.rb +1 -0
- data/lib/tasks/webpacker/info.rake +1 -1
- data/lib/webpacker/version.rb +1 -1
- data/package/babel/preset.js +1 -1
- data/package.json +2 -2
- data/test/mounted_app/test/dummy/package.json +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d56f3bf25f84819a60ea5e8ad408d654eec2a208886d7ebb6b84e27dd09af4a0
|
4
|
+
data.tar.gz: f71bf10af00c11400e4fc2edd43e60d6dee2be79ca79cbdd6202c9cc9442e36d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d2efc92056730fa4cd322aff21e9dc328dbf4d2e1699f2792dbab4b633445914c5f224e5aa322721570903cc3610cce6301dc83b46c0fa853606bbc225ab3ec
|
7
|
+
data.tar.gz: 62a8fc9cfb3fec708e1dbd0bdb405c5b66edec87d818f5624d94e09acae73a0f558865b504f6cf3c506e230df9b47730712fa002f1d833bd88b8ae8060852cae
|
data/CHANGELOG.md
CHANGED
@@ -49,5 +49,5 @@ Please see [UPGRADE GUIDE](./docs/v6_upgrade.md) for more information.
|
|
49
49
|
|
50
50
|
|
51
51
|
[Unreleased]: https://github.com/shakacode/shakapacker/compare/6.0.0-rc.11...master
|
52
|
-
[6.0.0.rc.12]: https://github.com/shakacode/shakapacker/compare/aba79635e6ff6562ec04d3c446d57ef19a5fef7d...
|
52
|
+
[6.0.0.rc.12]: https://github.com/shakacode/shakapacker/compare/aba79635e6ff6562ec04d3c446d57ef19a5fef7d...v6.0.0-rc.12
|
53
53
|
[6.0.0.rc.6]: https://github.com/rails/webpacker/compare/v5.4.3...aba79635e6ff6562ec04d3c446d57ef19a5fef7d
|
data/README.md
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# Shakapacker
|
2
2
|
|
3
|
-
|
3
|
+
_Official, actively maintained fork of [rails/webpacker](https://github.com/rails/webpacker). For pre v6, see [rails/webpacker 5-x-stable](https://github.com/rails/webpacker/tree/5-x-stable). Be sure to see the [CHANGELOG](./CHANGELOG.md)._
|
4
4
|
|
5
|
-
Note, internal naming will continue to use `webpacker` where possible.
|
5
|
+
* Note, internal naming will continue to use `webpacker` where possible.
|
6
|
+
* See [V6 Upgrade](./docs/v6_upgrade.md) for upgrading from v5 or prior v6 releases.
|
6
7
|
|
7
8
|
[](https://github.com/shakacode/shakapacker/actions)
|
8
9
|
[](https://github.com/shakacode/shakapacker/actions)
|
9
10
|
[](https://github.com/shakacode/shakapacker/actions)
|
10
11
|
[](https://github.com/shakacode/shakapacker/actions)
|
11
12
|
|
12
|
-
[](https://www.npmjs.com/package
|
13
|
+
[](https://www.npmjs.com/package/shakapacker)
|
13
14
|
[](https://rubygems.org/gems/shakapacker)
|
14
15
|
|
15
16
|
Webpacker makes it easy to use the JavaScript pre-processor and bundler
|
@@ -19,8 +20,6 @@ leaving Webpack responsible solely for app-like JavaScript, or it can be used ex
|
|
19
20
|
|
20
21
|
See a comparison of [webpacker with jsbundling-rails](https://github.com/rails/jsbundling-rails/blob/main/docs/comparison_with_webpacker.md).
|
21
22
|
|
22
|
-
Visit [Shipping Webpacker v6 – Status](https://discuss.rubyonrails.org/t/shipping-webpacker-v6-status/79683) for the latest news on a v6 release.
|
23
|
-
|
24
23
|
Discussion forums to discuss debugging and troubleshooting tips. Please open issues for bugs and feature requests:
|
25
24
|
1. [rails/webpacker discussion forum](https://discuss.rubyonrails.org/c/webpacker/10)
|
26
25
|
2. [Discussions tab](https://github.com/shakacode/shakapacker/discussions)
|
@@ -111,10 +110,10 @@ Update your `Gemfile`:
|
|
111
110
|
|
112
111
|
```ruby
|
113
112
|
# Gemfile
|
114
|
-
gem '
|
113
|
+
gem 'shakapacker', '~> 6.0'
|
115
114
|
|
116
115
|
# OR if you prefer to use master
|
117
|
-
gem '
|
116
|
+
gem 'shakapacker', git: 'https://github.com/shakacode/shakapacker.git'
|
118
117
|
yarn add https://github.com/shakacode/shakapacker.git
|
119
118
|
```
|
120
119
|
|
@@ -139,7 +138,7 @@ yarn add @babel/core @babel/plugin-transform-runtime @babel/preset-env @babel/ru
|
|
139
138
|
webpack webpack-assets-manifest webpack-cli webpack-merge webpack-sources webpack-dev-server
|
140
139
|
```
|
141
140
|
|
142
|
-
Previously, these "webpack" and "babel" packages were direct dependencies for
|
141
|
+
Previously, these "webpack" and "babel" packages were direct dependencies for `webpacker`. By
|
143
142
|
making these peer dependencies, you have control over the versions used in your webpack and babel configs.
|
144
143
|
|
145
144
|
## Usage
|
@@ -314,7 +313,7 @@ Then `require` this file in your `config/webpack/webpack.config.js`:
|
|
314
313
|
|
315
314
|
```js
|
316
315
|
// config/webpack/webpack.config.js
|
317
|
-
const { webpackConfig, merge } = require('
|
316
|
+
const { webpackConfig, merge } = require('shakapacker')
|
318
317
|
const customConfig = require('./custom')
|
319
318
|
|
320
319
|
module.exports = merge(webpackConfig, customConfig)
|
@@ -324,7 +323,7 @@ If you need access to configs within Webpacker's configuration, you can import t
|
|
324
323
|
|
325
324
|
```js
|
326
325
|
// config/webpack/webpack.config.js
|
327
|
-
const { webpackConfig } = require('
|
326
|
+
const { webpackConfig } = require('shakapacker')
|
328
327
|
|
329
328
|
console.log(webpackConfig.output_path)
|
330
329
|
console.log(webpackConfig.source_path)
|
@@ -340,7 +339,7 @@ By default, you will find the Webpacker preset in your `package.json`.
|
|
340
339
|
```json
|
341
340
|
"babel": {
|
342
341
|
"presets": [
|
343
|
-
"./node_modules
|
342
|
+
"./node_modules/shakapacker/package/babel/preset.js"
|
344
343
|
]
|
345
344
|
},
|
346
345
|
```
|
@@ -423,7 +422,7 @@ Then modify the webpack config to use it as a plugin:
|
|
423
422
|
|
424
423
|
```js
|
425
424
|
// config/webpack/webpack.config.js
|
426
|
-
const { webpackConfig, merge } = require("
|
425
|
+
const { webpackConfig, merge } = require("shakapacker");
|
427
426
|
const ForkTSCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
428
427
|
|
429
428
|
module.exports = merge(webpackConfig, {
|
@@ -443,7 +442,7 @@ Optionally, add the `CSS` extension to webpack config for easy resolution.
|
|
443
442
|
|
444
443
|
```js
|
445
444
|
// config/webpack/webpack.config.js
|
446
|
-
const { webpackConfig, merge } = require('
|
445
|
+
const { webpackConfig, merge } = require('shakapacker')
|
447
446
|
const customConfig = {
|
448
447
|
resolve: {
|
449
448
|
extensions: ['.css']
|
@@ -516,7 +515,7 @@ module.exports = {
|
|
516
515
|
|
517
516
|
```js
|
518
517
|
// config/webpack/webpack.config.js
|
519
|
-
const { webpackConfig, merge } = require('
|
518
|
+
const { webpackConfig, merge } = require('shakapacker')
|
520
519
|
const vueConfig = require('./rules/vue')
|
521
520
|
|
522
521
|
module.exports = merge(vueConfig, webpackConfig)
|
@@ -581,15 +580,15 @@ bundle update webpacker
|
|
581
580
|
rails webpacker:install
|
582
581
|
|
583
582
|
# yarn 1 instructions
|
584
|
-
yarn upgrade
|
583
|
+
yarn upgrade shakapacker --latest
|
585
584
|
yarn upgrade webpack-dev-server --latest
|
586
585
|
|
587
586
|
# yarn 2 instructions
|
588
|
-
yarn up
|
587
|
+
yarn up shakapacker@latest
|
589
588
|
yarn up webpack-dev-server@latest
|
590
589
|
|
591
590
|
# Or to install the latest release (including pre-releases)
|
592
|
-
yarn add
|
591
|
+
yarn add shakapacker@next
|
593
592
|
```
|
594
593
|
|
595
594
|
Also, consult the [CHANGELOG](./CHANGELOG.md) for additional upgrade links.
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# Customizing Babel Config
|
2
2
|
|
3
3
|
## Default Configuration
|
4
|
-
The default configuration of babel is done by using `package.json` to use the file within the
|
4
|
+
The default configuration of babel is done by using `package.json` to use the file within the `shakapacker` package.
|
5
5
|
|
6
6
|
```json
|
7
7
|
{
|
8
8
|
"babel": {
|
9
9
|
"presets": [
|
10
|
-
"./node_modules
|
10
|
+
"./node_modules/shakapacker/package/babel/preset.js"
|
11
11
|
]
|
12
12
|
}
|
13
13
|
}
|
@@ -27,7 +27,7 @@ yarn add --dev @pmmmwh/react-refresh-webpack-plugin react-refresh
|
|
27
27
|
```js
|
28
28
|
// babel.config.js
|
29
29
|
module.exports = function (api) {
|
30
|
-
const defaultConfigFunc = require('
|
30
|
+
const defaultConfigFunc = require('shakapacker/package/babel/preset.js')
|
31
31
|
const resultConfig = defaultConfigFunc(api)
|
32
32
|
const isProductionEnv = api.env('production')
|
33
33
|
|
@@ -13,7 +13,7 @@ Let's call the shakacode/shakapacker directory `WEBPACKER_DIR` which has shakaco
|
|
13
13
|
### Setup with Yalc
|
14
14
|
Use [`yalc`](https://github.com/wclr/yalc) unless you like yak shaving weird errors.
|
15
15
|
1. In `WEBPACKER_DIR`, run `yalc publish`
|
16
|
-
2. In `TEST_APP_DIR`, run `yalc link
|
16
|
+
2. In `TEST_APP_DIR`, run `yalc link shakapacker`
|
17
17
|
|
18
18
|
## Update the Package Code
|
19
19
|
1. Make some JS change in WEBPACKER_DIR
|
data/docs/troubleshooting.md
CHANGED
@@ -132,7 +132,7 @@ To silent these warnings, please update `config/webpack/webpack.config.js`:
|
|
132
132
|
```js
|
133
133
|
const webpack = require('webpack')
|
134
134
|
const { resolve } = require('path')
|
135
|
-
const { webpackConfig, merge } = require('
|
135
|
+
const { webpackConfig, merge } = require('shakapacker')
|
136
136
|
|
137
137
|
module.exports = merge(webpackConfig, {
|
138
138
|
plugins: [
|
@@ -181,7 +181,7 @@ Instead do:
|
|
181
181
|
// config/webpack/webpack.config.js
|
182
182
|
|
183
183
|
const webpack = require('webpack')
|
184
|
-
const { webpackConfig, merge } = require('
|
184
|
+
const { webpackConfig, merge } = require('shakapacker')
|
185
185
|
|
186
186
|
module.exports = merge(webpackConfig, {
|
187
187
|
plugins: [
|
data/docs/v6_upgrade.md
CHANGED
@@ -10,6 +10,14 @@ Webpacker used to configure Webpack indirectly, which lead to a [complicated sec
|
|
10
10
|
|
11
11
|
This means you have to configure integration with frameworks yourself, but webpack-merge helps with this. See this example for [Vue](https://github.com/shakacode/shakapacker#other-frameworks) and scroll to the bottom for [more examples](#examples-of-v5-to-v6).
|
12
12
|
|
13
|
+
## webpacker v6.0.0.rc.6 to shakapacker
|
14
|
+
See example migration, [PR 27](https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh/pull/27).
|
15
|
+
|
16
|
+
### Update
|
17
|
+
1. Peer dependencies. Run `yarn add @babel/core @babel/plugin-transform-runtime @babel/preset-env @babel/runtime babel-loader compression-webpack-plugin pnp-webpack-plugin terser-webpack-plugin webpack webpack-assets-manifest webpack-cli webpack-merge webpack-sources webpack-dev-server`
|
18
|
+
2. Update your webpack config for a single config file, `config/webpack/webpack.config.js`.
|
19
|
+
3. Update `babel.config.js` if you need JSX support.
|
20
|
+
|
13
21
|
## How to upgrade to Webpacker v6 from v5
|
14
22
|
1. Ensure you have a clean working git branch. You will be overwriting all your files and reverting the changes that you don't want.
|
15
23
|
|
@@ -33,13 +41,13 @@ This means you have to configure integration with frameworks yourself, but webpa
|
|
33
41
|
|
34
42
|
1. Upgrade the Webpacker Ruby gem and the NPM package
|
35
43
|
|
36
|
-
Note: [Check the releases page to verify the latest version](https://github.com/rails/webpacker/releases), and make sure to install identical version numbers of webpacker gem and
|
44
|
+
Note: [Check the releases page to verify the latest version](https://github.com/rails/webpacker/releases), and make sure to install identical version numbers of webpacker gem and `shakapacker` npm package. (Gems use a period and packages use a dot between the main version number and the beta version.)
|
37
45
|
|
38
46
|
Example going to a specific version:
|
39
47
|
|
40
48
|
```ruby
|
41
49
|
# Gemfile
|
42
|
-
gem '
|
50
|
+
gem 'shakapacker', '6.0.0.rc.13', require: 'webpacker'
|
43
51
|
```
|
44
52
|
|
45
53
|
```bash
|
@@ -47,7 +55,7 @@ This means you have to configure integration with frameworks yourself, but webpa
|
|
47
55
|
```
|
48
56
|
|
49
57
|
```bash
|
50
|
-
yarn add
|
58
|
+
yarn add shakapacker@6.0.0-rc.7 --exact
|
51
59
|
```
|
52
60
|
|
53
61
|
```bash
|
@@ -64,7 +72,7 @@ This means you have to configure integration with frameworks yourself, but webpa
|
|
64
72
|
1. There is now a single default configuration file of `config/webpack/webpack.config.js`. Previously, the config file was set
|
65
73
|
to `config/webpack/#{NODE_ENV}.js`. In the `config/webpack/` directory, you can either refactor your code in `test.js`, `development.js`, and `production.js` to a single file, `webpack.config.js` or you can replace the contents of `config/webpack/config.webpack.js` to conditionally load the old file based on the NODE_ENV with this snippet:
|
66
74
|
```js
|
67
|
-
const { env, webpackConfig } = require('
|
75
|
+
const { env, webpackConfig } = require('shakapacker')
|
68
76
|
const { existsSync } = require('fs')
|
69
77
|
const { resolve } = require('path')
|
70
78
|
|
@@ -109,7 +117,7 @@ This means you have to configure integration with frameworks yourself, but webpa
|
|
109
117
|
1. Import `environment` changed to `webpackConfig`. For example, the new code looks like:
|
110
118
|
```js
|
111
119
|
// config/webpack/webpack.config.js
|
112
|
-
const { webpackConfig, merge } = require('
|
120
|
+
const { webpackConfig, merge } = require('shakapacker')
|
113
121
|
const customConfig = require('./custom')
|
114
122
|
|
115
123
|
module.exports = merge(webpackConfig, customConfig)
|
data/lib/install/package.json
CHANGED
data/lib/install/template.rb
CHANGED
@@ -66,11 +66,11 @@ results = []
|
|
66
66
|
|
67
67
|
Dir.chdir(Rails.root) do
|
68
68
|
if Webpacker::VERSION.match?(/^[0-9]+\.[0-9]+\.[0-9]+$/)
|
69
|
-
say "Installing
|
70
|
-
results << run("yarn add
|
69
|
+
say "Installing shakapacker@#{Webpacker::VERSION}"
|
70
|
+
results << run("yarn add shakapacker@#{Webpacker::VERSION}")
|
71
71
|
else
|
72
|
-
say "Installing
|
73
|
-
results << run("yarn add
|
72
|
+
say "Installing shakapacker@next"
|
73
|
+
results << run("yarn add shakapacker@next")
|
74
74
|
end
|
75
75
|
|
76
76
|
package_json = File.read("#{__dir__}/../../package.json")
|
@@ -80,7 +80,7 @@ Dir.chdir(Rails.root) do
|
|
80
80
|
result << "#{package}@#{major_version}"
|
81
81
|
end.join(" ")
|
82
82
|
|
83
|
-
say "Adding
|
83
|
+
say "Adding shakapacker peerDependencies"
|
84
84
|
results << run("yarn add #{peers_to_add}")
|
85
85
|
|
86
86
|
say "Installing webpack-dev-server for live reloading as a development dependency"
|
data/lib/shakapacker.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "webpacker"
|
@@ -11,7 +11,7 @@ namespace :webpacker do
|
|
11
11
|
$stdout.puts "Yarn: #{`yarn --version`}"
|
12
12
|
|
13
13
|
$stdout.puts "\n"
|
14
|
-
$stdout.puts "
|
14
|
+
$stdout.puts "shakapacker: \n#{`npm list shakapacker version`}"
|
15
15
|
|
16
16
|
$stdout.puts "Is bin/webpacker present?: #{File.exist? 'bin/webpacker'}"
|
17
17
|
$stdout.puts "Is bin/webpacker-dev-server present?: #{File.exist? 'bin/webpacker-dev-server'}"
|
data/lib/webpacker/version.rb
CHANGED
data/package/babel/preset.js
CHANGED
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shakapacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.rc.
|
4
|
+
version: 6.0.0.rc.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-01-
|
13
|
+
date: 2022-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- lib/install/config/webpacker.yml
|
158
158
|
- lib/install/package.json
|
159
159
|
- lib/install/template.rb
|
160
|
+
- lib/shakapacker.rb
|
160
161
|
- lib/shakapacker/utils/misc.rb
|
161
162
|
- lib/shakapacker/utils/version_syntax_converter.rb
|
162
163
|
- lib/tasks/webpacker.rake
|
@@ -268,7 +269,7 @@ homepage: https://github.com/shakacode/shakapacker
|
|
268
269
|
licenses:
|
269
270
|
- MIT
|
270
271
|
metadata:
|
271
|
-
source_code_uri: https://github.com/shakacode/shakapacker/tree/v6.0.0-rc.
|
272
|
+
source_code_uri: https://github.com/shakacode/shakapacker/tree/v6.0.0-rc.13
|
272
273
|
post_install_message:
|
273
274
|
rdoc_options: []
|
274
275
|
require_paths:
|