@expo/xdl
Version:
The Expo Development Library
91 lines (69 loc) • 2.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPublishExpConfigAsync = getPublishExpConfigAsync;
function _config() {
const data = require("@expo/config");
_config = function () {
return data;
};
return data;
}
function _Env() {
const data = require("../Env");
_Env = function () {
return data;
};
return data;
}
function _XDLError() {
const data = _interopRequireDefault(require("../XDLError"));
_XDLError = function () {
return data;
};
return data;
}
function ExponentTools() {
const data = _interopRequireWildcard(require("../detach/ExponentTools"));
ExponentTools = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function getPublishExpConfigAsync(projectRoot, options) {
if (options.releaseChannel != null && typeof options.releaseChannel !== 'string') {
throw new (_XDLError().default)('INVALID_OPTIONS', 'releaseChannel must be a string');
}
options.releaseChannel = options.releaseChannel || 'default'; // Verify that exp/app.json and package.json exist
const {
exp: privateExp
} = (0, _config().getConfig)(projectRoot);
const {
hooks
} = privateExp;
const {
exp,
pkg
} = (0, _config().getConfig)(projectRoot, {
isPublicConfig: true
});
const {
sdkVersion
} = exp; // Only allow projects to be published with UNVERSIONED if a correct token is set in env
if (sdkVersion === 'UNVERSIONED' && !(0, _Env().maySkipManifestValidation)()) {
throw new (_XDLError().default)('INVALID_OPTIONS', 'Cannot publish with sdkVersion UNVERSIONED.');
}
exp.locales = await ExponentTools().getResolvedLocalesAsync(projectRoot, exp);
return {
exp: { ...exp,
sdkVersion: sdkVersion
},
pkg,
hooks
};
}
//# sourceMappingURL=../__sourcemaps__/project/getPublishExpConfigAsync.js.map