native-run
Advanced tools
Comparing version 0.2.9 to 0.3.0
@@ -0,1 +1,16 @@ | ||
# [0.3.0](https://github.com/ionic-team/native-run/compare/v0.2.9...v0.3.0) (2019-12-04) | ||
### Features | ||
* **android:** handle INSTALL_FAILED_OLDER_SDK adb error ([#92](https://github.com/ionic-team/native-run/issues/92)) ([6616f37](https://github.com/ionic-team/native-run/commit/6616f379a60797650709ba7a70f195558ddcdedd)) | ||
* **android:** support API 29 ([2282b3a](https://github.com/ionic-team/native-run/commit/2282b3acfa58da685b0dc1981cf602a781bd6a1a)) | ||
## [0.2.9](https://github.com/ionic-team/native-run/compare/v0.2.8...v0.2.9) (2019-10-15) | ||
### Bug Fixes | ||
* **ios:** added support for iOS 13 ([c27675f](https://github.com/ionic-team/native-run/commit/c27675f20ef40264837af5cf091e94bd1af2db91)) | ||
## [0.2.8](https://github.com/ionic-team/native-run/compare/v0.2.7...v0.2.8) (2019-07-12) | ||
@@ -2,0 +17,0 @@ |
@@ -12,3 +12,3 @@ "use strict"; | ||
const schema = api_1.API_LEVEL_SCHEMAS.find(s => s.apiLevel === api.apiLevel); | ||
return Object.assign({}, api, { missingPackages: schema ? schema.validate(packages) : [] }); | ||
return Object.assign(Object.assign({}, api), { missingPackages: schema ? schema.validate(packages) : [] }); | ||
}); | ||
@@ -15,0 +15,0 @@ const sdkinfo = { |
@@ -147,2 +147,5 @@ "use strict"; | ||
} | ||
else if (event === ADBEvent.NewerSdkRequiredOnDeviceFailure) { | ||
reject(new errors_1.ADBException(`Encountered adb error: ${ADBEvent[event]}.`, errors_1.ERR_MIN_SDK_VERSION)); | ||
} | ||
cb(); | ||
@@ -175,2 +178,3 @@ })); | ||
ADBEvent[ADBEvent["NewerVersionOnDeviceFailure"] = 1] = "NewerVersionOnDeviceFailure"; | ||
ADBEvent[ADBEvent["NewerSdkRequiredOnDeviceFailure"] = 2] = "NewerSdkRequiredOnDeviceFailure"; | ||
})(ADBEvent = exports.ADBEvent || (exports.ADBEvent = {})); | ||
@@ -186,2 +190,5 @@ function parseAdbInstallOutput(line) { | ||
} | ||
else if (line.includes('INSTALL_FAILED_OLDER_SDK')) { | ||
event = ADBEvent.NewerSdkRequiredOnDeviceFailure; | ||
} | ||
if (typeof event !== 'undefined') { | ||
@@ -188,0 +195,0 @@ debug('Parsed event from adb install output: %s', ADBEvent[event]); |
@@ -149,4 +149,4 @@ "use strict"; | ||
id: partialSchematic.id, | ||
ini: object_1.sort(Object.assign({}, partialSchematic.ini, { 'path': avdpath, 'path.rel': `avd/${partialSchematic.id}.avd` })), | ||
configini: object_1.sort(Object.assign({}, partialSchematic.configini, { 'skin.path': skinpath, 'image.sysdir.1': sysdir, 'tag.id': tagid })), | ||
ini: object_1.sort(Object.assign(Object.assign({}, partialSchematic.ini), { 'path': avdpath, 'path.rel': `avd/${partialSchematic.id}.avd` })), | ||
configini: object_1.sort(Object.assign(Object.assign({}, partialSchematic.configini), { 'skin.path': skinpath, 'image.sysdir.1': sysdir, 'tag.id': tagid })), | ||
}; | ||
@@ -153,0 +153,0 @@ await validateAVDSchematic(sdk, schematic); |
@@ -16,3 +16,3 @@ "use strict"; | ||
})); | ||
debug('Discovered installed API Levels: %O', apis.map(api => (Object.assign({}, api, { packages: api.packages.map(pkg => pkg.path) })))); | ||
debug('Discovered installed API Levels: %O', apis.map(api => (Object.assign(Object.assign({}, api), { packages: api.packages.map(pkg => pkg.path) })))); | ||
return apis; | ||
@@ -50,2 +50,21 @@ } | ||
exports.findPackageBySchemaPath = findPackageBySchemaPath; | ||
exports.API_LEVEL_29 = Object.freeze({ | ||
apiLevel: '29', | ||
validate: (packages) => { | ||
const schemas = [ | ||
{ name: 'Android Emulator', path: 'emulator', version: /.+/ }, | ||
{ name: 'Android SDK Platform 29', path: 'platforms;android-29', version: /.+/ }, | ||
]; | ||
const missingPackages = findUnsatisfiedPackages(packages, schemas); | ||
if (!findPackageBySchemaPath(packages, /^system-images;android-29;/)) { | ||
missingPackages.push({ | ||
name: 'Google Play Intel x86 Atom System Image', | ||
path: 'system-images;android-29;google_apis_playstore;x86', | ||
version: '/.+/', | ||
}); | ||
} | ||
return missingPackages; | ||
}, | ||
loadPartialAVDSchematic: async () => Promise.resolve().then(() => require('../../data/avds/Pixel_3_API_29.json')), | ||
}); | ||
exports.API_LEVEL_28 = Object.freeze({ | ||
@@ -146,2 +165,9 @@ apiLevel: '28', | ||
}); | ||
exports.API_LEVEL_SCHEMAS = [exports.API_LEVEL_28, exports.API_LEVEL_27, exports.API_LEVEL_26, exports.API_LEVEL_25, exports.API_LEVEL_24]; | ||
exports.API_LEVEL_SCHEMAS = [ | ||
exports.API_LEVEL_29, | ||
exports.API_LEVEL_28, | ||
exports.API_LEVEL_27, | ||
exports.API_LEVEL_26, | ||
exports.API_LEVEL_25, | ||
exports.API_LEVEL_24, | ||
]; |
@@ -161,4 +161,4 @@ "use strict"; | ||
function supplementProcessEnv(sdk) { | ||
return Object.assign({}, process.env, { ANDROID_SDK_ROOT: sdk.root, ANDROID_EMULATOR_HOME: sdk.emulatorHome, ANDROID_AVD_HOME: sdk.avdHome }); | ||
return Object.assign(Object.assign({}, process.env), { ANDROID_SDK_ROOT: sdk.root, ANDROID_EMULATOR_HOME: sdk.emulatorHome, ANDROID_AVD_HOME: sdk.avdHome }); | ||
} | ||
exports.supplementProcessEnv = supplementProcessEnv; |
@@ -26,2 +26,3 @@ "use strict"; | ||
exports.ERR_VERSION_DOWNGRADE = 'ERR_VERSION_DOWNGRADE'; | ||
exports.ERR_MIN_SDK_VERSION = 'ERR_MIN_SDK_VERSION'; | ||
exports.ERR_INVALID_SDK_PACKAGE = 'ERR_INVALID_SDK_PACKAGE'; | ||
@@ -28,0 +29,0 @@ exports.ERR_INVALID_SERIAL = 'ERR_INVALID_SERIAL'; |
@@ -47,3 +47,4 @@ "use strict"; | ||
const result = await debugServerClient.continue(); | ||
// W -> Process exit, AA -> exit status | ||
// TODO: I have no idea what this packet means yet (successful close?) | ||
// if not a close (ie, most likely due to halt from onBeforeExit), then kill the app | ||
if (result !== 'W00') { | ||
@@ -50,0 +51,0 @@ await debugServerClient.kill(); |
@@ -24,3 +24,3 @@ "use strict"; | ||
.filter(device => device.isAvailable) | ||
.map(device => (Object.assign({}, device, { runtime })))) | ||
.map(device => (Object.assign(Object.assign({}, device), { runtime })))) | ||
.reduce((prev, next) => prev.concat(next)) // flatten | ||
@@ -27,0 +27,0 @@ .sort((a, b) => a.name < b.name ? -1 : 1); |
@@ -35,3 +35,3 @@ "use strict"; | ||
const versionDirs = await utils_fs_1.readdir(`${xCodePath}/Platforms/iPhoneOS.platform/DeviceSupport/`); | ||
let versionPrefix = version.match(/\d+\.\d+/); | ||
const versionPrefix = version.match(/\d+\.\d+/); | ||
if (versionPrefix === null) { | ||
@@ -46,14 +46,4 @@ throw new errors_1.Exception(`Invalid iOS version: ${version}`); | ||
} | ||
// Match major version if possible | ||
versionPrefix = version.match(/\d+\./); | ||
if (versionPrefix === null) { | ||
throw new errors_1.Exception(`Invalid iOS version: ${version}`); | ||
} | ||
for (const dir of versionDirs) { | ||
if (dir.includes(versionPrefix[0])) { | ||
return `${xCodePath}/Platforms/iPhoneOS.platform/DeviceSupport/${dir}/DeveloperDiskImage.dmg`; | ||
} | ||
} | ||
throw new errors_1.Exception(`Unable to find Developer Disk Image path for SDK ${version}. Do you have the right version of Xcode?`); | ||
} | ||
exports.getDeveloperDiskImagePath = getDeveloperDiskImagePath; |
{ | ||
"name": "native-run", | ||
"version": "0.2.9", | ||
"version": "0.3.0", | ||
"description": "A CLI for running apps on iOS/Android devices and simulators/emulators", | ||
@@ -66,3 +66,3 @@ "bin": { | ||
"tslint-ionic-rules": "0.0.21", | ||
"typescript": "~3.6.2", | ||
"typescript": "~3.7.3", | ||
"typescript-tslint-plugin": "^0.5.2" | ||
@@ -69,0 +69,0 @@ }, |
@@ -7,6 +7,10 @@ [![Build Status](https://circleci.com/gh/ionic-team/native-run.svg?style=shield)](https://circleci.com/gh/ionic-team/native-run) | ||
Utility for running native binaries on iOS and Android devices and simulators/emulators. | ||
`native-run` is a cross-platform command-line utility for running native binaries on devices and simulators/emulators. It supports deploying both `.apk` and `.ipa` files to Android and iOS devices. | ||
This tool is used by the Ionic CLI, but it can be used standalone as part of a development or testing pipeline for launching apps. It doesn't matter whether the `.apk` or `.ipa` is created with Cordova or native IDEs, `native-run` will be able to deploy it. | ||
## Install | ||
`native-run` is written entirely in TypeScript/NodeJS and it has no native dependencies. To install, run: | ||
```console | ||
@@ -13,0 +17,0 @@ $ npm install -g native-run |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 7 instances in 1 package
2110788
75
3151
32
39