Checks whether the command exists and whether it matches the specified version.
npm install cmd-check
// or
// yan add cmd-checkUsage: cmd-check [options]
Options:
  -f, --file [file]          # configuration file path. default: command-check.json
  -v, --version              # output the version numberRun cmd-check in the root folder of a git repository or run as npm script, it will read configuration from ./command-check.json or command-check option of ./package.json file.
package.json example:
{
  "command-check": {
    "node": true,
    "yarn": ">=1.22.0"
  }
}
command-check.json example:
{
  "node": true,
  "yarn": {
    "version": ">=1.22.0",
    "versionCommand": "yarn -v"
  }
}import { commandCheck } from 'cmd-check';
// should match command name
const isExistSoffice = commandCheck('soffice');
// should match command name and version
const isExistYarn = commandCheck('yarn', '>1.22.0');
{
  "node": true,
  "yarn": {
    "version": ">=1.22.0",
    "versionCommand": "yarn -v"
  }
}- type: 
string | true - description: Use semver to match versions. If set to true, no specific version matching is required. If set to 
true, it means that no specific version needs to be matched 
- type: 
string - description: Customize the command for obtaining the version. If not provided, the default version obtaining method will be used.