eas-cli
Version:
EAS command line tool
41 lines (40 loc) • 1.75 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.openAppStoreAsync = exports.getXcodeVersionAsync = exports.APP_STORE_ID = exports.MIN_XCODE_VERSION = void 0;
const tslib_1 = require("tslib");
const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
const chalk_1 = tslib_1.__importDefault(require("chalk"));
const semver_1 = tslib_1.__importDefault(require("semver"));
const log_1 = tslib_1.__importDefault(require("../../log"));
// Based on the RN docs (Aug 2020).
exports.MIN_XCODE_VERSION = '9.4.0';
exports.APP_STORE_ID = '497799835';
async function getXcodeVersionAsync() {
try {
const { stdout } = await (0, spawn_async_1.default)('xcodebuild', ['-version']);
const version = stdout.match(/Xcode (\d+\.\d+)/)?.[1];
const semverFormattedVersion = `${version}.0`;
if (!semver_1.default.valid(semverFormattedVersion)) {
log_1.default.warn(`Xcode version ${chalk_1.default.bold(version)} is in unknown format. Expected format is ${chalk_1.default.bold('12.0')}.`);
return undefined;
}
return semverFormattedVersion;
}
catch {
// not installed
return undefined;
}
}
exports.getXcodeVersionAsync = getXcodeVersionAsync;
async function openAppStoreAsync(appId) {
const link = getAppStoreLink(appId);
await (0, spawn_async_1.default)(`open`, [link]);
}
exports.openAppStoreAsync = openAppStoreAsync;
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}`;
}
;