supportedVersion = (
  pluginVersion = "latest",
  versionInfos,
  scVersion
) => {
  const resolved =
    pluginVersion === "latest" ? resolveLatest(versionInfos) : pluginVersion;
  const safeScVersion = scVersion || getState().scVersion;
  if (doCheck(resolved, versionInfos, safeScVersion)) return resolved;
  else {
    const keys = Object.keys(versionInfos);
    keys.sort((a, b) => semver.rcompare(b, a));
    // iterate in reverse order to get the latest version
    for (let i = keys.length - 1; i >= 0; i--) {
      const version = keys[i];
      if (doCheck(version, versionInfos, safeScVersion)) return version;
    }
    return null;
  }
}
check if 'pluginVersion' is supported or find the latest supported version
@param pluginVersion - wanted version
@param versionInfos - version infos from the npm registry (resembles the package.json version).
                           Here you'll find the engines.saltcorn property.
@param scVersion - optional saltcorn version (if not set it will be taken from the state)
@returns