Skip to content

Read CLI version from package.json - #4

Merged
Balanov merged 3 commits into
Balanov:mainfrom
vishruthasgowda:fix/version-from-package-json
Nov 14, 2026
Merged

Balanov merged 3 commits into
Balanov:mainfrom
vishruthasgowda:fix/version-from-package-json

Conversation

@vishruthasgowda

Copy link
Copy Markdown
Contributor

Fixes #1

until --version now reads the version from package.json instead of a hardcoded constant, so it reports 0.3.0 and stays in sync with future releases.

@Balanov Balanov left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for picking this up, and for making the change as small as it can be.

I checked the surrounding code before approving. ROOT is already resolved two lines above the point where the version is read, and it points at the repository root rather than at bin/, so path.join(ROOT, "package.json") resolves to the right file both from a checkout and from an installed package. Reading it with readFileSync at module load keeps the CLI synchronous, which matters here: until --version is called from the benchmark startup check and from the help text, and neither should have to await anything.

One note on the order of the declarations: VERSION is now derived, so it has to come after ROOT. Your patch does that. HELP interpolates VERSION, so the help banner follows the same value as --version.

The remaining item from the issue is the regression test: a test that asserts the reported version equals the version field of package.json, so the next release cannot drift again. That is not in this branch, so I am leaving the issue open for it rather than closing it here. Please feel free to send it as a follow-up - a failing drift test is a small, self-contained change, and it is exactly the kind of first contribution this repository wants.

Merging this now.

@Balanov
Balanov merged commit 62d98ea into Balanov:main Nov 14, 2026
20 of 22 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.

Make until --version report the version in package.json

2 participants