mike-lischke / antlr-format

A tool to format ANTLR grammars
MIT License
8 stars 2 forks source link

"antlr-format --version" always outputs "1.0.1" even though I am using version 1.2.4 #6

Closed kaby76 closed 6 months ago

kaby76 commented 7 months ago

npmjs.org has an antlr-format-cli: entry: https://www.npmjs.com/package/antlr-format-cli

This webpage displays the current version of 1.2.4. However, when I run the tool antlr-format --version from the command line, the tool outputs "1.0.1".

The package.json for the cache, c:\Users\Kenne\AppData\Roaming\npm\node_modules\antlr-format-cli\package.json, contains the correct version:

{
    "name": "antlr-format-cli",
    "version": "1.2.4",
    "description": "A cli wrapper for the antlr-format package",
    "author": "Mike Lischke",
...

I am positive that I am running the correct version of the tool:

$ node /c/Users/Kenne/AppData/Roaming/npm/node_modules/antlr-format-cli/dist/antlr-format.cjs --version
antlr-format 1.0.1
04/13-17:01:18 ~/issues/g4-4047/sql/tsql
$

Rather than hardwire the version in the source code, I suggest it read the package.json for the version of the tool. In addition, I can't tell what the version of the package antlr-format itself may be. I also suggest printing this out as well.

mike-lischke commented 6 months ago

I changed the way the cli tool determines its actual version, however for the antlr-format node package there's no such functionality like printing a version number. Third party package usually have no binary interface to print such information. You can, however, inspect its package.json file too.