Socket
Socket
Sign inDemoInstall

@react-native-community/cli-platform-apple

Package Overview
Dependencies
Maintainers
30
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-community/cli-platform-apple - npm Package Compare versions

Comparing version 13.2.0 to 13.3.0

build/commands/runCommand/getBuildSettings.d.ts

2

build/commands/buildCommand/buildProject.js

@@ -120,3 +120,3 @@ "use strict";

const terminal = 'terminal' in args && typeof args.terminal === 'string' ? args.terminal : '';
const port = 'port' in args && typeof args.port === 'string' ? args.port : '';
const port = 'port' in args && typeof args.port === 'number' ? String(args.port) : '';
return {

@@ -123,0 +123,0 @@ env: {

@@ -45,3 +45,3 @@ "use strict";

mode
} = await (0, _getConfiguration.getConfiguration)(xcodeProject, sourceDir, args);
} = await (0, _getConfiguration.getConfiguration)(xcodeProject, sourceDir, args, platformName);
return (0, _buildProject.buildProject)(xcodeProject, platformName, undefined, mode, scheme, args);

@@ -48,0 +48,0 @@ };

import { IOSProjectInfo } from '@react-native-community/cli-types';
import type { BuildFlags } from './buildOptions';
export declare function getConfiguration(xcodeProject: IOSProjectInfo, sourceDir: string, args: BuildFlags): Promise<{
import { ApplePlatform } from '../../types';
export declare function getConfiguration(xcodeProject: IOSProjectInfo, sourceDir: string, args: BuildFlags, platformName: ApplePlatform): Promise<{
scheme: string;

@@ -5,0 +6,0 @@ mode: string;

@@ -32,4 +32,6 @@ "use strict";

}
var _getPlatformInfo = require("../runCommand/getPlatformInfo");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function getConfiguration(xcodeProject, sourceDir, args) {
async function getConfiguration(xcodeProject, sourceDir, args, platformName) {
var _info$schemes;
const info = (0, _getInfo.getInfo)();

@@ -40,2 +42,13 @@ if (args.mode) {

let scheme = args.scheme || _path().default.basename(xcodeProject.name, _path().default.extname(xcodeProject.name));
if (!(info === null || info === void 0 ? void 0 : (_info$schemes = info.schemes) === null || _info$schemes === void 0 ? void 0 : _info$schemes.includes(scheme))) {
var _info$schemes2;
const {
readableName
} = (0, _getPlatformInfo.getPlatformInfo)(platformName);
const fallbackScheme = `${scheme}-${readableName}`;
if (info === null || info === void 0 ? void 0 : (_info$schemes2 = info.schemes) === null || _info$schemes2 === void 0 ? void 0 : _info$schemes2.includes(fallbackScheme)) {
_cliTools().logger.warn(`Scheme "${_chalk().default.bold(scheme)}" doesn't exist. Using fallback scheme "${_chalk().default.bold(fallbackScheme)}"`);
scheme = fallbackScheme;
}
}
let mode = args.mode || (0, _getBuildConfigurationFromXcScheme.getBuildConfigurationFromXcScheme)(scheme, 'Debug', sourceDir, info);

@@ -42,0 +55,0 @@ if (args.interactive) {

@@ -36,6 +36,8 @@ "use strict";

var _getSimulators = _interopRequireDefault(require("../../tools/getSimulators"));
var _listDevices = _interopRequireDefault(require("../../tools/listDevices"));
var _listDevices = _interopRequireWildcard(require("../../tools/listDevices"));
var _getPlatformInfo = require("../runCommand/getPlatformInfo");
var _supportedPlatforms = require("../../config/supportedPlatforms");
var _prompts = require("../../tools/prompts");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -82,3 +84,5 @@ /**

};
});
}).filter(({
sdk
}) => sdk && sdkNames.includes((0, _listDevices.stripPlatform)(sdk)));
if (bootedAndAvailableSimulators.length === 0) {

@@ -90,9 +94,16 @@ _cliTools().logger.error(`No booted and available ${platformReadableName} simulators found.`);

const udid = await (0, _prompts.promptForDeviceToTailLogs)(platformReadableName, bootedAndAvailableSimulators);
tailDeviceLogs(udid);
const simulator = bootedAndAvailableSimulators.find(({
udid: deviceUDID
}) => deviceUDID === udid);
if (!simulator) {
throw new (_cliTools().CLIError)(`Unable to find simulator with udid: ${udid} in booted simulators`);
}
tailDeviceLogs(simulator);
} else {
tailDeviceLogs(bootedAndAvailableSimulators[0].udid);
tailDeviceLogs(bootedAndAvailableSimulators[0]);
}
};
function tailDeviceLogs(udid) {
const logDir = _path().default.join(_os().default.homedir(), 'Library', 'Logs', 'CoreSimulator', udid, 'asl');
function tailDeviceLogs(device) {
const logDir = _path().default.join(_os().default.homedir(), 'Library', 'Logs', 'CoreSimulator', device.udid, 'asl');
_cliTools().logger.info(`Tailing logs for device ${device.name} (${device.udid})`);
const log = (0, _child_process().spawnSync)('syslog', ['-w', '-F', 'std', '-d', logDir], {

@@ -99,0 +110,0 @@ stdio: 'inherit'

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

var _getArchitecture = _interopRequireDefault(require("../../tools/getArchitecture"));
var _getSimulators = _interopRequireDefault(require("../../tools/getSimulators"));
var _listDevices = _interopRequireDefault(require("../../tools/listDevices"));

@@ -114,3 +113,3 @@ var _pods = _interopRequireWildcard(require("../../tools/pods"));

scheme
} = await (0, _getConfiguration.getConfiguration)(xcodeProject, sourceDir, args);
} = await (0, _getConfiguration.getConfiguration)(xcodeProject, sourceDir, args, platformName);
if (platformName === 'macos') {

@@ -152,6 +151,5 @@ (0, _buildProject.buildProject)(xcodeProject, platformName, undefined, mode, scheme, args);

}) => type === 'device');
const simulators = (0, _getSimulators.default)();
const bootedSimulators = Object.keys(simulators.devices).map(key => simulators.devices[key]).reduce((acc, val) => acc.concat(val), []).filter(({
state
}) => state === 'Booted');
const bootedSimulators = devices.filter(({
type
}) => type === 'simulator');
const booted = [...bootedDevices, ...bootedSimulators];

@@ -171,2 +169,3 @@ if (booted.length === 0) {

}
return;
}

@@ -173,0 +172,0 @@ if (args.device && args.udid) {

@@ -1,3 +0,3 @@

import { IOSProjectInfo } from '@react-native-community/cli-types';
export declare function getBuildPath(xcodeProject: IOSProjectInfo, mode: string, buildOutput: string, scheme: string, target: string | undefined, isCatalyst?: boolean): Promise<string>;
import { BuildSettings } from './getBuildSettings';
export declare function getBuildPath(buildSettings: BuildSettings, isCatalyst?: boolean): Promise<string>;
//# sourceMappingURL=getBuildPath.d.ts.map

@@ -7,9 +7,2 @@ "use strict";

exports.getBuildPath = getBuildPath;
function _child_process() {
const data = _interopRequireDefault(require("child_process"));
_child_process = function () {
return data;
};
return data;
}
function _cliTools() {

@@ -22,5 +15,5 @@ const data = require("@react-native-community/cli-tools");

}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;

@@ -31,10 +24,6 @@ };

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function getBuildPath(xcodeProject, mode, buildOutput, scheme, target, isCatalyst = false) {
const buildSettings = _child_process().default.execFileSync('xcodebuild', [xcodeProject.isWorkspace ? '-workspace' : '-project', xcodeProject.name, '-scheme', scheme, '-sdk', getPlatformName(buildOutput), '-configuration', mode, '-showBuildSettings', '-json'], {
encoding: 'utf8'
});
const {
targetBuildDir,
executableFolderPath
} = await getTargetPaths(buildSettings, scheme, target);
async function getBuildPath(buildSettings, isCatalyst = false) {
const targetBuildDir = buildSettings.TARGET_BUILD_DIR;
const executableFolderPath = buildSettings.EXECUTABLE_FOLDER_PATH;
const fullProductName = buildSettings.FULL_PRODUCT_NAME;
if (!targetBuildDir) {

@@ -46,39 +35,12 @@ throw new (_cliTools().CLIError)('Failed to get the target build directory.');

}
return `${targetBuildDir}${isCatalyst ? '-maccatalyst' : ''}/${executableFolderPath}`;
}
async function getTargetPaths(buildSettings, scheme, target) {
const settings = JSON.parse(buildSettings);
const targets = settings.map(({
target: settingsTarget
}) => settingsTarget);
let selectedTarget = targets[0];
if (target) {
if (!targets.includes(target)) {
_cliTools().logger.info(`Target ${_chalk().default.bold(target)} not found for scheme ${_chalk().default.bold(scheme)}, automatically selected target ${_chalk().default.bold(selectedTarget)}`);
} else {
selectedTarget = target;
}
if (!fullProductName) {
throw new (_cliTools().CLIError)('Failed to get product name.');
}
// Find app in all building settings - look for WRAPPER_EXTENSION: 'app',
const targetIndex = targets.indexOf(selectedTarget);
const wrapperExtension = settings[targetIndex].buildSettings.WRAPPER_EXTENSION;
if (wrapperExtension === 'app') {
return {
targetBuildDir: settings[targetIndex].buildSettings.TARGET_BUILD_DIR,
executableFolderPath: settings[targetIndex].buildSettings.EXECUTABLE_FOLDER_PATH
};
if (isCatalyst) {
return _path().default.join(targetBuildDir, '-maccatalyst', executableFolderPath);
} else {
return _path().default.join(targetBuildDir, executableFolderPath);
}
return {};
}
function getPlatformName(buildOutput) {
// Xcode can sometimes escape `=` with a backslash or put the value in quotes
const platformNameMatch = /export PLATFORM_NAME\\?="?(\w+)"?$/m.exec(buildOutput);
if (!platformNameMatch) {
throw new (_cliTools().CLIError)('Couldn\'t find "PLATFORM_NAME" variable in xcodebuild output. Please report this issue and run your project with Xcode instead.');
}
return platformNameMatch[1];
}
//# sourceMappingURL=getBuildPath.ts.map

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

var _getBuildPath = require("./getBuildPath");
var _getBuildSettings = require("./getBuildSettings");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -44,3 +45,7 @@ async function runOnDevice(selectedDevice, platform, mode, scheme, xcodeProject, args) {

const buildOutput = await (0, _buildProject.buildProject)(xcodeProject, platform, selectedDevice.udid, mode, scheme, args);
const appPath = await (0, _getBuildPath.getBuildPath)(xcodeProject, mode, buildOutput, scheme, args.target, true);
const buildSettings = await (0, _getBuildSettings.getBuildSettings)(xcodeProject, mode, buildOutput, scheme);
if (!buildSettings) {
throw new (_cliTools().CLIError)('Failed to get build settings for your project');
}
const appPath = await (0, _getBuildPath.getBuildPath)(buildSettings, true);
const appProcess = _child_process().default.spawn(`${appPath}/${scheme}`, [], {

@@ -55,3 +60,7 @@ detached: true,

buildOutput = await (0, _buildProject.buildProject)(xcodeProject, platform, selectedDevice.udid, mode, scheme, args);
appPath = await (0, _getBuildPath.getBuildPath)(xcodeProject, mode, buildOutput, scheme, args.target);
const buildSettings = await (0, _getBuildSettings.getBuildSettings)(xcodeProject, mode, buildOutput, scheme);
if (!buildSettings) {
throw new (_cliTools().CLIError)('Failed to get build settings for your project');
}
appPath = await (0, _getBuildPath.getBuildPath)(buildSettings);
} else {

@@ -58,0 +67,0 @@ appPath = args.binaryPath;

@@ -14,9 +14,2 @@ "use strict";

}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _cliTools() {

@@ -29,14 +22,12 @@ const data = require("@react-native-community/cli-tools");

}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
var _buildProject = require("../buildCommand/buildProject");
var _matchingDevice = require("./matchingDevice");
var _getBuildPath = require("./getBuildPath");
var _installApp = _interopRequireDefault(require("./installApp"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function runOnSimulator(xcodeProject, platform, mode, scheme, args, simulator) {
const {
binaryPath,
target
} = args;
/**

@@ -60,23 +51,15 @@ * Booting simulator through `xcrun simctl boot` will boot it in the `headless` mode

}
let buildOutput, appPath;
if (!args.binaryPath) {
let buildOutput;
if (!binaryPath) {
buildOutput = await (0, _buildProject.buildProject)(xcodeProject, platform, simulator.udid, mode, scheme, args);
appPath = await (0, _getBuildPath.getBuildPath)(xcodeProject, mode, buildOutput, scheme, args.target);
} else {
appPath = args.binaryPath;
}
_cliTools().logger.info(`Installing "${_chalk().default.bold(appPath)} on ${simulator.name}"`);
_child_process().default.spawnSync('xcrun', ['simctl', 'install', simulator.udid, appPath], {
stdio: 'inherit'
(0, _installApp.default)({
buildOutput,
xcodeProject,
mode,
scheme,
target,
udid: simulator.udid,
binaryPath
});
const bundleID = _child_process().default.execFileSync('/usr/libexec/PlistBuddy', ['-c', 'Print:CFBundleIdentifier', _path().default.join(appPath, 'Info.plist')], {
encoding: 'utf8'
}).trim();
_cliTools().logger.info(`Launching "${_chalk().default.bold(bundleID)}"`);
const result = _child_process().default.spawnSync('xcrun', ['simctl', 'launch', simulator.udid, bundleID]);
if (result.status === 0) {
_cliTools().logger.success('Successfully launched the app on the simulator');
} else {
_cliTools().logger.error('Failed to launch the app on simulator', result.stderr.toString());
}
}

@@ -83,0 +66,0 @@ function bootSimulator(selectedSimulator) {

import { Device } from '../types';
declare function listDevices(sdkNames: string[]): Promise<Device[]>;
export declare function stripPlatform(platform: string): string;
export default listDevices;
//# sourceMappingURL=listDevices.d.ts.map

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

exports.default = void 0;
exports.stripPlatform = stripPlatform;
function _execa() {

@@ -9,0 +10,0 @@ const data = _interopRequireDefault(require("execa"));

{
"name": "@react-native-community/cli-platform-apple",
"version": "13.2.0",
"version": "13.3.0",
"license": "MIT",

@@ -10,3 +10,3 @@ "main": "build/index.js",

"dependencies": {
"@react-native-community/cli-tools": "13.2.0",
"@react-native-community/cli-tools": "13.3.0",
"chalk": "^4.1.2",

@@ -19,3 +19,3 @@ "execa": "^5.0.0",

"devDependencies": {
"@react-native-community/cli-types": "13.2.0",
"@react-native-community/cli-types": "13.3.0",
"@types/glob": "^7.1.1",

@@ -36,3 +36,3 @@ "@types/lodash": "^4.14.149",

},
"gitHead": "acdcb2bbd7b1fa6a50e771e04b36604834330da4"
"gitHead": "148f4d7220fba7a55e1f0b7def417c6c96ea6d9c"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc