fabiospampinato/tiny-bin

Override detected version

Lioness100 opened this issue · 4 comments

The README says that this package will automatically detect a version from package.json- is there a way to overwrite this, maybe a .version('...') method?

There is no API for that. Does the automatic detection not work well enough?

A few reasons a method might be helpful from the top of my head:

  • Binary distribution: If a CLI is compiled into a binary, it might not have access to the package.json file and therefore, cannot automatically detect the version.
  • Testing: During testing, it may be necessary to set a specific version for the CLI to simulate different scenarios.
  • Independent versioning: If there are multiple CLIs in a project, it may be necessary to set versions independently of each other.
  • Automated versioning: In certain cases, it may be desirable to set the version automatically based on certain conditions, such as a build number or date.

It doesn't seem like it would be too hard to add, would it?

Seems reasonable. I added a .package function in v1.1.0. Thanks for the suggestion.

Thanks!!