Commit d39a95c
authored
Polish RSC generator install follow-ups
## Summary
- Add install-time info that every `--rsc` install uses
`react-on-rails-rsc@19.0.5-rc.6` until stable `19.0.5` is published and
tagged latest.
- Make manual dependency recovery commands package-manager-aware instead
of always showing npm.
- Simplify active-bundler RSC plugin import normalization and clarify
the multiline CommonJS destructuring regex comment.
- Add mixed active/inactive RSC plugin verification for real JS imports
and invocations.
## Design Calls
- All `--rsc` installs keep the prerelease `react-on-rails-rsc` pin for
now, including Webpack projects. The generator no longer retries an
unversioned `latest` fallback because npm latest may not include Rspack
support yet.
- Inactive plugin symbols are reported when they appear as real CommonJS
or ESM imports, or real `new InactivePlugin(...)` invocations, alongside
the active plugin.
- Inactive plugin names inside comments or string literals are
intentionally ignored during stale-symbol verification.
- `normalize_rsc_plugin_import_for_active_bundler` now derives inactive
plugin class and import path from the module-level helper methods
instead of caller-supplied parameters.
## Tests
- `git diff --check`
- `bundle exec rspec
spec/react_on_rails/generators/install_generator_spec.rb:2000
spec/react_on_rails/generators/rsc_generator_spec.rb:2559`
- `bundle exec rspec
spec/react_on_rails/generators/js_dependency_manager_spec.rb
spec/react_on_rails/generators/generator_helper_spec.rb`
- `bundle exec rspec
spec/react_on_rails/generators/install_generator_spec.rb:2013
spec/react_on_rails/generators/install_generator_spec.rb:2025`
- `bundle exec rspec
spec/react_on_rails/generators/rsc_generator_spec.rb:2581
spec/react_on_rails/generators/rsc_generator_spec.rb:2604`
- `bundle exec rspec
spec/react_on_rails/generators/rsc_generator_spec.rb:1114`
- `bundle exec rubocop lib/generators/react_on_rails/generator_helper.rb
lib/generators/react_on_rails/js_dependency_manager.rb
lib/generators/react_on_rails/rsc_setup.rb
lib/generators/react_on_rails/rsc_setup/client_references.rb
spec/react_on_rails/generators/generator_helper_spec.rb
spec/react_on_rails/generators/install_generator_spec.rb
spec/react_on_rails/generators/js_dependency_manager_spec.rb
spec/react_on_rails/generators/rsc_generator_spec.rb`
- Pre-commit and pre-push hooks reran trailing newline and RuboCop
checks for the changed Ruby files.
Closes #3640
Closes #3646
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Changes are limited to install-time generators and warning text; the
main behavioral shift is refusing an unversioned RSC fallback, which is
intentional and covered by updated specs.
>
> **Overview**
> **Generator install UX** now surfaces **package-manager-aware** manual
recovery commands (npm, yarn, pnpm, bun) for add/remove/install failures
instead of always showing `npm install`. Fallback installs **drop
`--save-exact` / `--exact`** when specs use semver ranges (`~`, `^`) so
manual and CLI recovery match real constraints.
>
> **RSC JS dependencies:** every `--rsc` run **logs why**
`react-on-rails-rsc` is pinned to the prerelease (`19.0.5-rc.6`). On
install failure the generator **keeps the pin** and **stops retrying
unversioned `latest`** (avoids replacing a good pin with an incompatible
package). Pin-failure copy is unified via
`rsc_dependency_failure_message` and applies to Webpack and Rspack.
>
> **RSC webpack migration/verification:** inactive bundler plugin
detection uses **real JS** (CommonJS/ESM imports and `new
InactivePlugin(...)`) and **ignores comments/strings**. Config checks
can report **stale inactive plugins** when the active plugin is already
present. Import normalization no longer takes inactive class/path from
callers; multiline CommonJS `require` destructuring is documented as
supported.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f17926a. 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**
* Generator messages now use package-manager-aware install/remove
commands and exact-pinned install guidance for recoveries; fallback
warnings reference "direct package manager commands" rather than only
npm.
* RSC setup emits clearer, consolidated warnings for React-version
compatibility and stale/inactive RSC bundler plugins in
webpack/client/server configs.
* **Tests**
* Specs updated to validate package-manager-aware messaging,
pinned-install recovery commands, and stale-plugin detection.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 211257c commit d39a95c
8 files changed
Lines changed: 354 additions & 112 deletions
File tree
- react_on_rails
- lib/generators/react_on_rails
- rsc_setup
- spec/react_on_rails/generators
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
Lines changed: 131 additions & 68 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
| 277 | + | |
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
| 284 | + | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
| 296 | + | |
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
| 316 | + | |
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
| 343 | + | |
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
| 356 | + | |
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
| 363 | + | |
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
| 384 | + | |
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
| 391 | + | |
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| 411 | + | |
| 412 | + | |
411 | 413 | | |
412 | 414 | | |
| 415 | + | |
413 | 416 | | |
414 | 417 | | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
430 | 423 | | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
| 424 | + | |
442 | 425 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
450 | 433 | | |
451 | 434 | | |
452 | 435 | | |
| |||
459 | 442 | | |
460 | 443 | | |
461 | 444 | | |
462 | | - | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
463 | 459 | | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
468 | 481 | | |
469 | 482 | | |
470 | 483 | | |
| |||
482 | 495 | | |
483 | 496 | | |
484 | 497 | | |
485 | | - | |
| 498 | + | |
486 | 499 | | |
487 | 500 | | |
488 | 501 | | |
| |||
498 | 511 | | |
499 | 512 | | |
500 | 513 | | |
501 | | - | |
| 514 | + | |
502 | 515 | | |
503 | 516 | | |
504 | 517 | | |
505 | 518 | | |
506 | 519 | | |
507 | 520 | | |
508 | | - | |
| 521 | + | |
509 | 522 | | |
510 | 523 | | |
511 | 524 | | |
| |||
566 | 579 | | |
567 | 580 | | |
568 | 581 | | |
569 | | - | |
570 | | - | |
571 | | - | |
| 582 | + | |
572 | 583 | | |
573 | 584 | | |
574 | 585 | | |
| |||
624 | 635 | | |
625 | 636 | | |
626 | 637 | | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
| 638 | + | |
| 639 | + | |
635 | 640 | | |
636 | 641 | | |
637 | 642 | | |
638 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
639 | 681 | | |
640 | 682 | | |
641 | 683 | | |
| |||
645 | 687 | | |
646 | 688 | | |
647 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
648 | 711 | | |
649 | 712 | | |
650 | 713 | | |
| |||
0 commit comments