fix(cli): report the real version instead of a hardcoded 0.1.0 - #17
Merged
Conversation
Found by installing the published package and running it: iobroker-sync@1.0.0 printed 0.1.0 for --version. The version was a string literal in cli.ts, and release-please bumps package.json — it has no way to reach a literal in the source, so every release since 0.1.0 would have lied. It is now read from package.json at runtime via createRequire. dist/cli.js sits one level below package.json both in the repository and in the installed package, so the relative path holds in both; verified by dropping the built file into the package installed from npm. The cli test now compares --version against package.json rather than a regex, so the two cannot drift again. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by installing the published package and running it:
The version was a literal in
cli.ts. release-please bumpspackage.jsonand cannot reach a string in the source, so every release since 0.1.0 would have reported the wrong number.Now read from
package.jsonat runtime. Verified by dropping the built file into the package installed from npm. The cli test compares againstpackage.jsonso they cannot drift again.