GT2/GT2-iOS/node_modules/xdl/build/tools/UpdateVersions.js

109 lines
4.3 KiB
JavaScript

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.updateAndroidApk = exports.updateIOSSimulatorBuild = exports.updateSdkVersionsAsync = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
let updateSdkVersionsAsync = exports.updateSdkVersionsAsync = (() => {
var _ref = _asyncToGenerator(function* (sdkVersion, reactNativeTag, facebookRNVersion, facebookReactVersion) {
let versions = yield (_Versions || _load_Versions()).versionsAsync();
versions.sdkVersions[sdkVersion] = _extends({}, versions.sdkVersions[sdkVersion], {
expoReactNativeTag: reactNativeTag,
facebookReactNativeVersion: facebookRNVersion,
facebookReactVersion
});
yield (_Versions || _load_Versions()).setVersionsAsync(versions);
});
return function updateSdkVersionsAsync(_x, _x2, _x3, _x4) {
return _ref.apply(this, arguments);
};
})();
let updateIOSSimulatorBuild = exports.updateIOSSimulatorBuild = (() => {
var _ref2 = _asyncToGenerator(function* (s3Client, pathToApp, appVersion) {
let tempAppPath = _path.default.join(process.cwd(), 'temp-app.tar.gz');
yield (0, (_spawnAsync || _load_spawnAsync()).default)('tar', ['-zcvf', tempAppPath, '-C', pathToApp, '.'], {
cwd: process.cwd(),
stdio: ['ignore', 'ignore', 'inherit'] // only stderr
});
let file = _fs.default.createReadStream(tempAppPath);
console.log('Uploading...');
yield s3Client.putObject({
Bucket: 'exp-ios-simulator-apps',
Key: `Exponent-${appVersion}.tar.gz`,
Body: file,
ACL: 'public-read'
}).promise();
yield (0, (_spawnAsync || _load_spawnAsync()).default)('rm', [tempAppPath]);
console.log('Adding to server config...');
let versions = yield (_Versions || _load_Versions()).versionsAsync();
versions['iosVersion'] = appVersion;
versions['iosUrl'] = `https://dpq5q02fu5f55.cloudfront.net/Exponent-${appVersion}.tar.gz`;
yield (_Versions || _load_Versions()).setVersionsAsync(versions);
});
return function updateIOSSimulatorBuild(_x5, _x6, _x7) {
return _ref2.apply(this, arguments);
};
})();
let updateAndroidApk = exports.updateAndroidApk = (() => {
var _ref3 = _asyncToGenerator(function* (s3Client, pathToApp, appVersion) {
let file = _fs.default.createReadStream(pathToApp);
console.log('Uploading...');
yield s3Client.putObject({
Bucket: 'exp-android-apks',
Key: `Exponent-${appVersion}.apk`,
Body: file,
ACL: 'public-read'
}).promise();
console.log('Adding to server config...');
let versions = yield (_Versions || _load_Versions()).versionsAsync();
versions['androidVersion'] = appVersion;
versions['androidUrl'] = `https://d1ahtucjixef4r.cloudfront.net/Exponent-${appVersion}.apk`;
yield (_Versions || _load_Versions()).setVersionsAsync(versions);
});
return function updateAndroidApk(_x8, _x9, _x10) {
return _ref3.apply(this, arguments);
};
})();
var _fs = _interopRequireDefault(require('fs'));
var _path = _interopRequireDefault(require('path'));
var _spawnAsync;
function _load_spawnAsync() {
return _spawnAsync = _interopRequireDefault(require('@expo/spawn-async'));
}
var _Versions;
function _load_Versions() {
return _Versions = _interopRequireWildcard(require('../Versions'));
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
//# sourceMappingURL=../__sourcemaps__/tools/UpdateVersions.js.map