GT2/GT2-iOS/node_modules/react-native-scripts/build/scripts/ios.js

112 lines
4.1 KiB
JavaScript
Raw Normal View History

2018-02-12 17:26:06 +00:00
'use strict';
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
// print a nicely formatted message with setup information
var startSimulatorAndPrintInfo = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var address, localAddress, _ref2, success, msg;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return _xdl.UrlUtils.constructManifestUrlAsync(process.cwd());
case 2:
address = _context.sent;
_context.next = 5;
return _xdl.UrlUtils.constructManifestUrlAsync(process.cwd(), {
hostType: 'localhost'
});
case 5:
localAddress = _context.sent;
_log2.default.withTimestamp('Starting simulator...');
_context.next = 9;
return _xdl.Simulator.openUrlInSimulatorSafeAsync(localAddress);
case 9:
_ref2 = _context.sent;
success = _ref2.success;
msg = _ref2.msg;
if (success) {
_qrcodeTerminal2.default.generate(address, function (qrCode) {
_log2.default.withTimestamp('' + _chalk2.default.green('Packager started!'));
(0, _log2.default)('\nTo view your app with live reloading, point the Expo app to this QR code.\nYou\'ll find the QR scanner on the Projects tab of the app.\n\n' + (0, _indentString2.default)(qrCode, 2) + '\n\nOr enter this address in the Expo app\'s search bar:\n\n ' + _chalk2.default.underline(_chalk2.default.cyan(address)) + '\n\nYour phone will need to be on the same local network as this computer.\nFor links to install the Expo app, please visit ' + _chalk2.default.underline(_chalk2.default.cyan('https://expo.io')) + '.\n\nLogs from serving your app will appear here. Press Ctrl+C at any time to stop.\n\nIf you restart the simulator or change the simulated hardware, you may need to restart this process.\n');
});
} else {
_log2.default.withTimestamp(_chalk2.default.red('Failed to start simulator:') + '\n\n' + msg + '\n\n' + _chalk2.default.red('Exiting...'));
process.exit(0);
}
case 13:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
return function startSimulatorAndPrintInfo() {
return _ref.apply(this, arguments);
};
}();
var _xdl = require('xdl');
var _chalk = require('chalk');
var _chalk2 = _interopRequireDefault(_chalk);
var _indentString = require('indent-string');
var _indentString2 = _interopRequireDefault(_indentString);
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _pathExists = require('path-exists');
var _pathExists2 = _interopRequireDefault(_pathExists);
var _qrcodeTerminal = require('qrcode-terminal');
var _qrcodeTerminal2 = _interopRequireDefault(_qrcodeTerminal);
var _log = require('../util/log');
var _log2 = _interopRequireDefault(_log);
var _packager = require('../util/packager');
var _packager2 = _interopRequireDefault(_packager);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_xdl.Config.validation.reactNativeVersionWarnings = false;
_xdl.Config.developerTool = 'crna';
_xdl.Config.offline = true;
var command = _pathExists2.default.sync(_path2.default.join(process.cwd(), 'yarn.lock')) ? 'yarnpkg' : 'npm';
if (!_xdl.Simulator.isPlatformSupported()) {
(0, _log2.default)(_chalk2.default.red('\nThis command only works on macOS computers with Xcode and the iOS simulator installed.'));
(0, _log2.default)(_chalk2.default.yellow('If you run `' + _chalk2.default.cyan(command + ' start') + '` then you can view your app on a physical device.\n'));
process.exit(1);
}
_packager2.default.run(startSimulatorAndPrintInfo);
//# sourceMappingURL=ios.js.map