Commit 75515af
[codex] Fix shakapacker config helper binstubs (#1132)
### Summary
Fixes #1123.
This updates `shakapacker:export_bundler_config` to dispatch existing
app binstubs by shebang, so upgraded apps with legacy JavaScript
binstubs still run through Node while Ruby binstubs continue through
Ruby.
It also keeps installed, dummy, and generated helper binstubs in sync so
`NODE_ENV` follows `RAILS_ENV`, Node is found without executing it
during lookup, and non-`Error` CLI rejections print useful messages.
### Pull Request checklist
- [x] Add/update test to cover these changes
- [x] ~Update documentation~
- [x] ~Update CHANGELOG file~
### Other Information
Validated with focused RSpec helper/rake specs, Jest config exporter
tests, TypeScript type-checking, ESLint, and `git diff --check`.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes how `shakapacker:export_bundler_config` selects and executes
binstubs and updates Node discovery / env defaults, which can affect
command execution across platforms (notably Windows). Covered by new
RSpec/Jest tests, but still impacts developer tooling entrypoints.
>
> **Overview**
> Fixes Shakapacker helper/binstub behavior to better support upgraded
apps and Windows/ESM environments.
>
> The `shakapacker:export_bundler_config` rake task now inspects the
`bin/shakapacker-config` shebang and dispatches *legacy JS binstubs via
`node`* while continuing to run *Ruby binstubs via the current
`RbConfig.ruby`*.
>
> The installed/generatable Ruby helper binstubs (`shakapacker-config`
and `diff-bundler-config`) are updated to (1) locate `node` via explicit
PATH/PATHEXT scanning without executing it, (2) default `NODE_ENV` from
`RAILS_ENV` (`test`/`development` -> `development`, otherwise
`production`), and (3) improve CLI error printing for non-`Error`
rejections. New specs ensure binstub sync, correct dispatching, env
mapping, and init-generated stub parity.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
c5a536a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 94392be commit 75515af
12 files changed
Lines changed: 449 additions & 34 deletions
File tree
- bin
- lib
- install/bin
- tasks/shakapacker
- package
- bin
- configExporter
- spec
- dummy/bin
- shakapacker
- test/package
- bin
- configExporter
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
| |||
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
15 | 41 | | |
16 | | - | |
17 | | - | |
| 42 | + | |
| 43 | + | |
18 | 44 | | |
19 | | - | |
| 45 | + | |
20 | 46 | | |
21 | 47 | | |
22 | 48 | | |
23 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
24 | 54 | | |
25 | | - | |
| 55 | + | |
26 | 56 | | |
27 | 57 | | |
28 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
| |||
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
15 | 41 | | |
16 | | - | |
17 | | - | |
| 42 | + | |
| 43 | + | |
18 | 44 | | |
19 | | - | |
| 45 | + | |
20 | 46 | | |
21 | 47 | | |
22 | 48 | | |
23 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
24 | 54 | | |
25 | | - | |
| 55 | + | |
26 | 56 | | |
27 | 57 | | |
28 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
2 | 19 | | |
3 | 20 | | |
4 | 21 | | |
| |||
54 | 71 | | |
55 | 72 | | |
56 | 73 | | |
57 | | - | |
| 74 | + | |
58 | 75 | | |
59 | 76 | | |
60 | 77 | | |
61 | | - | |
62 | | - | |
| 78 | + | |
| 79 | + | |
63 | 80 | | |
64 | | - | |
| 81 | + | |
65 | 82 | | |
66 | 83 | | |
67 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
527 | | - | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
528 | 533 | | |
529 | 534 | | |
530 | 535 | | |
| |||
534 | 539 | | |
535 | 540 | | |
536 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
537 | 563 | | |
538 | | - | |
539 | | - | |
| 564 | + | |
| 565 | + | |
540 | 566 | | |
541 | | - | |
| 567 | + | |
542 | 568 | | |
543 | 569 | | |
544 | 570 | | |
545 | 571 | | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
546 | 576 | | |
547 | | - | |
| 577 | + | |
548 | 578 | | |
549 | 579 | | |
550 | 580 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
| |||
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
15 | 41 | | |
16 | | - | |
17 | | - | |
| 42 | + | |
| 43 | + | |
18 | 44 | | |
19 | | - | |
| 45 | + | |
20 | 46 | | |
21 | 47 | | |
22 | 48 | | |
23 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
24 | 54 | | |
25 | | - | |
| 55 | + | |
26 | 56 | | |
27 | 57 | | |
28 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
51 | 74 | | |
0 commit comments