UNPKG

1.4 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.doesSoftwareNeedToBeFixed = exports.isSoftwareNotInstalled = exports.PACKAGE_MANAGERS = void 0;
7
8function _semver() {
9 const data = _interopRequireDefault(require("semver"));
10
11 _semver = function () {
12 return data;
13 };
14
15 return data;
16}
17
18function _commandExists() {
19 const data = _interopRequireDefault(require("command-exists"));
20
21 _commandExists = function () {
22 return data;
23 };
24
25 return data;
26}
27
28function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
30let PACKAGE_MANAGERS;
31exports.PACKAGE_MANAGERS = PACKAGE_MANAGERS;
32
33(function (PACKAGE_MANAGERS) {
34 PACKAGE_MANAGERS["YARN"] = "YARN";
35 PACKAGE_MANAGERS["NPM"] = "NPM";
36})(PACKAGE_MANAGERS || (exports.PACKAGE_MANAGERS = PACKAGE_MANAGERS = {}));
37
38const isSoftwareNotInstalled = async command => {
39 try {
40 await (0, _commandExists().default)(command);
41 return false;
42 } catch (_ignored) {
43 return true;
44 }
45};
46
47exports.isSoftwareNotInstalled = isSoftwareNotInstalled;
48
49const doesSoftwareNeedToBeFixed = ({
50 version,
51 versionRange
52}) => {
53 const coercedVersion = _semver().default.coerce(version);
54
55 return version === 'Not Found' || coercedVersion === null || !_semver().default.satisfies(coercedVersion, versionRange);
56};
57
58exports.doesSoftwareNeedToBeFixed = doesSoftwareNeedToBeFixed;
\No newline at end of file