Closed rishson closed 8 years ago
Are we assuming that every command will be distributed via npm
?
If so, then we can enhance the cli
to parse each command's package.json
for the version.
Otherwise, we should add version
to the command interface and each command should return its version that can be called by the cli
.
My initial thought, is we do the former for now and later we could always implement the latter, which we could use if no package.json
is found.
Thoughts?
It's a good question, perhaps have version
first look up a package.json
and then fallback to calling a version
API? Or perhaps the other way round, it it's implemented use the version
function otherwise try using package.json
otherwise show output unable to determine command version
If I was a command author, then I'd want to do the least amount of work as possible.
version
first allows the command author to override the default package.json
behaviour and is therefore more flexible, but allows them to do the least amount of work, e.g. if on npm
then it already has a published version. Therefore I think version
then package.json
then can't find version
is the least effort for the command author, and the most flexible.
basically I agree, I was pretty much typing as I was thinking so certainly the implementation of version would want to override the default behaviour of looking in the command's package.json
As noted in the first comment, we should never have the situation where a group has multiple commands with the same name if we only support npm
right?
This is a core CLI command, that will determine the version of all available commands and print them out.
After some offline debate, it was decided to only support versions for commands that have a package.json
(therefore use the version from the package.json)
This should output the versions of all registered groups, e.g.
Users can then copy and paste this info into issues raised on GH. This allows a user to provide version information as easily as possible, thus increasing the likelihood that they will include this information in GH issues.