Check if CLI is installed via NPM
Closed this issue · 0 comments
Before we can publish CLI on NPM, we need to correctly communicate to the user info about the latest available version and instructions on upgrade.
To check latest version of the CLI on NPM:
npm view @enonic/cli version
To check if CLI was installed with NPM:
npm list -g @enonic/cli
If not installed, it will return
/Users/ase/.npm-global/lib
└── (empty)
If installed, it will return something like
/Users/ase/.npm-global/lib
└── @enonic/cli@2.3.4 -> ./../../dev/cli-enonic
The version here (2.3.4) should be parsed (note that it can potentially end with -Bx
or -RCx
) and verified with the latest version available on NPM (see the first command above). If it's lower, we should suggest upgrade:
Latest available version is 2.3.5. Run 'npm upgrade @enonic/cli' to update CLI
Only if CLI is NOT installed from NPM, should we proceed to the current version check we have now and suggest upgrade via Brew or Scoop.