native-run
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -10,3 +10,3 @@ "use strict"; | ||
const process_1 = require("../../utils/process"); | ||
const path_1 = require("./path"); | ||
const xcode_1 = require("./xcode"); | ||
const debug = Debug('native-run:ios:utils:device'); | ||
@@ -67,3 +67,3 @@ const wait = util_1.promisify(setTimeout); | ||
const version = await (await clientManager.getLockdowndClient()).getValue('ProductVersion'); | ||
const developerDiskImagePath = await path_1.getDeveloperDiskImagePath(version); | ||
const developerDiskImagePath = await xcode_1.getDeveloperDiskImagePath(version); | ||
const developerDiskImageSig = fs_1.readFileSync(`${developerDiskImagePath}.signature`); | ||
@@ -70,0 +70,0 @@ await imageMounter.uploadImage(developerDiskImagePath, developerDiskImageSig); |
@@ -7,14 +7,23 @@ "use strict"; | ||
const process_1 = require("../../utils/process"); | ||
const path_1 = require("./path"); | ||
const xcode_1 = require("./xcode"); | ||
const debug = Debug('native-run:ios:utils:simulator'); | ||
async function getSimulators() { | ||
const simctl = child_process_1.spawnSync('xcrun', ['simctl', 'list', '--json'], { encoding: 'utf8' }); | ||
const output = JSON.parse(simctl.stdout); | ||
return output.runtimes | ||
.filter(runtime => runtime.name.indexOf('watch') === -1 && runtime.name.indexOf('tv') === -1) | ||
.map(runtime => output.devices[runtime.name] | ||
.filter(device => !device.availability.includes('unavailable')) | ||
.map(device => (Object.assign({}, device, { runtime })))) | ||
.reduce((prev, next) => prev.concat(next)) // flatten | ||
.sort((a, b) => a.name < b.name ? -1 : 1); | ||
const [xcodeVersion] = xcode_1.getXcodeVersionInfo(); | ||
if (Number(xcodeVersion) < 10) { | ||
throw new errors_1.Exception('native-run only supports Xcode 10 and later'); | ||
} | ||
try { | ||
const output = JSON.parse(simctl.stdout); | ||
return output.runtimes | ||
.filter(runtime => runtime.name.indexOf('watch') === -1 && runtime.name.indexOf('tv') === -1) | ||
.map(runtime => output.devices[runtime.identifier] | ||
.filter(device => !device.availability.includes('unavailable')) | ||
.map(device => (Object.assign({}, device, { runtime })))) | ||
.reduce((prev, next) => prev.concat(next)) // flatten | ||
.sort((a, b) => a.name < b.name ? -1 : 1); | ||
} | ||
catch (err) { | ||
throw new errors_1.Exception('Unable to retrieve simulator list'); | ||
} | ||
} | ||
@@ -34,3 +43,3 @@ exports.getSimulators = getSimulators; | ||
} | ||
const xCodePath = await path_1.getXCodePath(); | ||
const xCodePath = await xcode_1.getXCodePath(); | ||
debug(`Running simulator ${udid}`); | ||
@@ -37,0 +46,0 @@ const openResult = child_process_1.spawnSync('open', [`${xCodePath}/Applications/Simulator.app`, '--args', '-CurrentDeviceUDID', udid], { encoding: 'utf8' }); |
@@ -8,12 +8,17 @@ "use strict"; | ||
return new Promise(async (resolve, reject) => { | ||
const zipfile = await open(srcPath, { lazyEntries: true }); | ||
const openReadStream = util_1.promisify(zipfile.openReadStream.bind(zipfile)); | ||
zipfile.once('error', reject); | ||
// resolve when either one happens | ||
zipfile.once('close', resolve); // fd of zip closed | ||
zipfile.once('end', resolve); // last entry read | ||
zipfile.on('entry', entry => onEntry(entry, zipfile, openReadStream)); | ||
zipfile.readEntry(); | ||
try { | ||
const zipfile = await open(srcPath, { lazyEntries: true }); | ||
const openReadStream = util_1.promisify(zipfile.openReadStream.bind(zipfile)); | ||
zipfile.once('error', reject); | ||
// resolve when either one happens | ||
zipfile.once('close', resolve); // fd of zip closed | ||
zipfile.once('end', resolve); // last entry read | ||
zipfile.on('entry', entry => onEntry(entry, zipfile, openReadStream)); | ||
zipfile.readEntry(); | ||
} | ||
catch (error) { | ||
reject(error); | ||
} | ||
}); | ||
} | ||
exports.unzip = unzip; |
{ | ||
"name": "native-run", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "A CLI for running apps on iOS/Android devices and simulators/emulators", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -5,2 +5,8 @@ # native-run | ||
## Install | ||
```bash | ||
$ npm install -g native-run | ||
``` | ||
## Usage | ||
@@ -7,0 +13,0 @@ |
116158
2856
16
6