You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.1 KiB
73 lines
2.1 KiB
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.appStoreId = void 0;
|
|
exports.getXcodeVersion = getXcodeVersion;
|
|
exports.minimumVersion = void 0;
|
|
exports.openAppStore = openAppStore;
|
|
function _child_process() {
|
|
const data = require("child_process");
|
|
_child_process = function () {
|
|
return data;
|
|
};
|
|
return data;
|
|
}
|
|
function _internal() {
|
|
const data = require("./internal");
|
|
_internal = function () {
|
|
return data;
|
|
};
|
|
return data;
|
|
}
|
|
// Based on the RN docs (Aug 2020).
|
|
const minimumVersion = 9.4;
|
|
exports.minimumVersion = minimumVersion;
|
|
const appStoreId = '497799835';
|
|
exports.appStoreId = appStoreId;
|
|
let _xcodeVersion = false;
|
|
function getXcodeVersion() {
|
|
// This method anywhere from 1-2s so cache the results in case we run it multiple times
|
|
// (like in run:ios or reopening on iOS for development build).
|
|
if (_xcodeVersion !== false) {
|
|
return _xcodeVersion;
|
|
}
|
|
try {
|
|
var _execSync$toString$ma;
|
|
const last = (_execSync$toString$ma = (0, _child_process().execSync)('xcodebuild -version', {
|
|
stdio: 'pipe'
|
|
}).toString().match(/^Xcode (\d+\.\d+)/)) === null || _execSync$toString$ma === void 0 ? void 0 : _execSync$toString$ma[1];
|
|
// Convert to a semver string
|
|
if (last) {
|
|
_xcodeVersion = `${last}.0`;
|
|
return _xcodeVersion;
|
|
}
|
|
// not sure what's going on
|
|
_internal().Logger.global.error('Unable to check Xcode version. Command ran successfully but no version number was found.');
|
|
} catch {
|
|
// not installed
|
|
}
|
|
_xcodeVersion = null;
|
|
return _xcodeVersion;
|
|
}
|
|
|
|
/**
|
|
* Open a link to the App Store. Just link in mobile apps, **never** redirect without prompting first.
|
|
*
|
|
* @param appId
|
|
*/
|
|
function openAppStore(appId) {
|
|
const link = getAppStoreLink(appId);
|
|
(0, _child_process().execSync)(`open ${link}`, {
|
|
stdio: 'ignore'
|
|
});
|
|
}
|
|
function getAppStoreLink(appId) {
|
|
if (process.platform === 'darwin') {
|
|
// TODO: Is there ever a case where the macappstore isn't available on mac?
|
|
return `macappstore://itunes.apple.com/app/id${appId}`;
|
|
}
|
|
return `https://apps.apple.com/us/app/id${appId}`;
|
|
}
|
|
//# sourceMappingURL=Xcode.js.map
|