Add shim for removed `reflex component` CLI command
Merged
MA
1mo ago+117+117+012345678901234567890123456789-3-3-0123456789
Type of change
- Bug fix (non-breaking change which fixes an issue)
Description
Replaces the removed reflex component command with a hidden shim that gracefully guides users to the new workflow instead of showing a "No such command" error.
Changes:
-
reflex/reflex.py: Added a hiddencomponentcommand that:- Accepts any subcommand and flags (e.g.,
reflex component init,build,share,install) - Exits with code 1 and logs an error message pointing users to:
- The wrapping React documentation
- The component template
- Uses
ignore_unknown_options=Trueto prevent Click from raising "No such command" errors
- Accepts any subcommand and flags (e.g.,
-
tests/units/test_reflex.py: Updated and expanded tests:- Changed
test_component_command_is_not_registered()totest_component_command_is_hidden()— verifies the command exists but is hidden from--helpoutput - Added
test_component_command_points_to_template()— ensures all old subcommands redirect with the helpful message - Added
test_component_help_points_to_template()— verifies--helpinvocations show the pointer - Added
test_component_command_dispatches_from_cli()— integration test confirming the shim works when invoked via subprocess - Updated CLI startup test to include
component --helpin the denied modules list
- Changed
-
news/+component-cli-shim.bugfix.md: Added changelog fragment documenting the user-facing improvement.
Test Plan
All new and modified tests pass:
- Unit tests verify the command is hidden, accepts any arguments, and returns the helpful error message
- Integration test confirms the shim works when invoked via the CLI entry point
- Existing tests continue to pass