UNPKG

eas-cli

Version:
42 lines (41 loc) 2.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.readChannelSafelyAsync = exports.syncUpdatesConfigurationAsync = void 0; const config_plugins_1 = require("@expo/config-plugins"); const platform_1 = require("../../platform"); const projectUtils_1 = require("../../project/projectUtils"); const expoUpdatesCli_1 = require("../../utils/expoUpdatesCli"); const plist_1 = require("../../utils/plist"); const utils_1 = require("../utils"); async function syncUpdatesConfigurationAsync({ vcsClient, projectDir, exp, workflow, env, }) { (0, utils_1.ensureValidVersions)(exp, platform_1.RequestedPlatform.Ios); if (await (0, projectUtils_1.isModernExpoUpdatesCLIWithRuntimeVersionCommandSupportedAsync)(projectDir)) { await (0, expoUpdatesCli_1.expoUpdatesCommandAsync)(projectDir, ['configuration:syncnative', '--platform', 'ios', '--workflow', workflow], { env }); return; } const expoPlist = await readExpoPlistAsync(projectDir); // TODO(wschurman): this dependency needs to be updated for fingerprint const updatedExpoPlist = await config_plugins_1.IOSConfig.Updates.setUpdatesConfigAsync(projectDir, exp, expoPlist); await writeExpoPlistAsync(vcsClient, projectDir, updatedExpoPlist); } exports.syncUpdatesConfigurationAsync = syncUpdatesConfigurationAsync; async function readExpoPlistAsync(projectDir) { const expoPlistPath = config_plugins_1.IOSConfig.Paths.getExpoPlistPath(projectDir); return ((await (0, plist_1.readPlistAsync)(expoPlistPath)) ?? {}); } async function writeExpoPlistAsync(vcsClient, projectDir, expoPlist) { const expoPlistPath = config_plugins_1.IOSConfig.Paths.getExpoPlistPath(projectDir); await (0, plist_1.writePlistAsync)(expoPlistPath, expoPlist); await vcsClient.trackFileAsync(expoPlistPath); } async function readChannelSafelyAsync(projectDir) { try { const expoPlist = await readExpoPlistAsync(projectDir); const updatesRequestHeaders = expoPlist['EXUpdatesRequestHeaders']; return updatesRequestHeaders?.['expo-channel-name'] ?? null; } catch { return null; } } exports.readChannelSafelyAsync = readChannelSafelyAsync;