96 lines
3.2 KiB
JavaScript
96 lines
3.2 KiB
JavaScript
|
'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 startAndroidAndPrintInfo = function () {
|
||
|
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
|
||
|
var address, _ref2, success, error;
|
||
|
|
||
|
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;
|
||
|
|
||
|
_log2.default.withTimestamp('Starting Android...');
|
||
|
|
||
|
_context.next = 6;
|
||
|
return _xdl.Android.openProjectAsync(process.cwd());
|
||
|
|
||
|
case 6:
|
||
|
_ref2 = _context.sent;
|
||
|
success = _ref2.success;
|
||
|
error = _ref2.error;
|
||
|
|
||
|
|
||
|
_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');
|
||
|
});
|
||
|
|
||
|
if (!success) {
|
||
|
(0, _log2.default)(_chalk2.default.red(error.message));
|
||
|
}
|
||
|
|
||
|
case 11:
|
||
|
case 'end':
|
||
|
return _context.stop();
|
||
|
}
|
||
|
}
|
||
|
}, _callee, this);
|
||
|
}));
|
||
|
|
||
|
return function startAndroidAndPrintInfo() {
|
||
|
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;
|
||
|
|
||
|
_packager2.default.run(startAndroidAndPrintInfo);
|
||
|
//# sourceMappingURL=android.js.map
|