Socket
Socket
Sign inDemoInstall

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

Package Overview
Dependencies
Maintainers
30
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 12.0.0-alpha.18 to 12.0.0

build/tools/getArchitecture.d.ts

19

build/commands/buildIOS/getConfiguration.js

@@ -22,13 +22,20 @@ "use strict";

var _selectFromInteractiveMode = require("../../tools/selectFromInteractiveMode");
var _getProjectInfo = require("../../tools/getProjectInfo");
var _getInfo = require("../../tools/getInfo");
var _checkIfConfigurationExists = require("../../tools/checkIfConfigurationExists");
var _getBuildConfigurationFromXcScheme = require("../../tools/getBuildConfigurationFromXcScheme");
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function getConfiguration(xcodeProject, sourceDir, args) {
const projectInfo = (0, _getProjectInfo.getProjectInfo)();
const info = (0, _getInfo.getInfo)();
if (args.mode) {
(0, _checkIfConfigurationExists.checkIfConfigurationExists)(projectInfo, args.mode);
(0, _checkIfConfigurationExists.checkIfConfigurationExists)((info === null || info === void 0 ? void 0 : info.configurations) ?? [], args.mode);
}
let scheme = args.scheme || projectInfo.schemes[0];
let mode = args.mode || (0, _getBuildConfigurationFromXcScheme.getBuildConfigurationFromXcScheme)(scheme, 'Debug', sourceDir, projectInfo);
let scheme = args.scheme || _path().default.basename(xcodeProject.name, _path().default.extname(xcodeProject.name));
let mode = args.mode || (0, _getBuildConfigurationFromXcScheme.getBuildConfigurationFromXcScheme)(scheme, 'Debug', sourceDir, info);
if (args.interactive) {

@@ -38,3 +45,3 @@ const selection = await (0, _selectFromInteractiveMode.selectFromInteractiveMode)({

mode,
projectInfo
info
});

@@ -41,0 +48,0 @@ if (selection.scheme) {

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

var _pods = _interopRequireDefault(require("../../tools/pods"));
var _getArchitecture = _interopRequireDefault(require("../../tools/getArchitecture"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -23,2 +24,3 @@ /**

async function buildIOS(_, ctx, args) {
var _ctx$project$ios;
const {

@@ -28,7 +30,10 @@ xcodeProject,

} = (0, _getXcodeProjectAndDir.getXcodeProjectAndDir)(ctx.project.ios);
// check if pods need to be installed
await (0, _pods.default)(ctx.root, ctx.dependencies, {
forceInstall: args.forcePods
});
if (((_ctx$project$ios = ctx.project.ios) === null || _ctx$project$ios === void 0 ? void 0 : _ctx$project$ios.automaticPodsInstallation) || args.forcePods) {
var _ctx$project$ios2, _ctx$project$ios3;
const isAppRunningNewArchitecture = ((_ctx$project$ios2 = ctx.project.ios) === null || _ctx$project$ios2 === void 0 ? void 0 : _ctx$project$ios2.sourceDir) ? await (0, _getArchitecture.default)((_ctx$project$ios3 = ctx.project.ios) === null || _ctx$project$ios3 === void 0 ? void 0 : _ctx$project$ios3.sourceDir) : undefined;
await (0, _pods.default)(ctx.root, ctx.dependencies, {
forceInstall: args.forcePods,
newArchEnabled: isAppRunningNewArchitecture
});
}
process.chdir(sourceDir);

@@ -35,0 +40,0 @@ const {

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

var _getSimulators = _interopRequireDefault(require("../../tools/getSimulators"));
function _prompts() {
const data = _interopRequireDefault(require("prompts"));
_prompts = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -65,2 +58,6 @@ /**

}) => type === 'simulator' && isAvailable);
if (availableSimulators.length === 0) {
_cliTools().logger.error('No simulators detected. Install simulators via Xcode.');
return;
}
const bootedAndAvailableSimulators = bootedSimulators.map(booted => {

@@ -76,3 +73,3 @@ const available = availableSimulators.find(({

if (bootedAndAvailableSimulators.length === 0) {
_cliTools().logger.error('No active iOS device found');
_cliTools().logger.error('No booted and available iOS simulators found.');
return;

@@ -83,3 +80,3 @@ }

udid
} = await (0, _prompts().default)({
} = await (0, _cliTools().prompt)({
type: 'select',

@@ -86,0 +83,0 @@ name: 'udid',

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

var _pods = _interopRequireDefault(require("../../tools/pods"));
var _getArchitecture = _interopRequireDefault(require("../../tools/getArchitecture"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -62,2 +63,3 @@ /**

async function runIOS(_, ctx, args) {
var _ctx$project$ios;
_cliTools().link.setPlatform('ios');

@@ -70,20 +72,18 @@ let {

// check if pods need to be installed
await (0, _pods.default)(ctx.root, ctx.dependencies, {
forceInstall: args.forcePods
});
const packagerStatus = await (0, _cliTools().isPackagerRunning)(port);
if (typeof packagerStatus === 'object' && packagerStatus.status === 'running') {
if (packagerStatus.root === ctx.root) {
packager = false;
(0, _cliTools().logAlreadyRunningBundler)(port);
} else {
const result = await (0, _cliTools().handlePortUnavailable)(port, ctx.root, packager);
[port, packager] = [result.port, result.packager];
}
} else if (packagerStatus === 'unrecognized') {
const result = await (0, _cliTools().handlePortUnavailable)(port, ctx.root, packager);
[port, packager] = [result.port, result.packager];
if (((_ctx$project$ios = ctx.project.ios) === null || _ctx$project$ios === void 0 ? void 0 : _ctx$project$ios.automaticPodsInstallation) || args.forcePods) {
var _ctx$project$ios2, _ctx$project$ios3;
const isAppRunningNewArchitecture = ((_ctx$project$ios2 = ctx.project.ios) === null || _ctx$project$ios2 === void 0 ? void 0 : _ctx$project$ios2.sourceDir) ? await (0, _getArchitecture.default)((_ctx$project$ios3 = ctx.project.ios) === null || _ctx$project$ios3 === void 0 ? void 0 : _ctx$project$ios3.sourceDir) : undefined;
await (0, _pods.default)(ctx.root, ctx.dependencies, {
forceInstall: args.forcePods,
newArchEnabled: isAppRunningNewArchitecture
});
}
if (packager) {
await (0, _cliTools().startServerInNewWindow)(port, ctx.root, ctx.reactNativePath, args.terminal);
const {
port: newPort,
startPackager
} = await (0, _cliTools().findDevServerPort)(port, ctx.root);
if (startPackager) {
await (0, _cliTools().startServerInNewWindow)(newPort, ctx.root, ctx.reactNativePath, args.terminal);
}
}

@@ -108,3 +108,9 @@ if (ctx.reactNativeVersion !== 'unknown') {

} = await (0, _getConfiguration.getConfiguration)(xcodeProject, sourceDir, args);
const availableDevices = await (0, _listIOSDevices.default)();
const devices = await (0, _listIOSDevices.default)();
const availableDevices = devices.filter(({
isAvailable
}) => isAvailable === true);
if (availableDevices.length === 0) {
return _cliTools().logger.error('iOS devices or simulators not detected. Install simulators via Xcode or connect a physical iOS device');
}
if (args.listDevices || args.interactive) {

@@ -126,5 +132,4 @@ if (args.device || args.udid) {

const bootedDevices = availableDevices.filter(({
type,
isAvailable
}) => type === 'device' && isAvailable);
type
}) => type === 'device');
const simulators = (0, _getSimulators.default)();

@@ -131,0 +136,0 @@ const bootedSimulators = Object.keys(simulators.devices).map(key => simulators.devices[key]).reduce((acc, val) => acc.concat(val), []).filter(({

@@ -73,3 +73,4 @@ "use strict";

watchModeCommandParams: userConfig.watchModeCommandParams,
xcodeProject
xcodeProject,
automaticPodsInstallation: userConfig.automaticPodsInstallation
};

@@ -76,0 +77,0 @@ }

@@ -6,3 +6,4 @@ /**

export { projectConfig, dependencyConfig, findPodfilePaths } from './config';
export { default as getArchitecture } from './tools/getArchitecture';
export { default as installPods } from './tools/installPods';
//# sourceMappingURL=index.d.ts.map

@@ -24,2 +24,8 @@ "use strict";

});
Object.defineProperty(exports, "getArchitecture", {
enumerable: true,
get: function () {
return _getArchitecture.default;
}
});
Object.defineProperty(exports, "installPods", {

@@ -39,2 +45,3 @@ enumerable: true,

var _config = require("./config");
var _getArchitecture = _interopRequireDefault(require("./tools/getArchitecture"));
var _installPods = _interopRequireDefault(require("./tools/installPods"));

@@ -41,0 +48,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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

import { IosProjectInfo } from '../types';
export declare function checkIfConfigurationExists(project: IosProjectInfo, mode: string): void;
export declare function checkIfConfigurationExists(configurations: string[], mode: string): void;
//# sourceMappingURL=checkIfConfigurationExists.d.ts.map

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

}
function checkIfConfigurationExists(project, mode) {
if (!project) {
function checkIfConfigurationExists(configurations, mode) {
if (configurations.length === 0) {
_cliTools().logger.warn(`Unable to check whether "${mode}" exists in your project`);
return;
}
if (!project.configurations.includes(mode)) {
throw new (_cliTools().CLIError)(`Configuration "${mode}" does not exist in your project. Please use one of the existing configurations: ${project.configurations.join(', ')}`);
if (!configurations.includes(mode)) {
throw new (_cliTools().CLIError)(`Configuration "${mode}" does not exist in your project. Please use one of the existing configurations: ${configurations.join(', ')}`);
}

@@ -23,0 +23,0 @@ }

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

import { IosProjectInfo } from '../types';
export declare function getBuildConfigurationFromXcScheme(scheme: string, configuration: string, sourceDir: string, projectInfo: IosProjectInfo): string;
import { IosInfo } from '../types';
export declare function getBuildConfigurationFromXcScheme(scheme: string, configuration: string, sourceDir: string, projectInfo: IosInfo | undefined): string;
//# sourceMappingURL=getBuildConfigurationFromXcScheme.d.ts.map

@@ -59,3 +59,4 @@ "use strict";

} catch {
throw new (_cliTools().CLIError)(`Could not find scheme ${scheme}. Please make sure the schema you want to run exists. Available schemas are: ${projectInfo.schemes.map(name => _chalk().default.bold(name)).join(', ')}'`);
const availableSchemas = projectInfo && projectInfo.schemes && projectInfo.schemes.length > 0 ? `Available schemas are: ${projectInfo.schemes.map(name => _chalk().default.bold(name)).join(', ')}'` : '';
throw new (_cliTools().CLIError)(`Could not find scheme ${scheme}. Please make sure the schema you want to run exists. ${availableSchemas}`);
}

@@ -62,0 +63,0 @@ return configuration;

import type { Ora } from 'ora';
interface PodInstallOptions {
skipBundleInstall?: boolean;
newArchEnabled?: boolean;
iosFolderPath?: string;
}

@@ -5,0 +7,0 @@ declare function installCocoaPods(loader: Ora): Promise<Ora>;

@@ -38,6 +38,11 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function runPodInstall(loader, shouldHandleRepoUpdate = true) {
async function runPodInstall(loader, options) {
const shouldHandleRepoUpdate = (options === null || options === void 0 ? void 0 : options.shouldHandleRepoUpdate) || true;
try {
loader.start(`Installing CocoaPods dependencies ${_chalk().default.dim('(this may take a few minutes)')}`);
await (0, _execa().default)('bundle', ['exec', 'pod', 'install']);
loader.start(`Installing CocoaPods dependencies ${_chalk().default.bold((options === null || options === void 0 ? void 0 : options.newArchEnabled) ? 'with New Architecture' : '')} ${_chalk().default.dim('(this may take a few minutes)')}`);
await (0, _execa().default)('bundle', ['exec', 'pod', 'install'], {
env: {
RCT_NEW_ARCH_ENABLED: (options === null || options === void 0 ? void 0 : options.newArchEnabled) ? '1' : '0'
}
});
} catch (error) {

@@ -56,3 +61,6 @@ // "pod" command outputs errors to stdout (at least some of them)

await runPodUpdate(loader);
await runPodInstall(loader, false);
await runPodInstall(loader, {
shouldHandleRepoUpdate: false,
newArchEnabled: options === null || options === void 0 ? void 0 : options.newArchEnabled
});
} else {

@@ -103,6 +111,6 @@ loader.fail();

try {
if (!_fs().default.existsSync('ios')) {
if (!(options === null || options === void 0 ? void 0 : options.iosFolderPath) && !_fs().default.existsSync('ios')) {
return;
}
process.chdir('ios');
process.chdir((options === null || options === void 0 ? void 0 : options.iosFolderPath) ?? 'ios');
const hasPods = _fs().default.existsSync('Podfile');

@@ -114,2 +122,4 @@ if (!hasPods) {

await (0, _runBundleInstall.default)(loader);
} else if (!_fs().default.existsSync('../Gemfile')) {
throw new (_cliTools().CLIError)('Could not find the Gemfile. Currently the CLI requires to have this file in the root directory of the project to install CocoaPods. If your configuration is different, please install the CocoaPods manually.');
}

@@ -125,3 +135,5 @@ try {

}
await runPodInstall(loader);
await runPodInstall(loader, {
newArchEnabled: options === null || options === void 0 ? void 0 : options.newArchEnabled
});
} finally {

@@ -128,0 +140,0 @@ process.chdir('..');

import { DependencyConfig } from '@react-native-community/cli-types';
interface ResolvePodsOptions {
forceInstall?: boolean;
newArchEnabled?: boolean;
}

@@ -5,0 +6,0 @@ interface NativeDependencies {

@@ -69,2 +69,16 @@ "use strict";

}
async function install(packageJson, cachedDependenciesHash, currentDependenciesHash, iosFolderPath) {
const loader = (0, _cliTools().getLoader)('Installing CocoaPods...');
try {
await (0, _installPods.default)(loader, {
skipBundleInstall: !!cachedDependenciesHash,
iosFolderPath
});
_cliTools().cacheManager.set(packageJson.name, 'dependencies', currentDependenciesHash);
loader.succeed();
} catch {
loader.fail();
throw new (_cliTools().CLIError)(`Something when wrong while installing CocoaPods. Please run ${_chalk().default.bold('pod install')} manually`);
}
}
async function resolvePods(root, nativeDependencies, options) {

@@ -80,7 +94,13 @@ const packageJson = getPackageJson(root);

const cachedDependenciesHash = _cliTools().cacheManager.get(packageJson.name, 'dependencies');
if (!cachedDependenciesHash || !compareMd5Hashes(currentDependenciesHash, cachedDependenciesHash) || !arePodsInstalled || (options === null || options === void 0 ? void 0 : options.forceInstall)) {
if (options === null || options === void 0 ? void 0 : options.forceInstall) {
await install(packageJson, cachedDependenciesHash, currentDependenciesHash, iosFolderPath);
} else if (arePodsInstalled && cachedDependenciesHash === undefined) {
_cliTools().cacheManager.set(packageJson.name, 'dependencies', currentDependenciesHash);
} else if (!cachedDependenciesHash || !compareMd5Hashes(currentDependenciesHash, cachedDependenciesHash) || !arePodsInstalled) {
const loader = (0, _cliTools().getLoader)('Installing CocoaPods...');
try {
await (0, _installPods.default)(loader, {
skipBundleInstall: !!cachedDependenciesHash
skipBundleInstall: !!cachedDependenciesHash,
newArchEnabled: options === null || options === void 0 ? void 0 : options.newArchEnabled,
iosFolderPath
});

@@ -87,0 +107,0 @@ _cliTools().cacheManager.set(packageJson.name, 'dependencies', currentDependenciesHash);

@@ -1,5 +0,5 @@

import { Device, IosProjectInfo } from '../types';
export declare function promptForSchemeSelection(project: IosProjectInfo): Promise<string>;
export declare function promptForConfigurationSelection(project: IosProjectInfo): Promise<string>;
import { Device } from '../types';
export declare function promptForSchemeSelection(schemes: string[]): Promise<string>;
export declare function promptForConfigurationSelection(configurations: string[]): Promise<string>;
export declare function promptForDeviceSelection(availableDevices: Device[]): Promise<Device | undefined>;
//# sourceMappingURL=prompts.d.ts.map

@@ -16,5 +16,5 @@ "use strict";

}
function _prompts() {
const data = _interopRequireDefault(require("prompts"));
_prompts = function () {
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;

@@ -25,10 +25,10 @@ };

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function promptForSchemeSelection(project) {
async function promptForSchemeSelection(schemes) {
const {
scheme
} = await (0, _prompts().default)({
} = await (0, _cliTools().prompt)({
name: 'scheme',
type: 'select',
message: 'Select the scheme you want to use',
choices: project.schemes.map(value => ({
choices: schemes.map(value => ({
title: value,

@@ -40,10 +40,10 @@ value: value

}
async function promptForConfigurationSelection(project) {
async function promptForConfigurationSelection(configurations) {
const {
configuration
} = await (0, _prompts().default)({
} = await (0, _cliTools().prompt)({
name: 'configuration',
type: 'select',
message: 'Select the configuration you want to use',
choices: project.configurations.map(value => ({
choices: configurations.map(value => ({
title: value,

@@ -58,3 +58,3 @@ value: value

device
} = await (0, _prompts().default)({
} = await (0, _cliTools().prompt)({
type: 'select',

@@ -61,0 +61,0 @@ name: 'device',

@@ -1,8 +0,8 @@

import { IosProjectInfo } from '../types';
import { IosInfo } from '../types';
interface Args {
scheme?: string;
mode?: string;
projectInfo: IosProjectInfo;
info: IosInfo | undefined;
}
export declare function selectFromInteractiveMode({ scheme, mode, projectInfo, }: Args): Promise<{
export declare function selectFromInteractiveMode({ scheme, mode, info, }: Args): Promise<{
scheme?: string;

@@ -9,0 +9,0 @@ mode?: string;

@@ -26,13 +26,15 @@ "use strict";

mode,
projectInfo
info
}) {
let newScheme = scheme;
let newMode = mode;
if (projectInfo.schemes.length > 1) {
newScheme = await (0, _prompts.promptForSchemeSelection)(projectInfo);
const schemes = info === null || info === void 0 ? void 0 : info.schemes;
if (schemes && schemes.length > 1) {
newScheme = await (0, _prompts.promptForSchemeSelection)(schemes);
} else {
_cliTools().logger.info(`Automatically selected ${_chalk().default.bold(scheme)} scheme.`);
}
if (projectInfo.configurations.length > 1) {
newMode = await (0, _prompts.promptForConfigurationSelection)(projectInfo);
const configurations = info === null || info === void 0 ? void 0 : info.configurations;
if (configurations && configurations.length > 1) {
newMode = await (0, _prompts.promptForConfigurationSelection)(configurations);
} else {

@@ -39,0 +41,0 @@ _cliTools().logger.info(`Automatically selected ${_chalk().default.bold(mode)} configuration.`);

@@ -12,8 +12,8 @@ export interface Device {

}
export interface IosProjectInfo {
configurations: string[];
export interface IosInfo {
name: string;
schemes: string[];
targets: string[];
schemes?: string[];
configurations?: string[];
targets?: string[];
}
//# sourceMappingURL=types.d.ts.map
{
"name": "@react-native-community/cli-platform-ios",
"version": "12.0.0-alpha.18",
"version": "12.0.0",
"license": "MIT",

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

"dependencies": {
"@react-native-community/cli-tools": "12.0.0-alpha.18",
"@react-native-community/cli-tools": "12.0.0",
"chalk": "^4.1.2",

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

"devDependencies": {
"@react-native-community/cli-types": "12.0.0-alpha.18",
"@react-native-community/cli-types": "12.0.0",
"@types/glob": "^7.1.1",

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

},
"gitHead": "174948353be0bf67c5b8beb657608b22b21de5ca"
"gitHead": "3f206fd01f70706ce17e4a33c3528a60e684d41e"
}

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

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