1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.doesSoftwareNeedToBeFixed = exports.isSoftwareNotInstalled = exports.PACKAGE_MANAGERS = void 0;
|
7 |
|
8 | function _semver() {
|
9 | const data = _interopRequireDefault(require("semver"));
|
10 |
|
11 | _semver = function () {
|
12 | return data;
|
13 | };
|
14 |
|
15 | return data;
|
16 | }
|
17 |
|
18 | function _commandExists() {
|
19 | const data = _interopRequireDefault(require("command-exists"));
|
20 |
|
21 | _commandExists = function () {
|
22 | return data;
|
23 | };
|
24 |
|
25 | return data;
|
26 | }
|
27 |
|
28 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29 |
|
30 | let PACKAGE_MANAGERS;
|
31 | exports.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 |
|
38 | const isSoftwareNotInstalled = async command => {
|
39 | try {
|
40 | await (0, _commandExists().default)(command);
|
41 | return false;
|
42 | } catch (_ignored) {
|
43 | return true;
|
44 | }
|
45 | };
|
46 |
|
47 | exports.isSoftwareNotInstalled = isSoftwareNotInstalled;
|
48 |
|
49 | const 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 |
|
58 | exports.doesSoftwareNeedToBeFixed = doesSoftwareNeedToBeFixed; |
\ | No newline at end of file |