UNPKG

@johnf/react-native-owl

Version:
48 lines (47 loc) 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.adbTerminate = exports.adbLaunch = exports.adbInstall = void 0; var _path = _interopRequireDefault(require("path")); var _execa = _interopRequireDefault(require("execa")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const adbInstall = async ({ debug, binaryPath, buildType = 'Release' }) => { const stdio = debug ? 'inherit' : 'ignore'; const DEFAULT_APK_DIR = `/android/app/build/outputs/apk/${buildType.toLowerCase()}/`; const cwd = binaryPath ? _path.default.dirname(binaryPath) : _path.default.join(process.cwd(), DEFAULT_APK_DIR); const appFilename = binaryPath ? _path.default.basename(binaryPath) : `app-${buildType.toLowerCase()}.apk`; const appPath = _path.default.join(cwd, appFilename); const command = `adb install -r ${appPath}`; await _execa.default.command(command, { stdio }); }; exports.adbInstall = adbInstall; const adbTerminate = async ({ debug, packageName }) => { const stdio = debug ? 'inherit' : 'ignore'; const command = `adb shell am force-stop ${packageName}`; await _execa.default.command(command, { stdio }); }; exports.adbTerminate = adbTerminate; const adbLaunch = async ({ debug, packageName }) => { const stdio = debug ? 'inherit' : 'ignore'; const command = `adb shell monkey -p "${packageName}" -c android.intent.category.LAUNCHER 1`; await _execa.default.command(command, { stdio }); }; exports.adbLaunch = adbLaunch; //# sourceMappingURL=adb.js.map