shakapacker 10.0.0.rc.0 → 10.0.0.rc.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88f81e8b1935f9898330405c06f7e71366d53b5c43a9223931055a741697e76a
4
- data.tar.gz: f4358d5be4114b34aa01668c07b2ed5d0e032dfac18174c4e052afdd39885091
3
+ metadata.gz: 1a0d6c24ca0e6cce73048e9b75be73df83ad8791f33c1c9493694b7ff1e0a586
4
+ data.tar.gz: e67aafa3ec762b7a218bb595cc437a4b4b84d5423b0158ce01f9dc623b77b4ae
5
5
  SHA512:
6
- metadata.gz: e774c9cce94707f55922d2bb65d3ce9aa1f773937a315373cde05e6c01ad4531e1815e2a1b276dc80c07ff670604db0de58e5cf14b67b7130cf27ac3135cb619
7
- data.tar.gz: 3cf440898e5ef0a949835aead30e370c4bbd5d648e57233b763bc8a768edfca7572fbcbf954d1823c80321e1220e8d086114400296d3b345c59fd48cf2092245
6
+ metadata.gz: 1ea91fda68b331d5488bf6b94f47158b2bff45db414b3a6b9de7143431143cc2bed234869959e20301eb1e379bc8bae2b8f2c2c0787e632239fa25aedff0f086
7
+ data.tar.gz: 4c67d6399cfba68c652f05d2559321f24d9f6486b82a9426e79f352e79953ec1c49847884060c4096cff00d2d908526431bb8ee52dfcf1b0c7ca4604feaa0c7b
@@ -56,7 +56,8 @@ jobs:
56
56
 
57
57
  - name: Install dependencies
58
58
  run: |
59
- yalc link shakapacker
59
+ yarn install
60
+ yalc add shakapacker
60
61
  yarn install
61
62
 
62
63
  - name: Switch to Webpack
@@ -109,7 +110,8 @@ jobs:
109
110
 
110
111
  - name: Install dependencies
111
112
  run: |
112
- yalc link shakapacker
113
+ yarn install
114
+ yalc add shakapacker
113
115
  yarn install
114
116
 
115
117
  - name: Switch to RSpack
@@ -162,7 +164,8 @@ jobs:
162
164
 
163
165
  - name: Install dependencies
164
166
  run: |
165
- yalc link shakapacker
167
+ yarn install
168
+ yalc add shakapacker
166
169
  yarn install
167
170
 
168
171
  - name: Test switching between bundlers
data/.prettierignore CHANGED
@@ -5,3 +5,4 @@ lib/install/config/**/*.js
5
5
  # Temporarily ignore workflow files that cannot be modified in PRs due to claude-review validation
6
6
  .github/workflows/claude.yml
7
7
  .github/workflows/claude-code-review.yml
8
+ .context/
data/CHANGELOG.md CHANGED
@@ -9,10 +9,11 @@
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
- ## [v10.0.0-rc.0] - April 1, 2026
12
+ ## [v10.0.0-rc.1] - April 7, 2026
13
13
 
14
14
  ### Added
15
15
 
16
+ - **Added `bin/diff-bundler-config` CLI for semantic bundler configuration diffs**. [PR #973](https://github.com/shakacode/shakapacker/pull/973) by [justin808](https://github.com/justin808). Wraps the extracted [`pack-config-diff`](https://github.com/shakacode/pack-config-diff) package to provide semantic diffing of webpack/rspack configurations with normalized exit codes. Supersedes [#961](https://github.com/shakacode/shakapacker/pull/961).
16
17
  - **Added `bin/shakapacker-watch` binstub for clean Ctrl-C shutdown in Procfile-based workflows**. [PR #1026](https://github.com/shakacode/shakapacker/pull/1026) by [justin808](https://github.com/justin808). The new wrapper script traps INT/TERM signals and forwards TERM to the underlying `bin/shakapacker --watch` process, preventing Ruby interrupt backtraces when stopping `bin/dev`. Use `bin/shakapacker-watch --watch` in Procfiles instead of `bin/shakapacker --watch`.
17
18
  - **Allowed `webpack-cli` v7 (`^7.0.0`) in peer dependencies**. [PR #1021](https://github.com/shakacode/shakapacker/pull/1021) by [justin808](https://github.com/justin808). Fixes [#1020](https://github.com/shakacode/shakapacker/issues/1020). Note: `webpack-cli` v7 requires Node.js >= 20.9.0.
18
19
 
@@ -908,8 +909,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
908
909
 
909
910
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
910
911
 
911
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v10.0.0-rc.0...main
912
- [v10.0.0-rc.0]: https://github.com/shakacode/shakapacker/compare/v9.7.0...v10.0.0-rc.0
912
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v10.0.0-rc.1...main
913
+ [v10.0.0-rc.1]: https://github.com/shakacode/shakapacker/compare/v9.7.0...v10.0.0-rc.1
913
914
  [v9.7.0]: https://github.com/shakacode/shakapacker/compare/v9.6.1...v9.7.0
914
915
  [v9.6.1]: https://github.com/shakacode/shakapacker/compare/v9.6.0...v9.6.1
915
916
  [v9.6.0]: https://github.com/shakacode/shakapacker/compare/v9.5.0...v9.6.0
data/CONTRIBUTING.md CHANGED
@@ -174,12 +174,16 @@ yarn lint --cache
174
174
  yalc push # or yalc publish --push
175
175
  ```
176
176
 
177
- 3. Run the following commands to set up the development environment.
177
+ 3. Run `bin/setup` to install development dependencies.
178
+ ```bash
179
+ bin/setup
180
+ # Optional: enable local pre-commit hooks
181
+ npx husky
178
182
  ```
183
+ Manual equivalent:
184
+ ```bash
179
185
  bundle install
180
186
  yarn install
181
- # Optional: enable local pre-commit hooks
182
- npx husky
183
187
  ```
184
188
 
185
189
  ## Understanding Optional Peer Dependencies
data/README.md CHANGED
@@ -960,6 +960,32 @@ This exports development and production configurations for both client and serve
960
960
 
961
961
  For more options and usage examples, see the [Troubleshooting Guide](./docs/troubleshooting.md#exporting-webpack--rspack-configuration).
962
962
 
963
+ #### Comparing Configurations
964
+
965
+ Once you've exported configurations, compare them semantically with `bin/diff-bundler-config` (powered by [`pack-config-diff`](https://github.com/shakacode/pack-config-diff)):
966
+
967
+ ```bash
968
+ # Compare development vs production configs
969
+ bin/diff-bundler-config \
970
+ --left=shakapacker-config-exports/webpack-development-client.yaml \
971
+ --right=shakapacker-config-exports/webpack-production-client.yaml
972
+
973
+ # Get a quick summary
974
+ bin/diff-bundler-config \
975
+ --left=config1.yaml \
976
+ --right=config2.yaml \
977
+ --format=summary
978
+ ```
979
+
980
+ This is useful for:
981
+
982
+ - Understanding environment-specific config changes
983
+ - Debugging unexpected behavior differences
984
+ - Migration validation (webpack -> rspack)
985
+ - Reviewing bundler config changes in PRs
986
+
987
+ For full usage, see the [Configuration Diff Guide](./docs/config-diff.md).
988
+
963
989
  ### Integrations
964
990
 
965
991
  Shakapacker out of the box supports JS and static assets (fonts, images etc.) compilation. To enable support for CoffeeScript or TypeScript install relevant packages:
data/Rakefile CHANGED
@@ -27,8 +27,9 @@ namespace :run_spec do
27
27
  sh_in_dir(".", "yalc publish")
28
28
  sh_in_dir(spec_dummy_dir, [
29
29
  "bundle install",
30
- "yalc link shakapacker",
31
- "npm install",
30
+ "yarn install",
31
+ "yalc add shakapacker",
32
+ "yarn install",
32
33
  "bin/test-bundler webpack",
33
34
  "NODE_ENV=test RAILS_ENV=test bin/shakapacker",
34
35
  "bundle exec rspec"
@@ -44,8 +45,9 @@ namespace :run_spec do
44
45
  sh_in_dir(".", "yalc publish")
45
46
  sh_in_dir(spec_dummy_dir, [
46
47
  "bundle install",
47
- "yalc link shakapacker",
48
- "npm install",
48
+ "yarn install",
49
+ "yalc add shakapacker",
50
+ "yarn install",
49
51
  "bin/test-bundler rspack",
50
52
  "NODE_ENV=test RAILS_ENV=test bin/shakapacker",
51
53
  "bundle exec rspec"
@@ -61,8 +63,9 @@ namespace :run_spec do
61
63
  sh_in_dir(".", "yalc publish")
62
64
  sh_in_dir(spec_dummy_dir, [
63
65
  "bundle install",
64
- "yalc link shakapacker",
65
- "npm install",
66
+ "yarn install",
67
+ "yalc add shakapacker",
68
+ "yarn install",
66
69
  "NODE_ENV=test RAILS_ENV=test npm exec --no -- rspack build --config config/rspack/rspack.config.js",
67
70
  "bundle exec rspec"
68
71
  ])
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { createRequire } = require("module")
4
+
5
+ const PACK_CONFIG_DIFF_PACKAGE = "pack-config-diff"
6
+
7
+ function formatError(error) {
8
+ return error instanceof Error ? error.message : String(error)
9
+ }
10
+
11
+ function exitWithCode(exitCode) {
12
+ if (!Number.isInteger(exitCode)) {
13
+ console.error(
14
+ `[Shakapacker] ${PACK_CONFIG_DIFF_PACKAGE} returned a non-integer exit code: ${String(exitCode)}`
15
+ )
16
+ process.exit(2)
17
+ }
18
+
19
+ // Forward only pack-config-diff's documented exit codes (0 = no diffs, 1 = diffs found).
20
+ // Any other code is a tool failure — normalize to 2.
21
+ process.exit(exitCode <= 1 ? exitCode : 2)
22
+ }
23
+
24
+ let run
25
+
26
+ try {
27
+ // Resolve pack-config-diff via shakapacker's dependency tree so strict package
28
+ // managers (pnpm, Yarn PnP) can find the transitive dependency.
29
+ const shakapackerRequire = createRequire(
30
+ require.resolve("shakapacker/package.json")
31
+ )
32
+ const loadedModule = shakapackerRequire("pack-config-diff")
33
+ run = loadedModule.run
34
+ } catch (error) {
35
+ console.error(
36
+ `[Shakapacker] Failed to load ${PACK_CONFIG_DIFF_PACKAGE}: ${formatError(error)}`
37
+ )
38
+ process.exit(2)
39
+ }
40
+
41
+ if (typeof run !== "function") {
42
+ console.error(
43
+ `[Shakapacker] ${PACK_CONFIG_DIFF_PACKAGE} did not export a run() function`
44
+ )
45
+ process.exit(2)
46
+ }
47
+
48
+ try {
49
+ const runResult = run(process.argv.slice(2))
50
+
51
+ if (runResult && typeof runResult.then === "function") {
52
+ runResult
53
+ .then((exitCode) => exitWithCode(exitCode))
54
+ .catch((error) => {
55
+ console.error(formatError(error))
56
+ process.exit(2)
57
+ })
58
+ } else {
59
+ exitWithCode(runResult)
60
+ }
61
+ } catch (error) {
62
+ console.error(formatError(error))
63
+ process.exit(2)
64
+ }
data/bin/setup ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
+ cd "$ROOT_DIR"
6
+
7
+ run_cmd() {
8
+ if [[ -x "$ROOT_DIR/bin/conductor-exec" ]]; then
9
+ "$ROOT_DIR/bin/conductor-exec" "$@"
10
+ else
11
+ "$@"
12
+ fi
13
+ }
14
+
15
+ ensure_tool() {
16
+ local tool="$1"
17
+ if ! run_cmd "$tool" --version >/dev/null 2>&1; then
18
+ echo "Error: $tool is not available. Install it and run bin/setup again." >&2
19
+ exit 1
20
+ fi
21
+ }
22
+
23
+ echo "Checking required tools..."
24
+ ensure_tool ruby
25
+ ensure_tool bundle
26
+ ensure_tool node
27
+ ensure_tool yarn
28
+
29
+ echo "Installing Ruby dependencies..."
30
+ run_cmd bundle install
31
+
32
+ echo "Installing JavaScript dependencies..."
33
+ run_cmd yarn install
34
+
35
+ echo "Development dependencies installed."
36
+ echo "Optional: run 'npx husky' to enable local git hooks."
@@ -0,0 +1,159 @@
1
+ # Configuration Diff Tool
2
+
3
+ Shakapacker includes a semantic configuration diff workflow for webpack/rspack configs via [`pack-config-diff`](https://github.com/shakacode/pack-config-diff).
4
+
5
+ This gives you structured, meaningful diffs instead of raw line-by-line file diffs.
6
+
7
+ ## Why use this instead of `diff`?
8
+
9
+ Traditional file diff tools are great for source code, but generated bundler configs are noisy and deeply nested.
10
+
11
+ Semantic diffing is better for this use case because it:
12
+
13
+ - Understands nested webpack/rspack configuration objects
14
+ - Supports filtering noisy sections with `--ignore-keys` and `--ignore-paths`
15
+ - Normalizes machine-specific absolute paths by default
16
+ - Supports summary, detailed, JSON, and YAML output formats
17
+ - Handles config-specific value types (functions, RegExp, Date)
18
+
19
+ ## Quick Start
20
+
21
+ Export configs, then diff them:
22
+
23
+ ```bash
24
+ # Export all standard configs (dev/prod + client/server)
25
+ bin/shakapacker-config --doctor
26
+
27
+ # Compare development vs production client config
28
+ bin/diff-bundler-config \
29
+ --left=shakapacker-config-exports/webpack-development-client.yaml \
30
+ --right=shakapacker-config-exports/webpack-production-client.yaml
31
+ ```
32
+
33
+ ## Common Workflows
34
+
35
+ ### 1. Works in development, broken in production
36
+
37
+ ```bash
38
+ bin/shakapacker-config --doctor
39
+
40
+ bin/diff-bundler-config \
41
+ --left=shakapacker-config-exports/webpack-development-client.yaml \
42
+ --right=shakapacker-config-exports/webpack-production-client.yaml \
43
+ --format=summary
44
+ ```
45
+
46
+ ### 2. Compare client vs server bundles
47
+
48
+ ```bash
49
+ bin/shakapacker-config --doctor
50
+
51
+ bin/diff-bundler-config \
52
+ --left=shakapacker-config-exports/webpack-production-client.yaml \
53
+ --right=shakapacker-config-exports/webpack-production-server.yaml
54
+ ```
55
+
56
+ ### 3. Webpack to Rspack migration validation
57
+
58
+ ```bash
59
+ # Export webpack state
60
+ bin/shakapacker-config --doctor
61
+
62
+ # Switch bundler
63
+ bundle exec rake shakapacker:switch_bundler rspack --install-deps
64
+
65
+ # Export rspack state
66
+ bin/shakapacker-config --doctor
67
+
68
+ # Compare two snapshots (rename or copy files as needed)
69
+ bin/diff-bundler-config \
70
+ --left=webpack-production-client.yaml \
71
+ --right=rspack-production-client.yaml \
72
+ --ignore-paths="plugins.*"
73
+ ```
74
+
75
+ ### 4. Capture machine-readable report for CI or PR artifacts
76
+
77
+ ```bash
78
+ bin/diff-bundler-config \
79
+ --left=baseline.yaml \
80
+ --right=current.yaml \
81
+ --format=json \
82
+ --output=config-diff.json
83
+ ```
84
+
85
+ ## Output Formats
86
+
87
+ ```bash
88
+ # Detailed (default)
89
+ bin/diff-bundler-config --left=a.yaml --right=b.yaml --format=detailed
90
+
91
+ # Summary
92
+ bin/diff-bundler-config --left=a.yaml --right=b.yaml --format=summary
93
+
94
+ # JSON
95
+ bin/diff-bundler-config --left=a.yaml --right=b.yaml --format=json
96
+
97
+ # YAML
98
+ bin/diff-bundler-config --left=a.yaml --right=b.yaml --format=yaml
99
+ ```
100
+
101
+ ## Useful Options
102
+
103
+ ```bash
104
+ # Include unchanged values
105
+ --include-unchanged
106
+
107
+ # Limit recursion depth
108
+ --max-depth=5
109
+
110
+ # Ignore keys globally
111
+ --ignore-keys=timestamp,version
112
+
113
+ # Ignore paths (supports wildcards)
114
+ --ignore-paths="plugins.*,output.path"
115
+
116
+ # Disable automatic path normalization
117
+ --no-normalize-paths
118
+ ```
119
+
120
+ ## Supported Input Files
121
+
122
+ - JSON (`.json`)
123
+ - YAML (`.yaml`, `.yml`)
124
+ - JavaScript (`.js`)
125
+ - TypeScript (`.ts`, requires `ts-node`)
126
+
127
+ ## Exit Codes
128
+
129
+ - `0`: no differences found
130
+ - `1`: differences found
131
+ - `2`: wrapper/runtime error (module load error, invalid return code)
132
+
133
+ For CI usage, treat `1` as "configs differ" and `2` as "tool/runtime failure".
134
+
135
+ ## Programmatic Usage
136
+
137
+ You can use the package directly in scripts:
138
+
139
+ ```js
140
+ const { DiffEngine, DiffFormatter } = require("pack-config-diff")
141
+
142
+ const engine = new DiffEngine({
143
+ ignorePaths: ["plugins.*"]
144
+ })
145
+
146
+ const result = engine.compare(leftConfig, rightConfig, {
147
+ leftFile: "webpack.dev.js",
148
+ rightFile: "webpack.prod.js"
149
+ })
150
+
151
+ const formatter = new DiffFormatter()
152
+ console.log(formatter.formatDetailed(result))
153
+ ```
154
+
155
+ ## See Also
156
+
157
+ - [Troubleshooting Guide](./troubleshooting.md)
158
+ - [Rspack Migration Guide](./rspack_migration_guide.md)
159
+ - [pack-config-diff repository](https://github.com/shakacode/pack-config-diff)
@@ -823,9 +823,11 @@ bin/rake shakapacker:switch_bundler rspack -- --install-deps
823
823
  # Export rspack configs to compare
824
824
  bin/shakapacker-config --doctor
825
825
 
826
- # Compare the files in shakapacker-config-exports/
827
- diff shakapacker-config-exports/webpack-production-client.yaml \
828
- shakapacker-config-exports/rspack-production-client.yaml
826
+ # Compare with semantic config diffing
827
+ bin/diff-bundler-config \
828
+ --left=shakapacker-config-exports/webpack-production-client.yaml \
829
+ --right=shakapacker-config-exports/rspack-production-client.yaml \
830
+ --format=summary
829
831
  ```
830
832
 
831
833
  The config export utility creates annotated YAML files that make it easy to:
@@ -836,6 +838,7 @@ The config export utility creates annotated YAML files that make it easy to:
836
838
  - Debug configuration issues
837
839
 
838
840
  See the [Troubleshooting Guide](./troubleshooting.md#exporting-webpack--rspack-configuration) for more details.
841
+ For semantic diff workflows, see the [Configuration Diff Guide](./config-diff.md).
839
842
 
840
843
  ## Resources
841
844
 
@@ -56,7 +56,10 @@ If you're experiencing FOUC where content briefly appears unstyled before CSS lo
56
56
 
57
57
  # Compare development vs production configs
58
58
  bin/shakapacker-config --save --save-dir=./configs
59
- diff configs/webpack-development-client.yaml configs/webpack-production-client.yaml
59
+ bin/diff-bundler-config \
60
+ --left=configs/webpack-development-client.yaml \
61
+ --right=configs/webpack-production-client.yaml \
62
+ --format=summary
60
63
 
61
64
  # View config in terminal (no files created)
62
65
  bin/shakapacker-config
@@ -72,8 +75,10 @@ If you're experiencing FOUC where content briefly appears unstyled before CSS lo
72
75
  - Examples: `webpack-development-client.yaml`, `rspack-production-server.yaml`
73
76
  - YAML format includes inline documentation explaining each config key
74
77
  - Separate files for client and server bundles (cleaner than combined)
78
+ - Pair with `bin/diff-bundler-config` for semantic comparisons
75
79
 
76
80
  See `bin/shakapacker-config --help` for all available options.
81
+ For semantic comparisons, see the [Configuration Diff Guide](./config-diff.md).
77
82
 
78
83
  6. **Validate your webpack/rspack builds**: Use `bin/shakapacker-config --validate` to test that all your build configurations compile successfully. This is especially useful for:
79
84
  - **CI/CD pipelines**: Catch configuration errors before deployment
data/knip.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import type { KnipConfig } from "knip"
2
2
 
3
3
  const config: KnipConfig = {
4
- project: ["package/**/*.{ts,js}", "test/**/*.{ts,js}", "scripts/**/*.js"],
4
+ project: [
5
+ "package/**/*.{ts,js}",
6
+ "test/**/*.{ts,js}",
7
+ "scripts/**/*.js",
8
+ "bin/diff-bundler-config",
9
+ "lib/install/bin/diff-bundler-config"
10
+ ],
5
11
  ignore: [
6
12
  "package/**/*.d.ts",
7
13
  "package/**/*.js",
@@ -28,6 +34,8 @@ const config: KnipConfig = {
28
34
  "@rspack/cli",
29
35
  "webpack-cli",
30
36
  "husky",
37
+ // Used by bin/diff-bundler-config wrappers (outside knip's core package scan)
38
+ "pack-config-diff",
31
39
  // Optional dependencies used in webpack/rspack configs
32
40
  "mini-css-extract-plugin",
33
41
  "webpack-assets-manifest",
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { createRequire } = require("module")
4
+
5
+ const PACK_CONFIG_DIFF_PACKAGE = "pack-config-diff"
6
+
7
+ function formatError(error) {
8
+ return error instanceof Error ? error.message : String(error)
9
+ }
10
+
11
+ function exitWithCode(exitCode) {
12
+ if (!Number.isInteger(exitCode)) {
13
+ console.error(
14
+ `[Shakapacker] ${PACK_CONFIG_DIFF_PACKAGE} returned a non-integer exit code: ${String(exitCode)}`
15
+ )
16
+ process.exit(2)
17
+ }
18
+
19
+ // Forward only pack-config-diff's documented exit codes (0 = no diffs, 1 = diffs found).
20
+ // Any other code is a tool failure — normalize to 2.
21
+ process.exit(exitCode <= 1 ? exitCode : 2)
22
+ }
23
+
24
+ let run
25
+
26
+ try {
27
+ // Resolve pack-config-diff via shakapacker's dependency tree so strict package
28
+ // managers (pnpm, Yarn PnP) can find the transitive dependency.
29
+ const shakapackerRequire = createRequire(
30
+ require.resolve("shakapacker/package.json")
31
+ )
32
+ const loadedModule = shakapackerRequire("pack-config-diff")
33
+ run = loadedModule.run
34
+ } catch (error) {
35
+ console.error(
36
+ `[Shakapacker] Failed to load ${PACK_CONFIG_DIFF_PACKAGE}: ${formatError(error)}`
37
+ )
38
+ process.exit(2)
39
+ }
40
+
41
+ if (typeof run !== "function") {
42
+ console.error(
43
+ `[Shakapacker] ${PACK_CONFIG_DIFF_PACKAGE} did not export a run() function`
44
+ )
45
+ process.exit(2)
46
+ }
47
+
48
+ try {
49
+ const runResult = run(process.argv.slice(2))
50
+
51
+ if (runResult && typeof runResult.then === "function") {
52
+ runResult
53
+ .then((exitCode) => exitWithCode(exitCode))
54
+ .catch((error) => {
55
+ console.error(formatError(error))
56
+ process.exit(2)
57
+ })
58
+ } else {
59
+ exitWithCode(runResult)
60
+ }
61
+ } catch (error) {
62
+ console.error(formatError(error))
63
+ process.exit(2)
64
+ }
@@ -12,6 +12,17 @@ module Shakapacker
12
12
  CATEGORY_RECOMMENDED = :recommended
13
13
  CATEGORY_INFO = :info
14
14
 
15
+ REQUIRED_BINSTUBS = {
16
+ "bin/shakapacker" => "Main Shakapacker binstub",
17
+ "bin/shakapacker-dev-server" => "Development server binstub",
18
+ "bin/shakapacker-config" => "Config export binstub"
19
+ }.freeze
20
+
21
+ OPTIONAL_BINSTUBS = %w[
22
+ bin/shakapacker-watch
23
+ bin/diff-bundler-config
24
+ ].freeze
25
+
15
26
  def initialize(config = nil, root_path = nil, options = {})
16
27
  @config = config || Shakapacker.config
17
28
  @root_path = root_path || (defined?(Rails) ? Rails.root : Pathname.new(Dir.pwd))
@@ -388,13 +399,7 @@ module Shakapacker
388
399
  def check_binstub
389
400
  missing_binstubs = []
390
401
 
391
- expected_binstubs = {
392
- "bin/shakapacker" => "Main Shakapacker binstub",
393
- "bin/shakapacker-dev-server" => "Development server binstub",
394
- "bin/shakapacker-config" => "Config export binstub"
395
- }
396
-
397
- expected_binstubs.each do |path, description|
402
+ REQUIRED_BINSTUBS.each do |path, description|
398
403
  unless root_path.join(path).exist?
399
404
  missing_binstubs << "#{path} (#{description})"
400
405
  end
@@ -1010,22 +1015,22 @@ module Shakapacker
1010
1015
  end
1011
1016
 
1012
1017
  def print_binstub_status
1013
- binstubs = [
1014
- "bin/shakapacker",
1015
- "bin/shakapacker-dev-server",
1016
- "bin/shakapacker-config",
1017
- "bin/shakapacker-watch"
1018
- ]
1019
-
1020
- existing_binstubs = binstubs.select { |b| doctor.root_path.join(b).exist? }
1021
-
1022
- if existing_binstubs.length == binstubs.length
1023
- puts "✓ All Shakapacker binstubs found (#{existing_binstubs.join(', ')})"
1024
- elsif existing_binstubs.any?
1025
- existing_binstubs.each do |binstub|
1018
+ required_paths = REQUIRED_BINSTUBS.keys
1019
+
1020
+ existing_required = required_paths.select { |b| doctor.root_path.join(b).exist? }
1021
+ existing_optional = OPTIONAL_BINSTUBS.select { |b| doctor.root_path.join(b).exist? }
1022
+
1023
+ if existing_required.length == required_paths.length
1024
+ puts "✓ All required Shakapacker binstubs found (#{existing_required.join(', ')})"
1025
+ elsif existing_required.any?
1026
+ existing_required.each do |binstub|
1026
1027
  puts "✓ #{binstub} found"
1027
1028
  end
1028
1029
  end
1030
+
1031
+ existing_optional.each do |binstub|
1032
+ puts "✓ #{binstub} found (optional)"
1033
+ end
1029
1034
  end
1030
1035
 
1031
1036
  def print_info_messages
@@ -1,4 +1,4 @@
1
1
  module Shakapacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "10.0.0.rc.0".freeze
3
+ VERSION = "10.0.0.rc.1".freeze
4
4
  end
@@ -11,7 +11,8 @@ namespace :shakapacker do
11
11
  • Required and optional npm dependencies
12
12
  • JavaScript transpiler (Babel, SWC, esbuild) configuration
13
13
  • CSS, CSS Modules, and stylesheet preprocessor setup
14
- Binstubs presence (shakapacker, shakapacker-dev-server, shakapacker-config)
14
+ Required binstubs (shakapacker, shakapacker-dev-server, shakapacker-config)
15
+ • Optional binstubs (shakapacker-watch, diff-bundler-config)
15
16
  • Version consistency between gem and npm package
16
17
  • Legacy Webpacker file detection
17
18
 
@@ -75,7 +75,7 @@ const config: Config = {
75
75
  source_path: "app/javascript",
76
76
  source_entry_path: "packs",
77
77
  public_root_path: "public",
78
- public_output_path: "packs",
78
+ public_output_path: "packs"
79
79
  // ... other config
80
80
  }
81
81
 
@@ -83,8 +83,8 @@ const webpackConfig: WebpackConfigWithDevServer = {
83
83
  mode: "development",
84
84
  devServer: {
85
85
  hot: true,
86
- port: 3035,
87
- },
86
+ port: 3035
87
+ }
88
88
  // ... other webpack config
89
89
  }
90
90
  ```
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shakapacker",
3
- "version": "10.0.0-rc.0",
3
+ "version": "10.0.0-rc.1",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "homepage": "https://github.com/shakacode/shakapacker",
6
6
  "bugs": {
@@ -44,6 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "js-yaml": "^4.1.0",
47
+ "pack-config-diff": "^0.1.0",
47
48
  "path-complete-extname": "^1.0.0",
48
49
  "webpack-merge": "^5.8.0",
49
50
  "yargs": "^17.7.2"
data/yarn.lock CHANGED
@@ -5173,6 +5173,13 @@ p-try@^2.0.0:
5173
5173
  resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
5174
5174
  integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
5175
5175
 
5176
+ pack-config-diff@^0.1.0:
5177
+ version "0.1.0"
5178
+ resolved "https://registry.npmjs.org/pack-config-diff/-/pack-config-diff-0.1.0.tgz#c15025e196ff85009806890cca0841e96aaa6a1b"
5179
+ integrity sha512-gx60G4pnT4GFQ7WECdf7SCq9vdsvBhodLXXzwisy37/t0zkAZ3hMgLCdOGivudF1l0gcLZhIWVYreS89be15QA==
5180
+ dependencies:
5181
+ js-yaml "^4.1.0"
5182
+
5176
5183
  parent-module@^1.0.0:
5177
5184
  version "1.0.1"
5178
5185
  resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
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: 10.0.0.rc.0
4
+ version: 10.0.0.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -189,6 +189,8 @@ files:
189
189
  - __mocks__/nonexistent/package.json
190
190
  - __mocks__/sass-loader/package.json
191
191
  - bin/conductor-exec
192
+ - bin/diff-bundler-config
193
+ - bin/setup
192
194
  - bin/shakapacker-config
193
195
  - conductor-setup.sh
194
196
  - conductor.json
@@ -197,6 +199,7 @@ files:
197
199
  - docs/api-reference.md
198
200
  - docs/cdn_setup.md
199
201
  - docs/common-upgrades.md
202
+ - docs/config-diff.md
200
203
  - docs/configuration.md
201
204
  - docs/css-modules-export-mode.md
202
205
  - docs/customizing_babel_config.md
@@ -240,6 +243,7 @@ files:
240
243
  - jest.config.js
241
244
  - knip.ts
242
245
  - lib/install/application.js
246
+ - lib/install/bin/diff-bundler-config
243
247
  - lib/install/bin/shakapacker
244
248
  - lib/install/bin/shakapacker-config
245
249
  - lib/install/bin/shakapacker-dev-server
@@ -437,7 +441,7 @@ homepage: https://github.com/shakacode/shakapacker
437
441
  licenses:
438
442
  - MIT
439
443
  metadata:
440
- source_code_uri: https://github.com/shakacode/shakapacker/tree/v10.0.0-rc.0
444
+ source_code_uri: https://github.com/shakacode/shakapacker/tree/v10.0.0-rc.1
441
445
  rdoc_options: []
442
446
  require_paths:
443
447
  - lib