Skip to content

feat(cli) : new design#4736

Open
ThierryRakotomanana wants to merge 7 commits intowebpack:mainfrom
ThierryRakotomanana:feat/new-design
Open

feat(cli) : new design#4736
ThierryRakotomanana wants to merge 7 commits intowebpack:mainfrom
ThierryRakotomanana:feat/new-design

Conversation

@ThierryRakotomanana
Copy link
Copy Markdown
Contributor

Summary

As discussed in my previous PR #4723 , this update overhauls the design of the webpack-cli output. The primary goal is to standardize the interface by replacing ad-hoc logging with a structured, data-driven approach to headers, footers, and command metadata.

BEFORE AFTER
help alias help alias
build build

What kind of change does this PR introduce?
it's a feature, introuce a new UI for the cli

  • A demo :
New-CLI-DEMOS.mp4

Did you add tests for your changes?

  • Full Coverage: Added comprehensive unit tests for all ui-renderer components.
  • Legacy Support: I implemented a stripRendererChrome utility in the test suite. This sanitizes the new visual elements (icons, borders, indents) from stdout and stderr. This allows our existing legacy tests to pass without any modifications, ensuring full backward compatibility for our testing pipeline.
  • Snapshot Updates: Updated the CLI integration snapshots to reflect the new standardized design.

Does this PR introduce a breaking change?

Technically, yes, because the output format has changed. However, since the UI is now fully decoupled from the core CLI logic, it is much more stable for future development. Changes to the "guts" of the CLI won't accidentally break the UI, and vice-versa.

If relevant, what needs to be documented once your changes are merged or what have you already documented?
I’ve added comments throughout the code to explain the new logic. I’m not sure if we need to update the official external documentation for these internal UI changes yet, but I am open to suggestions if you think it's necessary!

Use of AI
for commit description, some JSDoc comments

Introduce ui-renderer.ts to handle renderOptionHelp and renderFooter. This replaces ad-hoc logger.raw calls in the help syntax branch with structured OptionHelpData.

Key changes:
- Added #renderOptions() bridge method.
- Implemented automatic documentation URL generation based on option flags.
- Improved help output styling and consistency.

Manual testing verified via:
- npx webpack help --config
- npx webpack help -c
Enhance help output for short flags (e.g., -c, -d) by implementing a 'renderAliasHelp' banner.This displays a styled ⬡ <alias> → <canonical> header above the option details to clearly distinguish aliases from primary options.

- Provides immediate visual context when users request help for shorthand commands.
Introduce renderCommandHelp to ui-renderer.ts and migrate Commander Command data into the structured CommandHelpData format.

Key architectural changes:
- Replaced helpInformation() calls with renderCommandHelp for consistent styling.
- Added a preAction hook in makeCommand to intercept '--help' before action execution, preventing side effects (e.g., 'watch' starting during help).
- Centralized self-exit logic for all help paths (global, command, option).
- Removed legacy trailing footer blocks in favor of integrated renderer footers.
Standardize command lifecycle with renderCommandHeader and contextual footers/status glyphs (✔ / ✖ / ⚠).

Key enhancements:
- build/watch: Deferred header/footer logic ensures visual chrome wraps the actual stats output with timing summaries.
- serve: Integrated header/error handling into the DevServer validation lifecycle.
- version/info: Replaced raw output with styled alignment, colored tables, and arrow-mapped resolutions.
- configtest: Added semantic success, warning, and error reporting for validated files.
- runWebpack: Introduced headerFn callback for granular control over emission timing relative to compiler events.
…pshots

Comprehensive test suite addition for ui-renderer.ts

Changes:
- Added unit tests for all UI.
- Updated existing CLI integration snapshots.
- Added new snapshots for command-specific renders (version, info, and configtest etc..).
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 14, 2026

⚠️ No Changeset found

Latest commit: a13f275

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant