Socket
Socket
Sign inDemoInstall

native-run

Package Overview
Dependencies
29
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.19 to 0.0.20

assets/android/skins/LICENSE

2

dist/android/sdk-info.js

@@ -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 ? api_1.findUnsatisfiedPackages(packages, schema) : [] });
return Object.assign({}, api, { missingPackages: schema ? schema.validate(packages) : [] });
});

@@ -15,0 +15,0 @@ const sdkinfo = {

@@ -6,2 +6,3 @@ "use strict";

const pathlib = require("path");
const constants_1 = require("../../constants");
const errors_1 = require("../../errors");

@@ -100,3 +101,3 @@ const ini_1 = require("../../utils/ini");

}
const missingPackages = api_1.findUnsatisfiedPackages(packages, schema);
const missingPackages = schema.validate(packages);
if (missingPackages.length > 0) {

@@ -147,2 +148,3 @@ throw new errors_1.AVDException(`Unsatisfied packages within API ${api.apiLevel}: ${missingPackages.map(pkg => pkg.path).join(', ')}`, errors_1.ERR_SDK_UNSATISFIED_PACKAGES, 1);

const { configini } = schematic;
const skin = configini['skin.name'];
const skinpath = configini['skin.path'];

@@ -156,15 +158,37 @@ const sysdir = configini['image.sysdir.1'];

}
await validateSkinPath(skinpath);
await validateSkin(sdk, skin, skinpath);
await validateSystemImagePath(sdk, sysdir);
}
exports.validateAVDSchematic = validateAVDSchematic;
async function validateSkinPath(skinpath) {
const stat = await utils_fs_1.statSafe(pathlib.join(skinpath, 'layout'));
if (!stat || !stat.isFile()) {
throw new errors_1.AVDException(`${skinpath} is an invalid skin.`, errors_1.ERR_INVALID_SKIN);
async function validateSkin(sdk, skin, skinpath) {
const debug = Debug(`${modulePrefix}:${validateSkin.name}`);
const p = pathlib.join(skinpath, 'layout');
debug('Checking skin layout file: %s', p);
const stat = await utils_fs_1.statSafe(p);
if (stat && stat.isFile()) {
return;
}
await copySkin(sdk, skin, skinpath);
}
exports.validateSkinPath = validateSkinPath;
exports.validateSkin = validateSkin;
async function copySkin(sdk, skin, skinpath) {
const debug = Debug(`${modulePrefix}:${copySkin.name}`);
const skinsrc = pathlib.resolve(constants_1.ASSETS_PATH, 'android', 'skins', skin);
const stat = await utils_fs_1.statSafe(skinsrc);
if (stat && stat.isDirectory()) {
debug('Copying skin from %s to %s', skinsrc, skinpath);
try {
return await utils_fs_1.copy(skinsrc, skinpath);
}
catch (e) {
debug('Error while copying skin: %O', e);
}
}
throw new errors_1.AVDException(`${skinpath} is an invalid skin.`, errors_1.ERR_INVALID_SKIN);
}
exports.copySkin = copySkin;
async function validateSystemImagePath(sdk, sysdir) {
const debug = Debug(`${modulePrefix}:${validateSystemImagePath.name}`);
const p = pathlib.join(sdk.root, sysdir, 'package.xml');
debug('Checking package.xml file: %s', p);
const stat = await utils_fs_1.statSafe(p);

@@ -171,0 +195,0 @@ if (!stat || !stat.isFile()) {

@@ -20,4 +20,4 @@ "use strict";

exports.getAPILevels = getAPILevels;
function findUnsatisfiedPackages(packages, schema) {
return schema.packages.filter(pkg => !findPackageBySchema(packages, pkg));
function findUnsatisfiedPackages(packages, schemas) {
return packages.filter(pkg => !findPackageBySchema(packages, pkg));
}

@@ -52,6 +52,17 @@ exports.findUnsatisfiedPackages = findUnsatisfiedPackages;

apiLevel: '28',
packages: [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 28', path: 'platforms;android-28', version: /.+/ },
],
validate: (packages) => {
const schemas = [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 28', path: 'platforms;android-28', version: /.+/ },
];
const missingPackages = findUnsatisfiedPackages(packages, schemas);
if (!findPackageBySchemaPath(packages, /^system-images;android-28;/)) {
missingPackages.push({
name: 'Google Play Intel x86 Atom System Image',
path: 'system-images;android-28;google_apis_playstore;x86',
version: '/.+/',
});
}
return missingPackages;
},
loadPartialAVDSchematic: async () => Promise.resolve().then(() => require('../../data/avds/Pixel_2_API_28.json')),

@@ -61,6 +72,17 @@ });

apiLevel: '27',
packages: [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 27', path: 'platforms;android-27', version: /.+/ },
],
validate: (packages) => {
const schemas = [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 27', path: 'platforms;android-27', version: /.+/ },
];
const missingPackages = findUnsatisfiedPackages(packages, schemas);
if (!findPackageBySchemaPath(packages, /^system-images;android-27;/)) {
missingPackages.push({
name: 'Google Play Intel x86 Atom System Image',
path: 'system-images;android-27;google_apis_playstore;x86',
version: '/.+/',
});
}
return missingPackages;
},
loadPartialAVDSchematic: async () => Promise.resolve().then(() => require('../../data/avds/Pixel_2_API_27.json')),

@@ -70,6 +92,17 @@ });

apiLevel: '26',
packages: [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 26', path: 'platforms;android-26', version: /.+/ },
],
validate: (packages) => {
const schemas = [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 26', path: 'platforms;android-26', version: /.+/ },
];
const missingPackages = findUnsatisfiedPackages(packages, schemas);
if (!findPackageBySchemaPath(packages, /^system-images;android-26;/)) {
missingPackages.push({
name: 'Google Play Intel x86 Atom System Image',
path: 'system-images;android-26;google_apis_playstore;x86',
version: '/.+/',
});
}
return missingPackages;
},
loadPartialAVDSchematic: async () => Promise.resolve().then(() => require('../../data/avds/Pixel_2_API_26.json')),

@@ -79,6 +112,17 @@ });

apiLevel: '25',
packages: [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 25', path: 'platforms;android-25', version: /.+/ },
],
validate: (packages) => {
const schemas = [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 25', path: 'platforms;android-25', version: /.+/ },
];
const missingPackages = findUnsatisfiedPackages(packages, schemas);
if (!findPackageBySchemaPath(packages, /^system-images;android-25;/)) {
missingPackages.push({
name: 'Google Play Intel x86 Atom System Image',
path: 'system-images;android-25;google_apis_playstore;x86',
version: '/.+/',
});
}
return missingPackages;
},
loadPartialAVDSchematic: async () => Promise.resolve().then(() => require('../../data/avds/Pixel_API_25.json')),

@@ -88,8 +132,19 @@ });

apiLevel: '24',
packages: [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 24', path: 'platforms;android-24', version: /.+/ },
],
validate: (packages) => {
const schemas = [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{ name: 'Android SDK Platform 24', path: 'platforms;android-24', version: /.+/ },
];
const missingPackages = findUnsatisfiedPackages(packages, schemas);
if (!findPackageBySchemaPath(packages, /^system-images;android-24;/)) {
missingPackages.push({
name: 'Google Play Intel x86 Atom System Image',
path: 'system-images;android-24;google_apis_playstore;x86',
version: '/.+/',
});
}
return missingPackages;
},
loadPartialAVDSchematic: async () => Promise.resolve().then(() => require('../../data/avds/Nexus_5X_API_24.json')),
});
exports.API_LEVEL_SCHEMAS = [exports.API_LEVEL_28, exports.API_LEVEL_27, exports.API_LEVEL_26, exports.API_LEVEL_25, exports.API_LEVEL_24];
{
"name": "native-run",
"version": "0.0.19",
"version": "0.0.20",
"description": "A CLI for running apps on iOS/Android devices and simulators/emulators",

@@ -23,2 +23,3 @@ "bin": {

"files": [
"assets",
"bin",

@@ -25,0 +26,0 @@ "dist"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc