Commit 9791180
Doctor: accept TS/TSX server bundle suffixes (#3111)
### Summary
`react_on_rails:doctor` could report a false warning when
`server_bundle_js_file` was `server-bundle.js` but the Shakapacker
source entrypoint file was `server-bundle.ts`.
This PR makes doctor resolve common source suffixes (`.js`, `.jsx`,
`.ts`, `.tsx`, `.mjs`, `.cjs`) before warning, and updates doctor
messaging to clarify TS/TSX source entrypoints are valid.
### Pull Request checklist
- [x] Add/update test to cover these changes
- [x] ~Update documentation~
- [x] Update CHANGELOG file
### Other Information
Issue searches in `shakacode/react_on_rails` did not find an existing
issue for this exact suffix false-positive.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: changes only adjust `react_on_rails:doctor` path detection
to reduce false warnings; no runtime rendering or security-sensitive
logic is modified.
>
> **Overview**
> **Doctor now accepts non-`.js` server bundle source entrypoints.**
When `react_on_rails:doctor` determines the server bundle path, it now
tries common source extensions (`.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`,
`.cjs`) before warning that the configured bundle is missing, avoiding
false positives for apps using `server-bundle.ts`.
>
> Adds focused specs for the new extension-resolution behavior and
documents the fix in the `CHANGELOG`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
7570857. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* `react_on_rails:doctor` now correctly resolves server bundle files
with alternate extensions (.js, .jsx, .ts, .tsx, .mjs, .cjs), preventing
false warnings for missing bundles when using TypeScript configurations.
* **Tests**
* Added comprehensive test coverage for server bundle path resolution
across multiple configuration scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 5f8fd98 commit 9791180
3 files changed
Lines changed: 61 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
1535 | 1536 | | |
1536 | 1537 | | |
1537 | 1538 | | |
1538 | | - | |
| 1539 | + | |
| 1540 | + | |
1539 | 1541 | | |
1540 | 1542 | | |
1541 | 1543 | | |
1542 | | - | |
| 1544 | + | |
1543 | 1545 | | |
1544 | 1546 | | |
1545 | 1547 | | |
| |||
1562 | 1564 | | |
1563 | 1565 | | |
1564 | 1566 | | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
1565 | 1588 | | |
1566 | 1589 | | |
1567 | 1590 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
297 | 301 | | |
298 | 302 | | |
299 | 303 | | |
300 | 304 | | |
301 | 305 | | |
302 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
303 | 315 | | |
304 | 316 | | |
305 | 317 | | |
| |||
315 | 327 | | |
316 | 328 | | |
317 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
318 | 334 | | |
319 | 335 | | |
320 | 336 | | |
| |||
336 | 352 | | |
337 | 353 | | |
338 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
339 | 359 | | |
340 | 360 | | |
341 | 361 | | |
| |||
348 | 368 | | |
349 | 369 | | |
350 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
351 | 375 | | |
352 | 376 | | |
353 | 377 | | |
354 | 378 | | |
355 | 379 | | |
356 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
357 | 389 | | |
358 | 390 | | |
359 | 391 | | |
| |||
0 commit comments