UNPKG

eas-cli

Version:
30 lines (29 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.writePlistAsync = exports.readPlistAsync = void 0; const tslib_1 = require("tslib"); const plist_1 = tslib_1.__importDefault(require("@expo/plist")); const fs_extra_1 = tslib_1.__importDefault(require("fs-extra")); const path_1 = tslib_1.__importDefault(require("path")); async function readPlistAsync(plistPath) { if (await fs_extra_1.default.pathExists(plistPath)) { const expoPlistContent = await fs_extra_1.default.readFile(plistPath, 'utf8'); try { return plist_1.default.parse(expoPlistContent); } catch (err) { err.message = `Failed to parse ${plistPath}. ${err.message}`; throw err; } } else { return null; } } exports.readPlistAsync = readPlistAsync; async function writePlistAsync(plistPath, plistObject) { const contents = plist_1.default.build(plistObject); await fs_extra_1.default.mkdirp(path_1.default.dirname(plistPath)); await fs_extra_1.default.writeFile(plistPath, contents); } exports.writePlistAsync = writePlistAsync;