Skip to content

quick fix: use dry principle #4694

Merged
alexander-akait merged 1 commit intowebpack:mainfrom
stefanbinoj:refactor/dry-version-helper
Mar 10, 2026
Merged

quick fix: use dry principle #4694
alexander-akait merged 1 commit intowebpack:mainfrom
stefanbinoj:refactor/dry-version-helper

Conversation

@stefanbinoj
Copy link
Copy Markdown
Contributor

Summary
Both npx webpack version and npx webpack --version had same code for logging version content. This PR extracts the same code logic to helper funciton and enables DRY principle

What kind of change does this PR introduce?

refactor: helps in DRY priciple

Did you add tests for your changes?

NO

Does this PR introduce a breaking change?

NO

Use of AI

NO

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 10, 2026

⚠️ No Changeset found

Latest commit: 303bd6c

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

@stefanbinoj
Copy link
Copy Markdown
Contributor Author

Just a note we have both npx webpack --version and npx webpack version both command which returns same output. (While 2nd command can be extended by options like npx webpack version --output json)

npx webpack --version is registered as root commander option and is faster compared to latter which is lazy loaded
Is this intentional?

@alexander-akait
Copy link
Copy Markdown
Member

npx webpack --version is registered as root commander option and is faster compared to latter which is lazy loaded
Is this intentional?

Yes

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.64%. Comparing base (529352d) to head (303bd6c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4694      +/-   ##
==========================================
+ Coverage   74.61%   74.64%   +0.03%     
==========================================
  Files          14       14              
  Lines        1674     1676       +2     
  Branches      420      421       +1     
==========================================
+ Hits         1249     1251       +2     
  Misses        357      357              
  Partials       68       68              
Files with missing lines Coverage Δ
packages/webpack-cli/src/webpack-cli.ts 82.23% <100.00%> (+0.03%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 529352d...303bd6c. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alexander-akait alexander-akait merged commit 20bc478 into webpack:main Mar 10, 2026
19 checks passed
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.

2 participants