UNPKG

2.24 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.isMacOsSierra = undefined;
7
8var _bluebirdLst;
9
10function _load_bluebirdLst() {
11 return _bluebirdLst = require("bluebird-lst");
12}
13
14let isOsVersionGreaterThanOrEqualTo = (() => {
15 var _ref2 = (0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* (input) {
16 return (_semver || _load_semver()).gte((yield macOsVersion.value), clean(input));
17 });
18
19 return function isOsVersionGreaterThanOrEqualTo(_x) {
20 return _ref2.apply(this, arguments);
21 };
22})();
23
24let isMacOsSierra = exports.isMacOsSierra = (() => {
25 var _ref3 = (0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* () {
26 return process.platform === "darwin" && (yield isOsVersionGreaterThanOrEqualTo("10.12.0"));
27 });
28
29 return function isMacOsSierra() {
30 return _ref3.apply(this, arguments);
31 };
32})();
33//# sourceMappingURL=macosVersion.js.map
34
35
36var _fsExtraP;
37
38function _load_fsExtraP() {
39 return _fsExtraP = require("fs-extra-p");
40}
41
42var _lazyVal;
43
44function _load_lazyVal() {
45 return _lazyVal = require("lazy-val");
46}
47
48var _semver;
49
50function _load_semver() {
51 return _semver = _interopRequireWildcard(require("semver"));
52}
53
54var _util;
55
56function _load_util() {
57 return _util = require("./util");
58}
59
60function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
61
62const macOsVersion = new (_lazyVal || _load_lazyVal()).Lazy((0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* () {
63 const file = yield (0, (_fsExtraP || _load_fsExtraP()).readFile)("/System/Library/CoreServices/SystemVersion.plist", "utf8");
64 const matches = /<key>ProductVersion<\/key>[\s\S]*<string>([\d.]+)<\/string>/.exec(file);
65 if (!matches) {
66 throw new Error("Couldn't find the macOS version");
67 }
68 (0, (_util || _load_util()).debug)(`macOS version: ${matches[1]}`);
69 return clean(matches[1]);
70}));
71function clean(version) {
72 return version.split(".").length === 2 ? `${version}.0` : version;
73}
\No newline at end of file