feat(smart-app): implement complete mobile app MVP

- App.tsx: full navigation (Auth stack + Main tabs with 5 screens)
- Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen
- HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors
- MapScreen: interactive map with layer toggles (6 layers)
- MarketplaceScreen: categories (6), products (5), search
- ChatScreen: AI chat with quick prompts (4), bot responses
- ProfileScreen: user info, stats, menu (9 items), logout
- AlertsScreen: alert list with severity, acknowledge
- SensorsScreen: sensor list with type filters (6 types), search
- ZonesScreen: zone cards with stats
- SettingsScreen: language picker (FR/EN/ES/DE), privacy, about
- Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n
- Hooks: useSensors, useAlerts, useNotifications, useLocation
- Components: Card, Button, LoadingSpinner, ErrorBoundary, Header
- Services: iotService, notificationService (with axios API client)
- Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN)
- Theme: colors.ts with full design system (Blue Ocean palette)
- Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1,23 @@
import { BuilderCommand } from '../../types';
export type BuildFlags = {
mode?: string;
target?: string;
verbose?: boolean;
scheme?: string;
xcconfig?: string;
buildFolder?: string;
interactive?: boolean;
destination?: string;
extraParams?: string[];
forcePods?: boolean;
};
export declare const getBuildOptions: ({ platformName }: BuilderCommand) => ({
name: string;
description: string;
parse?: undefined;
} | {
name: string;
description: string;
parse: (val: string) => string[];
})[];
//# sourceMappingURL=buildOptions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"buildOptions.d.ts","sourceRoot":"","sources":["../../../src/commands/buildCommand/buildOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAG3C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,eAAe,qBAAoB,cAAc;;;;;;;iBA+B3C,MAAM;IAgBxB,CAAC"}

View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBuildOptions = void 0;
var _getPlatformInfo = require("../runCommand/getPlatformInfo");
const getBuildOptions = ({
platformName
}) => {
const {
readableName
} = (0, _getPlatformInfo.getPlatformInfo)(platformName);
return [{
name: '--mode <string>',
description: 'Explicitly set the scheme configuration to use. This option is case sensitive.'
}, {
name: '--scheme <string>',
description: 'Explicitly set Xcode scheme to use'
}, {
name: '--destination <string>',
description: 'Explicitly extend destination e.g. "arch=x86_64"'
}, {
name: '--verbose',
description: 'Do not use xcbeautify or xcpretty even if installed'
}, {
name: '--xcconfig [string]',
description: 'Explicitly set xcconfig to use'
}, {
name: '--buildFolder <string>',
description: `Location for ${readableName} build artifacts. Corresponds to Xcode's "-derivedDataPath".`
}, {
name: '--extra-params <string>',
description: 'Custom params that will be passed to xcodebuild command.',
parse: val => val.split(' ')
}, {
name: '--target <string>',
description: 'Explicitly set Xcode target to use.'
}, {
name: '--interactive',
description: 'Explicitly select which scheme and configuration to use before running a build'
}, {
name: '--force-pods',
description: 'Force CocoaPods installation'
}];
};
exports.getBuildOptions = getBuildOptions;
//# sourceMappingURL=buildOptions.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getBuildOptions","platformName","readableName","getPlatformInfo","name","description","parse","val","split"],"sources":["../../../src/commands/buildCommand/buildOptions.ts"],"sourcesContent":["import {BuilderCommand} from '../../types';\nimport {getPlatformInfo} from '../runCommand/getPlatformInfo';\n\nexport type BuildFlags = {\n mode?: string;\n target?: string;\n verbose?: boolean;\n scheme?: string;\n xcconfig?: string;\n buildFolder?: string;\n interactive?: boolean;\n destination?: string;\n extraParams?: string[];\n forcePods?: boolean;\n};\n\nexport const getBuildOptions = ({platformName}: BuilderCommand) => {\n const {readableName} = getPlatformInfo(platformName);\n return [\n {\n name: '--mode <string>',\n description:\n 'Explicitly set the scheme configuration to use. This option is case sensitive.',\n },\n {\n name: '--scheme <string>',\n description: 'Explicitly set Xcode scheme to use',\n },\n {\n name: '--destination <string>',\n description: 'Explicitly extend destination e.g. \"arch=x86_64\"',\n },\n {\n name: '--verbose',\n description: 'Do not use xcbeautify or xcpretty even if installed',\n },\n {\n name: '--xcconfig [string]',\n description: 'Explicitly set xcconfig to use',\n },\n {\n name: '--buildFolder <string>',\n description: `Location for ${readableName} build artifacts. Corresponds to Xcode's \"-derivedDataPath\".`,\n },\n {\n name: '--extra-params <string>',\n description: 'Custom params that will be passed to xcodebuild command.',\n parse: (val: string) => val.split(' '),\n },\n {\n name: '--target <string>',\n description: 'Explicitly set Xcode target to use.',\n },\n {\n name: '--interactive',\n description:\n 'Explicitly select which scheme and configuration to use before running a build',\n },\n {\n name: '--force-pods',\n description: 'Force CocoaPods installation',\n },\n ];\n};\n"],"mappings":";;;;;;AACA;AAeO,MAAMA,eAAe,GAAG,CAAC;EAACC;AAA4B,CAAC,KAAK;EACjE,MAAM;IAACC;EAAY,CAAC,GAAG,IAAAC,gCAAe,EAACF,YAAY,CAAC;EACpD,OAAO,CACL;IACEG,IAAI,EAAE,iBAAiB;IACvBC,WAAW,EACT;EACJ,CAAC,EACD;IACED,IAAI,EAAE,mBAAmB;IACzBC,WAAW,EAAE;EACf,CAAC,EACD;IACED,IAAI,EAAE,wBAAwB;IAC9BC,WAAW,EAAE;EACf,CAAC,EACD;IACED,IAAI,EAAE,WAAW;IACjBC,WAAW,EAAE;EACf,CAAC,EACD;IACED,IAAI,EAAE,qBAAqB;IAC3BC,WAAW,EAAE;EACf,CAAC,EACD;IACED,IAAI,EAAE,wBAAwB;IAC9BC,WAAW,EAAG,gBAAeH,YAAa;EAC5C,CAAC,EACD;IACEE,IAAI,EAAE,yBAAyB;IAC/BC,WAAW,EAAE,0DAA0D;IACvEC,KAAK,EAAGC,GAAW,IAAKA,GAAG,CAACC,KAAK,CAAC,GAAG;EACvC,CAAC,EACD;IACEJ,IAAI,EAAE,mBAAmB;IACzBC,WAAW,EAAE;EACf,CAAC,EACD;IACED,IAAI,EAAE,eAAe;IACrBC,WAAW,EACT;EACJ,CAAC,EACD;IACED,IAAI,EAAE,cAAc;IACpBC,WAAW,EAAE;EACf,CAAC,CACF;AACH,CAAC;AAAC"}

View File

@@ -0,0 +1,5 @@
import { IOSProjectInfo } from '@react-native-community/cli-types';
import type { BuildFlags } from './buildOptions';
import { ApplePlatform } from '../../types';
export declare function buildProject(xcodeProject: IOSProjectInfo, platform: ApplePlatform, udid: string | undefined, mode: string, scheme: string, args: BuildFlags): Promise<string>;
//# sourceMappingURL=buildProject.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"buildProject.d.ts","sourceRoot":"","sources":["../../../src/commands/buildCommand/buildProject.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAOjE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,wBAAgB,YAAY,CAC1B,YAAY,EAAE,cAAc,EAC5B,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,MAAM,CAAC,CA8GjB"}

View File

@@ -0,0 +1,134 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.buildProject = buildProject;
function _child_process() {
const data = _interopRequireDefault(require("child_process"));
_child_process = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _simulatorDestinationMap = require("./simulatorDestinationMap");
var _supportedPlatforms = require("../../config/supportedPlatforms");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function buildProject(xcodeProject, platform, udid, mode, scheme, args) {
return new Promise((resolve, reject) => {
const simulatorDest = _simulatorDestinationMap.simulatorDestinationMap === null || _simulatorDestinationMap.simulatorDestinationMap === void 0 ? void 0 : _simulatorDestinationMap.simulatorDestinationMap[platform];
if (!simulatorDest) {
reject(new (_cliTools().CLIError)(`Unknown platform: ${platform}. Please, use one of: ${Object.values(_supportedPlatforms.supportedPlatforms).join(', ')}.`));
return;
}
const xcodebuildArgs = [xcodeProject.isWorkspace ? '-workspace' : '-project', xcodeProject.name, ...(args.xcconfig ? ['-xcconfig', args.xcconfig] : []), ...(args.buildFolder ? ['-derivedDataPath', args.buildFolder] : []), '-configuration', mode, '-scheme', scheme, '-destination', (udid ? `id=${udid}` : mode === 'Debug' ? `generic/platform=${simulatorDest}` : `generic/platform=${platform}`) + (args.destination ? ',' + args.destination : '')];
if (args.extraParams) {
xcodebuildArgs.push(...args.extraParams);
}
const loader = (0, _cliTools().getLoader)();
_cliTools().logger.info(`Building ${_chalk().default.dim(`(using "xcodebuild ${xcodebuildArgs.join(' ')}")`)}`);
let xcodebuildOutputFormatter;
if (!args.verbose) {
if (xcbeautifyAvailable()) {
xcodebuildOutputFormatter = _child_process().default.spawn('xcbeautify', [], {
stdio: ['pipe', process.stdout, process.stderr]
});
} else if (xcprettyAvailable()) {
xcodebuildOutputFormatter = _child_process().default.spawn('xcpretty', [], {
stdio: ['pipe', process.stdout, process.stderr]
});
}
}
const buildProcess = _child_process().default.spawn('xcodebuild', xcodebuildArgs, getProcessOptions(args));
let buildOutput = '';
let errorOutput = '';
buildProcess.stdout.on('data', data => {
const stringData = data.toString();
buildOutput += stringData;
if (xcodebuildOutputFormatter) {
xcodebuildOutputFormatter.stdin.write(data);
} else {
if (_cliTools().logger.isVerbose()) {
_cliTools().logger.debug(stringData);
} else {
loader.start(`Building the app${'.'.repeat(buildOutput.length % 10)}`);
}
}
});
buildProcess.stderr.on('data', data => {
errorOutput += data;
});
buildProcess.on('close', code => {
if (xcodebuildOutputFormatter) {
xcodebuildOutputFormatter.stdin.end();
} else {
loader.stop();
}
if (code !== 0) {
(0, _cliTools().printRunDoctorTip)();
reject(new (_cliTools().CLIError)(`
Failed to build ${platform} project.
"xcodebuild" exited with error code '${code}'. To debug build
logs further, consider building your app with Xcode.app, by opening
'${xcodeProject.name}'.
`, xcodebuildOutputFormatter ? undefined : buildOutput + '\n' + errorOutput));
return;
}
_cliTools().logger.success('Successfully built the app');
resolve(buildOutput);
});
});
}
function xcbeautifyAvailable() {
try {
_child_process().default.execSync('xcbeautify --version', {
stdio: [0, 'pipe', 'ignore']
});
} catch (error) {
return false;
}
return true;
}
function xcprettyAvailable() {
try {
_child_process().default.execSync('xcpretty --version', {
stdio: [0, 'pipe', 'ignore']
});
} catch (error) {
return false;
}
return true;
}
function getProcessOptions(args) {
if ('packager' in args && typeof args.packager === 'boolean' && args.packager) {
const terminal = 'terminal' in args && typeof args.terminal === 'string' ? args.terminal : '';
const port = 'port' in args && typeof args.port === 'number' ? String(args.port) : '';
return {
env: {
...process.env,
RCT_TERMINAL: terminal,
RCT_METRO_PORT: port
}
};
}
return {
env: process.env
};
}
//# sourceMappingURL=buildProject.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import { Config } from '@react-native-community/cli-types';
import { BuildFlags } from './buildOptions';
import { BuilderCommand } from '../../types';
declare const createBuild: ({ platformName }: BuilderCommand) => (_: Array<string>, ctx: Config, args: BuildFlags) => Promise<string>;
export default createBuild;
//# sourceMappingURL=createBuild.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createBuild.d.ts","sourceRoot":"","sources":["../../../src/commands/buildCommand/createBuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAmB,MAAM,mCAAmC,CAAC;AAG3E,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAI1C,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAG3C,QAAA,MAAM,WAAW,qBACE,cAAc,SACrB,MAAM,MAAM,CAAC,OAAO,MAAM,QAAQ,UAAU,oBA+CrD,CAAC;AAEJ,eAAe,WAAW,CAAC"}

View File

@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _getArchitecture = _interopRequireDefault(require("../../tools/getArchitecture"));
var _pods = _interopRequireDefault(require("../../tools/pods"));
var _buildProject = require("./buildProject");
var _getConfiguration = require("./getConfiguration");
var _getXcodeProjectAndDir = require("./getXcodeProjectAndDir");
var _supportedPlatforms = require("../../config/supportedPlatforms");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const createBuild = ({
platformName
}) => async (_, ctx, args) => {
const platformConfig = ctx.project[platformName];
if (platformConfig === undefined || _supportedPlatforms.supportedPlatforms[platformName] === undefined) {
throw new (_cliTools().CLIError)(`Unable to find ${platformName} platform config`);
}
let installedPods = false;
if (platformConfig.automaticPodsInstallation || args.forcePods) {
const isAppRunningNewArchitecture = platformConfig.sourceDir ? await (0, _getArchitecture.default)(platformConfig.sourceDir) : undefined;
await (0, _pods.default)(ctx.root, ctx.dependencies, platformName, {
forceInstall: args.forcePods,
newArchEnabled: isAppRunningNewArchitecture
});
installedPods = true;
}
let {
xcodeProject,
sourceDir
} = (0, _getXcodeProjectAndDir.getXcodeProjectAndDir)(platformConfig, platformName, installedPods);
process.chdir(sourceDir);
const {
scheme,
mode
} = await (0, _getConfiguration.getConfiguration)(xcodeProject, sourceDir, args, platformName);
return (0, _buildProject.buildProject)(xcodeProject, platformName, undefined, mode, scheme, args);
};
var _default = createBuild;
exports.default = _default;
//# sourceMappingURL=createBuild.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["createBuild","platformName","_","ctx","args","platformConfig","project","undefined","supportedPlatforms","CLIError","installedPods","automaticPodsInstallation","forcePods","isAppRunningNewArchitecture","sourceDir","getArchitecture","resolvePods","root","dependencies","forceInstall","newArchEnabled","xcodeProject","getXcodeProjectAndDir","process","chdir","scheme","mode","getConfiguration","buildProject"],"sources":["../../../src/commands/buildCommand/createBuild.ts"],"sourcesContent":["import {CLIError} from '@react-native-community/cli-tools';\nimport {Config, IOSProjectConfig} from '@react-native-community/cli-types';\nimport getArchitecture from '../../tools/getArchitecture';\nimport resolvePods from '../../tools/pods';\nimport {BuildFlags} from './buildOptions';\nimport {buildProject} from './buildProject';\nimport {getConfiguration} from './getConfiguration';\nimport {getXcodeProjectAndDir} from './getXcodeProjectAndDir';\nimport {BuilderCommand} from '../../types';\nimport {supportedPlatforms} from '../../config/supportedPlatforms';\n\nconst createBuild =\n ({platformName}: BuilderCommand) =>\n async (_: Array<string>, ctx: Config, args: BuildFlags) => {\n const platformConfig = ctx.project[platformName] as IOSProjectConfig;\n\n if (\n platformConfig === undefined ||\n supportedPlatforms[platformName] === undefined\n ) {\n throw new CLIError(`Unable to find ${platformName} platform config`);\n }\n\n let installedPods = false;\n if (platformConfig.automaticPodsInstallation || args.forcePods) {\n const isAppRunningNewArchitecture = platformConfig.sourceDir\n ? await getArchitecture(platformConfig.sourceDir)\n : undefined;\n\n await resolvePods(ctx.root, ctx.dependencies, platformName, {\n forceInstall: args.forcePods,\n newArchEnabled: isAppRunningNewArchitecture,\n });\n\n installedPods = true;\n }\n\n let {xcodeProject, sourceDir} = getXcodeProjectAndDir(\n platformConfig,\n platformName,\n installedPods,\n );\n\n process.chdir(sourceDir);\n\n const {scheme, mode} = await getConfiguration(\n xcodeProject,\n sourceDir,\n args,\n platformName,\n );\n\n return buildProject(\n xcodeProject,\n platformName,\n undefined,\n mode,\n scheme,\n args,\n );\n };\n\nexport default createBuild;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AAAmE;AAEnE,MAAMA,WAAW,GACf,CAAC;EAACC;AAA4B,CAAC,KAC/B,OAAOC,CAAgB,EAAEC,GAAW,EAAEC,IAAgB,KAAK;EACzD,MAAMC,cAAc,GAAGF,GAAG,CAACG,OAAO,CAACL,YAAY,CAAqB;EAEpE,IACEI,cAAc,KAAKE,SAAS,IAC5BC,sCAAkB,CAACP,YAAY,CAAC,KAAKM,SAAS,EAC9C;IACA,MAAM,KAAIE,oBAAQ,EAAE,kBAAiBR,YAAa,kBAAiB,CAAC;EACtE;EAEA,IAAIS,aAAa,GAAG,KAAK;EACzB,IAAIL,cAAc,CAACM,yBAAyB,IAAIP,IAAI,CAACQ,SAAS,EAAE;IAC9D,MAAMC,2BAA2B,GAAGR,cAAc,CAACS,SAAS,GACxD,MAAM,IAAAC,wBAAe,EAACV,cAAc,CAACS,SAAS,CAAC,GAC/CP,SAAS;IAEb,MAAM,IAAAS,aAAW,EAACb,GAAG,CAACc,IAAI,EAAEd,GAAG,CAACe,YAAY,EAAEjB,YAAY,EAAE;MAC1DkB,YAAY,EAAEf,IAAI,CAACQ,SAAS;MAC5BQ,cAAc,EAAEP;IAClB,CAAC,CAAC;IAEFH,aAAa,GAAG,IAAI;EACtB;EAEA,IAAI;IAACW,YAAY;IAAEP;EAAS,CAAC,GAAG,IAAAQ,4CAAqB,EACnDjB,cAAc,EACdJ,YAAY,EACZS,aAAa,CACd;EAEDa,OAAO,CAACC,KAAK,CAACV,SAAS,CAAC;EAExB,MAAM;IAACW,MAAM;IAAEC;EAAI,CAAC,GAAG,MAAM,IAAAC,kCAAgB,EAC3CN,YAAY,EACZP,SAAS,EACTV,IAAI,EACJH,YAAY,CACb;EAED,OAAO,IAAA2B,0BAAY,EACjBP,YAAY,EACZpB,YAAY,EACZM,SAAS,EACTmB,IAAI,EACJD,MAAM,EACNrB,IAAI,CACL;AACH,CAAC;AAAC,eAEWJ,WAAW;AAAA"}

View File

@@ -0,0 +1,8 @@
import { IOSProjectInfo } from '@react-native-community/cli-types';
import type { BuildFlags } from './buildOptions';
import { ApplePlatform } from '../../types';
export declare function getConfiguration(xcodeProject: IOSProjectInfo, sourceDir: string, args: BuildFlags, platformName: ApplePlatform): Promise<{
scheme: string;
mode: string;
}>;
//# sourceMappingURL=getConfiguration.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getConfiguration.d.ts","sourceRoot":"","sources":["../../../src/commands/buildCommand/getConfiguration.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAKjE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAI/C,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,cAAc,EAC5B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,UAAU,EAChB,YAAY,EAAE,aAAa;;;GAwD5B"}

View File

@@ -0,0 +1,73 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getConfiguration = getConfiguration;
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _selectFromInteractiveMode = require("../../tools/selectFromInteractiveMode");
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;
}
var _getPlatformInfo = require("../runCommand/getPlatformInfo");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function getConfiguration(xcodeProject, sourceDir, args, platformName) {
var _info$schemes;
const info = (0, _getInfo.getInfo)();
if (args.mode) {
(0, _checkIfConfigurationExists.checkIfConfigurationExists)((info === null || info === void 0 ? void 0 : info.configurations) ?? [], 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);
if (args.interactive) {
const selection = await (0, _selectFromInteractiveMode.selectFromInteractiveMode)({
scheme,
mode,
info
});
if (selection.scheme) {
scheme = selection.scheme;
}
if (selection.mode) {
mode = selection.mode;
}
}
_cliTools().logger.info(`Found Xcode ${xcodeProject.isWorkspace ? 'workspace' : 'project'} "${_chalk().default.bold(xcodeProject.name)}"`);
return {
scheme,
mode
};
}
//# sourceMappingURL=getConfiguration.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getConfiguration","xcodeProject","sourceDir","args","platformName","info","getInfo","mode","checkIfConfigurationExists","configurations","scheme","path","basename","name","extname","schemes","includes","readableName","getPlatformInfo","fallbackScheme","logger","warn","chalk","bold","getBuildConfigurationFromXcScheme","interactive","selection","selectFromInteractiveMode","isWorkspace"],"sources":["../../../src/commands/buildCommand/getConfiguration.ts"],"sourcesContent":["import chalk from 'chalk';\nimport {IOSProjectInfo} from '@react-native-community/cli-types';\nimport {logger} from '@react-native-community/cli-tools';\nimport {selectFromInteractiveMode} from '../../tools/selectFromInteractiveMode';\nimport {getInfo} from '../../tools/getInfo';\nimport {checkIfConfigurationExists} from '../../tools/checkIfConfigurationExists';\nimport type {BuildFlags} from './buildOptions';\nimport {getBuildConfigurationFromXcScheme} from '../../tools/getBuildConfigurationFromXcScheme';\nimport path from 'path';\nimport {getPlatformInfo} from '../runCommand/getPlatformInfo';\nimport {ApplePlatform} from '../../types';\n\nexport async function getConfiguration(\n xcodeProject: IOSProjectInfo,\n sourceDir: string,\n args: BuildFlags,\n platformName: ApplePlatform,\n) {\n const info = getInfo();\n\n if (args.mode) {\n checkIfConfigurationExists(info?.configurations ?? [], args.mode);\n }\n\n let scheme =\n args.scheme ||\n path.basename(xcodeProject.name, path.extname(xcodeProject.name));\n\n if (!info?.schemes?.includes(scheme)) {\n const {readableName} = getPlatformInfo(platformName);\n const fallbackScheme = `${scheme}-${readableName}`;\n\n if (info?.schemes?.includes(fallbackScheme)) {\n logger.warn(\n `Scheme \"${chalk.bold(\n scheme,\n )}\" doesn't exist. Using fallback scheme \"${chalk.bold(\n fallbackScheme,\n )}\"`,\n );\n\n scheme = fallbackScheme;\n }\n }\n\n let mode =\n args.mode ||\n getBuildConfigurationFromXcScheme(scheme, 'Debug', sourceDir, info);\n\n if (args.interactive) {\n const selection = await selectFromInteractiveMode({\n scheme,\n mode,\n info,\n });\n\n if (selection.scheme) {\n scheme = selection.scheme;\n }\n\n if (selection.mode) {\n mode = selection.mode;\n }\n }\n\n logger.info(\n `Found Xcode ${\n xcodeProject.isWorkspace ? 'workspace' : 'project'\n } \"${chalk.bold(xcodeProject.name)}\"`,\n );\n\n return {scheme, mode};\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAA8D;AAGvD,eAAeA,gBAAgB,CACpCC,YAA4B,EAC5BC,SAAiB,EACjBC,IAAgB,EAChBC,YAA2B,EAC3B;EAAA;EACA,MAAMC,IAAI,GAAG,IAAAC,gBAAO,GAAE;EAEtB,IAAIH,IAAI,CAACI,IAAI,EAAE;IACb,IAAAC,sDAA0B,EAAC,CAAAH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEI,cAAc,KAAI,EAAE,EAAEN,IAAI,CAACI,IAAI,CAAC;EACnE;EAEA,IAAIG,MAAM,GACRP,IAAI,CAACO,MAAM,IACXC,eAAI,CAACC,QAAQ,CAACX,YAAY,CAACY,IAAI,EAAEF,eAAI,CAACG,OAAO,CAACb,YAAY,CAACY,IAAI,CAAC,CAAC;EAEnE,IAAI,EAACR,IAAI,aAAJA,IAAI,wCAAJA,IAAI,CAAEU,OAAO,kDAAb,cAAeC,QAAQ,CAACN,MAAM,CAAC,GAAE;IAAA;IACpC,MAAM;MAACO;IAAY,CAAC,GAAG,IAAAC,gCAAe,EAACd,YAAY,CAAC;IACpD,MAAMe,cAAc,GAAI,GAAET,MAAO,IAAGO,YAAa,EAAC;IAElD,IAAIZ,IAAI,aAAJA,IAAI,yCAAJA,IAAI,CAAEU,OAAO,mDAAb,eAAeC,QAAQ,CAACG,cAAc,CAAC,EAAE;MAC3CC,kBAAM,CAACC,IAAI,CACR,WAAUC,gBAAK,CAACC,IAAI,CACnBb,MAAM,CACN,2CAA0CY,gBAAK,CAACC,IAAI,CACpDJ,cAAc,CACd,GAAE,CACL;MAEDT,MAAM,GAAGS,cAAc;IACzB;EACF;EAEA,IAAIZ,IAAI,GACNJ,IAAI,CAACI,IAAI,IACT,IAAAiB,oEAAiC,EAACd,MAAM,EAAE,OAAO,EAAER,SAAS,EAAEG,IAAI,CAAC;EAErE,IAAIF,IAAI,CAACsB,WAAW,EAAE;IACpB,MAAMC,SAAS,GAAG,MAAM,IAAAC,oDAAyB,EAAC;MAChDjB,MAAM;MACNH,IAAI;MACJF;IACF,CAAC,CAAC;IAEF,IAAIqB,SAAS,CAAChB,MAAM,EAAE;MACpBA,MAAM,GAAGgB,SAAS,CAAChB,MAAM;IAC3B;IAEA,IAAIgB,SAAS,CAACnB,IAAI,EAAE;MAClBA,IAAI,GAAGmB,SAAS,CAACnB,IAAI;IACvB;EACF;EAEAa,kBAAM,CAACf,IAAI,CACR,eACCJ,YAAY,CAAC2B,WAAW,GAAG,WAAW,GAAG,SAC1C,KAAIN,gBAAK,CAACC,IAAI,CAACtB,YAAY,CAACY,IAAI,CAAE,GAAE,CACtC;EAED,OAAO;IAACH,MAAM;IAAEH;EAAI,CAAC;AACvB"}

View File

@@ -0,0 +1,7 @@
import { IOSProjectConfig } from '@react-native-community/cli-types';
import { ApplePlatform } from '../../types';
export declare function getXcodeProjectAndDir(iosProjectConfig: IOSProjectConfig | undefined, platformName: ApplePlatform, installedPods?: boolean): {
xcodeProject: import("@react-native-community/cli-types").IOSProjectInfo;
sourceDir: string;
};
//# sourceMappingURL=getXcodeProjectAndDir.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getXcodeProjectAndDir.d.ts","sourceRoot":"","sources":["../../../src/commands/buildCommand/getXcodeProjectAndDir.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,mCAAmC,CAAC;AAInE,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,gBAAgB,GAAG,SAAS,EAC9C,YAAY,EAAE,aAAa,EAC3B,aAAa,CAAC,EAAE,OAAO;;;EA4BxB"}

View File

@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getXcodeProjectAndDir = getXcodeProjectAndDir;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _findXcodeProject = _interopRequireDefault(require("../../config/findXcodeProject"));
var _getPlatformInfo = require("../runCommand/getPlatformInfo");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getXcodeProjectAndDir(iosProjectConfig, platformName, installedPods) {
const {
readableName: platformReadableName
} = (0, _getPlatformInfo.getPlatformInfo)(platformName);
if (!iosProjectConfig) {
throw new (_cliTools().CLIError)(`${platformReadableName} project folder not found. Make sure that project.${platformName}.sourceDir points to a directory with your Xcode project and that you are running this command inside of React Native project.`);
}
let {
xcodeProject,
sourceDir
} = iosProjectConfig;
if (!xcodeProject) {
throw new (_cliTools().CLIError)(`Could not find Xcode project files in "${sourceDir}" folder`);
}
// if project is freshly created, revisit Xcode project to verify Pods are installed correctly.
// This is needed because ctx project is created before Pods are installed, so it might have outdated information.
if (installedPods) {
const recheckXcodeProject = (0, _findXcodeProject.default)(_fs().default.readdirSync(sourceDir));
if (recheckXcodeProject) {
xcodeProject = recheckXcodeProject;
}
}
return {
xcodeProject,
sourceDir
};
}
//# sourceMappingURL=getXcodeProjectAndDir.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getXcodeProjectAndDir","iosProjectConfig","platformName","installedPods","readableName","platformReadableName","getPlatformInfo","CLIError","xcodeProject","sourceDir","recheckXcodeProject","findXcodeProject","fs","readdirSync"],"sources":["../../../src/commands/buildCommand/getXcodeProjectAndDir.ts"],"sourcesContent":["import fs from 'fs';\nimport {IOSProjectConfig} from '@react-native-community/cli-types';\nimport {CLIError} from '@react-native-community/cli-tools';\nimport findXcodeProject from '../../config/findXcodeProject';\nimport {getPlatformInfo} from '../runCommand/getPlatformInfo';\nimport {ApplePlatform} from '../../types';\n\nexport function getXcodeProjectAndDir(\n iosProjectConfig: IOSProjectConfig | undefined,\n platformName: ApplePlatform,\n installedPods?: boolean,\n) {\n const {readableName: platformReadableName} = getPlatformInfo(platformName);\n\n if (!iosProjectConfig) {\n throw new CLIError(\n `${platformReadableName} project folder not found. Make sure that project.${platformName}.sourceDir points to a directory with your Xcode project and that you are running this command inside of React Native project.`,\n );\n }\n\n let {xcodeProject, sourceDir} = iosProjectConfig;\n\n if (!xcodeProject) {\n throw new CLIError(\n `Could not find Xcode project files in \"${sourceDir}\" folder`,\n );\n }\n\n // if project is freshly created, revisit Xcode project to verify Pods are installed correctly.\n // This is needed because ctx project is created before Pods are installed, so it might have outdated information.\n if (installedPods) {\n const recheckXcodeProject = findXcodeProject(fs.readdirSync(sourceDir));\n if (recheckXcodeProject) {\n xcodeProject = recheckXcodeProject;\n }\n }\n\n return {xcodeProject, sourceDir};\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AAA8D;AAGvD,SAASA,qBAAqB,CACnCC,gBAA8C,EAC9CC,YAA2B,EAC3BC,aAAuB,EACvB;EACA,MAAM;IAACC,YAAY,EAAEC;EAAoB,CAAC,GAAG,IAAAC,gCAAe,EAACJ,YAAY,CAAC;EAE1E,IAAI,CAACD,gBAAgB,EAAE;IACrB,MAAM,KAAIM,oBAAQ,EACf,GAAEF,oBAAqB,qDAAoDH,YAAa,gIAA+H,CACzN;EACH;EAEA,IAAI;IAACM,YAAY;IAAEC;EAAS,CAAC,GAAGR,gBAAgB;EAEhD,IAAI,CAACO,YAAY,EAAE;IACjB,MAAM,KAAID,oBAAQ,EACf,0CAAyCE,SAAU,UAAS,CAC9D;EACH;;EAEA;EACA;EACA,IAAIN,aAAa,EAAE;IACjB,MAAMO,mBAAmB,GAAG,IAAAC,yBAAgB,EAACC,aAAE,CAACC,WAAW,CAACJ,SAAS,CAAC,CAAC;IACvE,IAAIC,mBAAmB,EAAE;MACvBF,YAAY,GAAGE,mBAAmB;IACpC;EACF;EAEA,OAAO;IAACF,YAAY;IAAEC;EAAS,CAAC;AAClC"}

View File

@@ -0,0 +1,3 @@
import { ApplePlatform } from '../../types';
export declare const simulatorDestinationMap: Record<ApplePlatform, string>;
//# sourceMappingURL=simulatorDestinationMap.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"simulatorDestinationMap.d.ts","sourceRoot":"","sources":["../../../src/commands/buildCommand/simulatorDestinationMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAKjE,CAAC"}

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.simulatorDestinationMap = void 0;
const simulatorDestinationMap = {
ios: 'iOS Simulator',
macos: 'macOS',
visionos: 'visionOS Simulator',
tvos: 'tvOS Simulator'
};
exports.simulatorDestinationMap = simulatorDestinationMap;
//# sourceMappingURL=simulatorDestinationMap.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["simulatorDestinationMap","ios","macos","visionos","tvos"],"sources":["../../../src/commands/buildCommand/simulatorDestinationMap.ts"],"sourcesContent":["import {ApplePlatform} from '../../types';\n\nexport const simulatorDestinationMap: Record<ApplePlatform, string> = {\n ios: 'iOS Simulator',\n macos: 'macOS',\n visionos: 'visionOS Simulator',\n tvos: 'tvOS Simulator',\n};\n"],"mappings":";;;;;;AAEO,MAAMA,uBAAsD,GAAG;EACpEC,GAAG,EAAE,eAAe;EACpBC,KAAK,EAAE,OAAO;EACdC,QAAQ,EAAE,oBAAoB;EAC9BC,IAAI,EAAE;AACR,CAAC;AAAC"}

View File

@@ -0,0 +1,11 @@
import { Config } from '@react-native-community/cli-types';
import { BuilderCommand } from '../../types';
/**
* Starts Apple device syslog tail
*/
type Args = {
interactive: boolean;
};
declare const createLog: ({ platformName }: BuilderCommand) => (_: Array<string>, ctx: Config, args: Args) => Promise<void>;
export default createLog;
//# sourceMappingURL=createLog.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createLog.d.ts","sourceRoot":"","sources":["../../../src/commands/logCommand/createLog.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAmB,MAAM,mCAAmC,CAAC;AAM3E,OAAO,EAAC,cAAc,EAAS,MAAM,aAAa,CAAC;AAInD;;GAEG;AAEH,KAAK,IAAI,GAAG;IACV,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,SAAS,qBACI,cAAc,SACrB,MAAM,MAAM,CAAC,OAAO,MAAM,QAAQ,IAAI,kBAiD/C,CAAC;AAuBJ,eAAe,SAAS,CAAC"}

View File

@@ -0,0 +1,98 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _child_process() {
const data = require("child_process");
_child_process = function () {
return data;
};
return data;
}
function _os() {
const data = _interopRequireDefault(require("os"));
_os = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
var _listDevices = _interopRequireDefault(require("../../tools/listDevices"));
var _getPlatformInfo = require("../runCommand/getPlatformInfo");
var _supportedPlatforms = require("../../config/supportedPlatforms");
var _prompts = require("../../tools/prompts");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Starts Apple device syslog tail
*/
const createLog = ({
platformName
}) => async (_, ctx, args) => {
const platformConfig = ctx.project[platformName];
const {
readableName: platformReadableName
} = (0, _getPlatformInfo.getPlatformInfo)(platformName);
if (platformConfig === undefined || _supportedPlatforms.supportedPlatforms[platformName] === undefined) {
throw new (_cliTools().CLIError)(`Unable to find ${platformName} platform config`);
}
const {
sdkNames
} = (0, _getPlatformInfo.getPlatformInfo)(platformName);
const allDevices = await (0, _listDevices.default)(sdkNames);
const simulators = allDevices.filter(({
type
}) => type === 'simulator');
if (simulators.length === 0) {
_cliTools().logger.error('No simulators detected. Install simulators via Xcode.');
return;
}
const booted = simulators.filter(({
state
}) => state === 'Booted');
if (booted.length === 0) {
_cliTools().logger.error(`No booted and available ${platformReadableName} simulators found.`);
return;
}
if (args.interactive && booted.length > 1) {
const udid = await (0, _prompts.promptForDeviceToTailLogs)(platformReadableName, booted);
const simulator = booted.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(booted[0]);
}
};
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], {
stdio: 'inherit'
});
if (log.error !== null) {
throw log.error;
}
}
var _default = createLog;
exports.default = _default;
//# sourceMappingURL=createLog.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import { BuilderCommand } from '../../types';
export declare const getLogOptions: ({}: BuilderCommand) => {
name: string;
description: string;
}[];
//# sourceMappingURL=logOptions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"logOptions.d.ts","sourceRoot":"","sources":["../../../src/commands/logCommand/logOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAE3C,eAAO,MAAM,aAAa,OAAQ,cAAc;;;GAM/C,CAAC"}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getLogOptions = void 0;
const getLogOptions = ({}) => [{
name: '--interactive',
description: 'Explicitly select simulator to tail logs from. By default it will tail logs from the first booted and available simulator.'
}];
exports.getLogOptions = getLogOptions;
//# sourceMappingURL=logOptions.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getLogOptions","name","description"],"sources":["../../../src/commands/logCommand/logOptions.ts"],"sourcesContent":["import {BuilderCommand} from '../../types';\n\nexport const getLogOptions = ({}: BuilderCommand) => [\n {\n name: '--interactive',\n description:\n 'Explicitly select simulator to tail logs from. By default it will tail logs from the first booted and available simulator.',\n },\n];\n"],"mappings":";;;;;;AAEO,MAAMA,aAAa,GAAG,CAAC,CAAiB,CAAC,KAAK,CACnD;EACEC,IAAI,EAAE,eAAe;EACrBC,WAAW,EACT;AACJ,CAAC,CACF;AAAC"}

View File

@@ -0,0 +1,23 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import { Config } from '@react-native-community/cli-types';
import { BuildFlags } from '../buildCommand/buildOptions';
import { BuilderCommand } from '../../types';
export interface FlagsT extends BuildFlags {
simulator?: string;
device?: string | true;
udid?: string;
binaryPath?: string;
listDevices?: boolean;
packager?: boolean;
port: number;
terminal?: string;
}
declare const createRun: ({ platformName }: BuilderCommand) => (_: Array<string>, ctx: Config, args: FlagsT) => Promise<void>;
export default createRun;
//# sourceMappingURL=createRun.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createRun.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/createRun.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAC,MAAM,EAAmB,MAAM,mCAAmC,CAAC;AAa3E,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AASxD,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAI3C,MAAM,WAAW,MAAO,SAAQ,UAAU;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,SAAS,qBACI,cAAc,SACrB,MAAM,MAAM,CAAC,OAAO,MAAM,QAAQ,MAAM,kBAkRjD,CAAC;AAEJ,eAAe,SAAS,CAAC"}

View File

@@ -0,0 +1,203 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _getArchitecture = _interopRequireDefault(require("../../tools/getArchitecture"));
var _listDevices = _interopRequireDefault(require("../../tools/listDevices"));
var _pods = _interopRequireWildcard(require("../../tools/pods"));
var _prompts = require("../../tools/prompts");
var _buildProject = require("../buildCommand/buildProject");
var _getConfiguration = require("../buildCommand/getConfiguration");
var _getXcodeProjectAndDir = require("../buildCommand/getXcodeProjectAndDir");
var _getFallbackSimulator = require("./getFallbackSimulator");
var _getPlatformInfo = require("./getPlatformInfo");
var _matchingDevice = require("./matchingDevice");
var _runOnDevice = require("./runOnDevice");
var _runOnSimulator = require("./runOnSimulator");
var _supportedPlatforms = require("../../config/supportedPlatforms");
var _openApp = _interopRequireDefault(require("./openApp"));
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 }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
const createRun = ({
platformName
}) => async (_, ctx, args) => {
// React Native docs assume platform is always ios/android
_cliTools().link.setPlatform('ios');
const platformConfig = ctx.project[platformName];
const {
sdkNames,
readableName: platformReadableName
} = (0, _getPlatformInfo.getPlatformInfo)(platformName);
if (platformConfig === undefined || _supportedPlatforms.supportedPlatforms[platformName] === undefined) {
throw new (_cliTools().CLIError)(`Unable to find ${platformReadableName} platform config`);
}
let {
packager,
port
} = args;
let installedPods = false;
// check if pods need to be installed
if (platformConfig.automaticPodsInstallation || args.forcePods) {
const isAppRunningNewArchitecture = platformConfig.sourceDir ? await (0, _getArchitecture.default)(platformConfig.sourceDir) : undefined;
await (0, _pods.default)(ctx.root, ctx.dependencies, platformName, {
forceInstall: args.forcePods,
newArchEnabled: isAppRunningNewArchitecture
});
installedPods = true;
}
if (packager) {
const {
port: newPort,
startPackager
} = await (0, _cliTools().findDevServerPort)(port, ctx.root);
if (startPackager) {
await (0, _cliTools().startServerInNewWindow)(newPort, ctx.root, ctx.reactNativePath, args.terminal);
}
}
if (ctx.reactNativeVersion !== 'unknown') {
_cliTools().link.setVersion(ctx.reactNativeVersion);
}
let {
xcodeProject,
sourceDir
} = (0, _getXcodeProjectAndDir.getXcodeProjectAndDir)(platformConfig, platformName, installedPods);
process.chdir(sourceDir);
if (args.binaryPath) {
args.binaryPath = _path().default.isAbsolute(args.binaryPath) ? args.binaryPath : _path().default.join(ctx.root, args.binaryPath);
if (!_fs().default.existsSync(args.binaryPath)) {
throw new (_cliTools().CLIError)('binary-path was specified, but the file was not found.');
}
}
const {
mode,
scheme
} = await (0, _getConfiguration.getConfiguration)(xcodeProject, sourceDir, args, platformName);
if (platformName === 'macos') {
const buildOutput = await (0, _buildProject.buildProject)(xcodeProject, platformName, undefined, mode, scheme, args);
(0, _openApp.default)({
buildOutput,
xcodeProject,
mode,
scheme,
target: args.target,
binaryPath: args.binaryPath
});
return;
}
const devices = await (0, _listDevices.default)(sdkNames);
if (devices.length === 0) {
return _cliTools().logger.error(`${platformReadableName} devices or simulators not detected. Install simulators via Xcode or connect a physical ${platformReadableName} device`);
}
const fallbackSimulator = platformName === 'ios' ? (0, _getFallbackSimulator.getFallbackSimulator)(args) : devices[0];
if (args.listDevices || args.interactive) {
if (args.device || args.udid) {
_cliTools().logger.warn(`Both ${args.device ? 'device' : 'udid'} and "list-devices" parameters were passed to "run" command. We will list available devices and let you choose from one.`);
}
const packageJson = (0, _pods.getPackageJson)(ctx.root);
const preferredDevice = _cliTools().cacheManager.get(packageJson.name, 'lastUsedIOSDeviceId');
const selectedDevice = await (0, _prompts.promptForDeviceSelection)(devices, preferredDevice);
if (!selectedDevice) {
throw new (_cliTools().CLIError)(`Failed to select device, please try to run app without ${args.listDevices ? 'list-devices' : 'interactive'} command.`);
} else {
if (selectedDevice.udid !== preferredDevice) {
_cliTools().cacheManager.set(packageJson.name, 'lastUsedIOSDeviceId', selectedDevice.udid);
}
}
if (selectedDevice.type === 'simulator') {
return (0, _runOnSimulator.runOnSimulator)(xcodeProject, platformName, mode, scheme, args, selectedDevice);
} else {
return (0, _runOnDevice.runOnDevice)(selectedDevice, platformName, mode, scheme, xcodeProject, args);
}
}
if (!args.device && !args.udid && !args.simulator) {
const bootedSimulators = devices.filter(({
state,
type
}) => state === 'Booted' && type === 'simulator');
const bootedDevices = devices.filter(({
type
}) => type === 'device'); // Physical devices here are always booted
const booted = [...bootedSimulators, ...bootedDevices];
if (booted.length === 0) {
_cliTools().logger.info('No booted devices or simulators found. Launching first available simulator...');
return (0, _runOnSimulator.runOnSimulator)(xcodeProject, platformName, mode, scheme, args, fallbackSimulator);
}
_cliTools().logger.info(`Found booted ${booted.map(({
name
}) => name).join(', ')}`);
for (const device of bootedDevices) {
await (0, _runOnDevice.runOnDevice)(device, platformName, mode, scheme, xcodeProject, args);
}
for (const simulator of bootedSimulators) {
await (0, _runOnSimulator.runOnSimulator)(xcodeProject, platformName, mode, scheme, args, simulator || fallbackSimulator);
}
return;
}
if (args.device && args.udid) {
return _cliTools().logger.error('The `device` and `udid` options are mutually exclusive.');
}
if (args.udid) {
const device = devices.find(d => d.udid === args.udid);
if (!device) {
return _cliTools().logger.error(`Could not find a device with udid: "${_chalk().default.bold(args.udid)}". ${(0, _matchingDevice.printFoundDevices)(devices)}`);
}
if (device.type === 'simulator') {
return (0, _runOnSimulator.runOnSimulator)(xcodeProject, platformName, mode, scheme, args, fallbackSimulator);
} else {
return (0, _runOnDevice.runOnDevice)(device, platformName, mode, scheme, xcodeProject, args);
}
} else if (args.device) {
const physicalDevices = devices.filter(({
type
}) => type !== 'simulator');
const device = (0, _matchingDevice.matchingDevice)(physicalDevices, args.device);
if (device) {
return (0, _runOnDevice.runOnDevice)(device, platformName, mode, scheme, xcodeProject, args);
}
} else {
(0, _runOnSimulator.runOnSimulator)(xcodeProject, platformName, mode, scheme, args, fallbackSimulator);
}
};
var _default = createRun;
exports.default = _default;
//# sourceMappingURL=createRun.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { BuildSettings } from './getBuildSettings';
import { ApplePlatform } from '../../types';
export declare function getBuildPath(buildSettings: BuildSettings, platform?: ApplePlatform, isCatalyst?: boolean): Promise<string>;
//# sourceMappingURL=getBuildPath.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getBuildPath.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/getBuildPath.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,wBAAsB,YAAY,CAChC,aAAa,EAAE,aAAa,EAC5B,QAAQ,GAAE,aAAqB,EAC/B,UAAU,GAAE,OAAe,mBAyB5B"}

View File

@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBuildPath = getBuildPath;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
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 getBuildPath(buildSettings, platform = 'ios', isCatalyst = false) {
const targetBuildDir = buildSettings.TARGET_BUILD_DIR;
const executableFolderPath = buildSettings.EXECUTABLE_FOLDER_PATH;
const fullProductName = buildSettings.FULL_PRODUCT_NAME;
if (!targetBuildDir) {
throw new (_cliTools().CLIError)('Failed to get the target build directory.');
}
if (!executableFolderPath) {
throw new (_cliTools().CLIError)('Failed to get the app name.');
}
if (!fullProductName) {
throw new (_cliTools().CLIError)('Failed to get product name.');
}
if (isCatalyst) {
return _path().default.join(`${targetBuildDir}-maccatalyst`, executableFolderPath);
} else if (platform === 'macos') {
return _path().default.join(targetBuildDir, fullProductName);
} else {
return _path().default.join(targetBuildDir, executableFolderPath);
}
}
//# sourceMappingURL=getBuildPath.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getBuildPath","buildSettings","platform","isCatalyst","targetBuildDir","TARGET_BUILD_DIR","executableFolderPath","EXECUTABLE_FOLDER_PATH","fullProductName","FULL_PRODUCT_NAME","CLIError","path","join"],"sources":["../../../src/commands/runCommand/getBuildPath.ts"],"sourcesContent":["import {CLIError} from '@react-native-community/cli-tools';\nimport path from 'path';\nimport {BuildSettings} from './getBuildSettings';\nimport {ApplePlatform} from '../../types';\n\nexport async function getBuildPath(\n buildSettings: BuildSettings,\n platform: ApplePlatform = 'ios',\n isCatalyst: boolean = false,\n) {\n const targetBuildDir = buildSettings.TARGET_BUILD_DIR;\n const executableFolderPath = buildSettings.EXECUTABLE_FOLDER_PATH;\n const fullProductName = buildSettings.FULL_PRODUCT_NAME;\n\n if (!targetBuildDir) {\n throw new CLIError('Failed to get the target build directory.');\n }\n\n if (!executableFolderPath) {\n throw new CLIError('Failed to get the app name.');\n }\n\n if (!fullProductName) {\n throw new CLIError('Failed to get product name.');\n }\n\n if (isCatalyst) {\n return path.join(`${targetBuildDir}-maccatalyst`, executableFolderPath);\n } else if (platform === 'macos') {\n return path.join(targetBuildDir, fullProductName);\n } else {\n return path.join(targetBuildDir, executableFolderPath);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwB;AAIjB,eAAeA,YAAY,CAChCC,aAA4B,EAC5BC,QAAuB,GAAG,KAAK,EAC/BC,UAAmB,GAAG,KAAK,EAC3B;EACA,MAAMC,cAAc,GAAGH,aAAa,CAACI,gBAAgB;EACrD,MAAMC,oBAAoB,GAAGL,aAAa,CAACM,sBAAsB;EACjE,MAAMC,eAAe,GAAGP,aAAa,CAACQ,iBAAiB;EAEvD,IAAI,CAACL,cAAc,EAAE;IACnB,MAAM,KAAIM,oBAAQ,EAAC,2CAA2C,CAAC;EACjE;EAEA,IAAI,CAACJ,oBAAoB,EAAE;IACzB,MAAM,KAAII,oBAAQ,EAAC,6BAA6B,CAAC;EACnD;EAEA,IAAI,CAACF,eAAe,EAAE;IACpB,MAAM,KAAIE,oBAAQ,EAAC,6BAA6B,CAAC;EACnD;EAEA,IAAIP,UAAU,EAAE;IACd,OAAOQ,eAAI,CAACC,IAAI,CAAE,GAAER,cAAe,cAAa,EAAEE,oBAAoB,CAAC;EACzE,CAAC,MAAM,IAAIJ,QAAQ,KAAK,OAAO,EAAE;IAC/B,OAAOS,eAAI,CAACC,IAAI,CAACR,cAAc,EAAEI,eAAe,CAAC;EACnD,CAAC,MAAM;IACL,OAAOG,eAAI,CAACC,IAAI,CAACR,cAAc,EAAEE,oBAAoB,CAAC;EACxD;AACF"}

View File

@@ -0,0 +1,9 @@
import { IOSProjectInfo } from '@react-native-community/cli-types';
export type BuildSettings = {
TARGET_BUILD_DIR: string;
INFOPLIST_PATH: string;
EXECUTABLE_FOLDER_PATH: string;
FULL_PRODUCT_NAME: string;
};
export declare function getBuildSettings(xcodeProject: IOSProjectInfo, mode: string, buildOutput: string, scheme: string, target?: string): Promise<BuildSettings | null>;
//# sourceMappingURL=getBuildSettings.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getBuildSettings.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/getBuildSettings.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAIjE,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,cAAc,EAC5B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAiD/B"}

View File

@@ -0,0 +1,64 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBuildSettings = getBuildSettings;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _child_process() {
const data = _interopRequireDefault(require("child_process"));
_child_process = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function getBuildSettings(xcodeProject, mode, buildOutput, scheme, target) {
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 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;
}
}
// Find app in all building settings - look for WRAPPER_EXTENSION: 'app',
const targetIndex = targets.indexOf(selectedTarget);
const targetSettings = settings[targetIndex].buildSettings;
const wrapperExtension = targetSettings.WRAPPER_EXTENSION;
if (wrapperExtension === 'app') {
return settings[targetIndex].buildSettings;
}
return null;
}
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=getBuildSettings.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getBuildSettings","xcodeProject","mode","buildOutput","scheme","target","buildSettings","child_process","execFileSync","isWorkspace","name","getPlatformName","encoding","settings","JSON","parse","targets","map","settingsTarget","selectedTarget","includes","logger","info","chalk","bold","targetIndex","indexOf","targetSettings","wrapperExtension","WRAPPER_EXTENSION","platformNameMatch","exec","CLIError"],"sources":["../../../src/commands/runCommand/getBuildSettings.ts"],"sourcesContent":["import {CLIError, logger} from '@react-native-community/cli-tools';\nimport {IOSProjectInfo} from '@react-native-community/cli-types';\nimport chalk from 'chalk';\nimport child_process from 'child_process';\n\nexport type BuildSettings = {\n TARGET_BUILD_DIR: string;\n INFOPLIST_PATH: string;\n EXECUTABLE_FOLDER_PATH: string;\n FULL_PRODUCT_NAME: string;\n};\n\nexport async function getBuildSettings(\n xcodeProject: IOSProjectInfo,\n mode: string,\n buildOutput: string,\n scheme: string,\n target?: string,\n): Promise<BuildSettings | null> {\n const buildSettings = child_process.execFileSync(\n 'xcodebuild',\n [\n xcodeProject.isWorkspace ? '-workspace' : '-project',\n xcodeProject.name,\n '-scheme',\n scheme,\n '-sdk',\n getPlatformName(buildOutput),\n '-configuration',\n mode,\n '-showBuildSettings',\n '-json',\n ],\n {encoding: 'utf8'},\n );\n\n const settings = JSON.parse(buildSettings);\n\n const targets = settings.map(\n ({target: settingsTarget}: any) => settingsTarget,\n );\n\n let selectedTarget = targets[0];\n\n if (target) {\n if (!targets.includes(target)) {\n logger.info(\n `Target ${chalk.bold(target)} not found for scheme ${chalk.bold(\n scheme,\n )}, automatically selected target ${chalk.bold(selectedTarget)}`,\n );\n } else {\n selectedTarget = target;\n }\n }\n\n // Find app in all building settings - look for WRAPPER_EXTENSION: 'app',\n const targetIndex = targets.indexOf(selectedTarget);\n const targetSettings = settings[targetIndex].buildSettings;\n\n const wrapperExtension = targetSettings.WRAPPER_EXTENSION;\n\n if (wrapperExtension === 'app') {\n return settings[targetIndex].buildSettings;\n }\n\n return null;\n}\n\nfunction getPlatformName(buildOutput: string) {\n // Xcode can sometimes escape `=` with a backslash or put the value in quotes\n const platformNameMatch = /export PLATFORM_NAME\\\\?=\"?(\\w+)\"?$/m.exec(\n buildOutput,\n );\n if (!platformNameMatch) {\n throw new CLIError(\n 'Couldn\\'t find \"PLATFORM_NAME\" variable in xcodebuild output. Please report this issue and run your project with Xcode instead.',\n );\n }\n return platformNameMatch[1];\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0C;AASnC,eAAeA,gBAAgB,CACpCC,YAA4B,EAC5BC,IAAY,EACZC,WAAmB,EACnBC,MAAc,EACdC,MAAe,EACgB;EAC/B,MAAMC,aAAa,GAAGC,wBAAa,CAACC,YAAY,CAC9C,YAAY,EACZ,CACEP,YAAY,CAACQ,WAAW,GAAG,YAAY,GAAG,UAAU,EACpDR,YAAY,CAACS,IAAI,EACjB,SAAS,EACTN,MAAM,EACN,MAAM,EACNO,eAAe,CAACR,WAAW,CAAC,EAC5B,gBAAgB,EAChBD,IAAI,EACJ,oBAAoB,EACpB,OAAO,CACR,EACD;IAACU,QAAQ,EAAE;EAAM,CAAC,CACnB;EAED,MAAMC,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACT,aAAa,CAAC;EAE1C,MAAMU,OAAO,GAAGH,QAAQ,CAACI,GAAG,CAC1B,CAAC;IAACZ,MAAM,EAAEa;EAAmB,CAAC,KAAKA,cAAc,CAClD;EAED,IAAIC,cAAc,GAAGH,OAAO,CAAC,CAAC,CAAC;EAE/B,IAAIX,MAAM,EAAE;IACV,IAAI,CAACW,OAAO,CAACI,QAAQ,CAACf,MAAM,CAAC,EAAE;MAC7BgB,kBAAM,CAACC,IAAI,CACR,UAASC,gBAAK,CAACC,IAAI,CAACnB,MAAM,CAAE,yBAAwBkB,gBAAK,CAACC,IAAI,CAC7DpB,MAAM,CACN,mCAAkCmB,gBAAK,CAACC,IAAI,CAACL,cAAc,CAAE,EAAC,CACjE;IACH,CAAC,MAAM;MACLA,cAAc,GAAGd,MAAM;IACzB;EACF;;EAEA;EACA,MAAMoB,WAAW,GAAGT,OAAO,CAACU,OAAO,CAACP,cAAc,CAAC;EACnD,MAAMQ,cAAc,GAAGd,QAAQ,CAACY,WAAW,CAAC,CAACnB,aAAa;EAE1D,MAAMsB,gBAAgB,GAAGD,cAAc,CAACE,iBAAiB;EAEzD,IAAID,gBAAgB,KAAK,KAAK,EAAE;IAC9B,OAAOf,QAAQ,CAACY,WAAW,CAAC,CAACnB,aAAa;EAC5C;EAEA,OAAO,IAAI;AACb;AAEA,SAASK,eAAe,CAACR,WAAmB,EAAE;EAC5C;EACA,MAAM2B,iBAAiB,GAAG,qCAAqC,CAACC,IAAI,CAClE5B,WAAW,CACZ;EACD,IAAI,CAAC2B,iBAAiB,EAAE;IACtB,MAAM,KAAIE,oBAAQ,EAChB,iIAAiI,CAClI;EACH;EACA,OAAOF,iBAAiB,CAAC,CAAC,CAAC;AAC7B"}

View File

@@ -0,0 +1,4 @@
import { Device } from '../../types';
import { FlagsT } from './createRun';
export declare function getFallbackSimulator(args: FlagsT): Device;
//# sourceMappingURL=getFallbackSimulator.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getFallbackSimulator.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/getFallbackSimulator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA0BzD"}

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getFallbackSimulator = getFallbackSimulator;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _getDestinationSimulator = require("../../tools/getDestinationSimulator");
function getFallbackSimulator(args) {
/**
* If provided simulator does not exist, try simulators in following order
* - iPhone 14
* - iPhone 13
* - iPhone 12
* - iPhone 11
*/
const fallbackSimulators = ['iPhone 14', 'iPhone 13', 'iPhone 12', 'iPhone 11'];
const selectedSimulator = (0, _getDestinationSimulator.getDestinationSimulator)(args, fallbackSimulators);
if (!selectedSimulator) {
throw new (_cliTools().CLIError)(`No simulator available with ${args.simulator ? `name "${args.simulator}"` : `udid "${args.udid}"`}`);
}
return selectedSimulator;
}
//# sourceMappingURL=getFallbackSimulator.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getFallbackSimulator","args","fallbackSimulators","selectedSimulator","getDestinationSimulator","CLIError","simulator","udid"],"sources":["../../../src/commands/runCommand/getFallbackSimulator.ts"],"sourcesContent":["import {CLIError} from '@react-native-community/cli-tools';\nimport {getDestinationSimulator} from '../../tools/getDestinationSimulator';\nimport {Device} from '../../types';\nimport {FlagsT} from './createRun';\n\nexport function getFallbackSimulator(args: FlagsT): Device {\n /**\n * If provided simulator does not exist, try simulators in following order\n * - iPhone 14\n * - iPhone 13\n * - iPhone 12\n * - iPhone 11\n */\n\n const fallbackSimulators = [\n 'iPhone 14',\n 'iPhone 13',\n 'iPhone 12',\n 'iPhone 11',\n ];\n const selectedSimulator = getDestinationSimulator(args, fallbackSimulators);\n\n if (!selectedSimulator) {\n throw new CLIError(\n `No simulator available with ${\n args.simulator ? `name \"${args.simulator}\"` : `udid \"${args.udid}\"`\n }`,\n );\n }\n\n return selectedSimulator;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAIO,SAASA,oBAAoB,CAACC,IAAY,EAAU;EACzD;AACF;AACA;AACA;AACA;AACA;AACA;;EAEE,MAAMC,kBAAkB,GAAG,CACzB,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,CACZ;EACD,MAAMC,iBAAiB,GAAG,IAAAC,gDAAuB,EAACH,IAAI,EAAEC,kBAAkB,CAAC;EAE3E,IAAI,CAACC,iBAAiB,EAAE;IACtB,MAAM,KAAIE,oBAAQ,EACf,+BACCJ,IAAI,CAACK,SAAS,GAAI,SAAQL,IAAI,CAACK,SAAU,GAAE,GAAI,SAAQL,IAAI,CAACM,IAAK,GAClE,EAAC,CACH;EACH;EAEA,OAAOJ,iBAAiB;AAC1B"}

View File

@@ -0,0 +1,14 @@
import { ApplePlatform } from '../../types';
interface PlatformInfo {
readableName: string;
sdkNames: string[];
}
/**
* Returns platform readable name and list of SDKs for given platform.
* We can get list of SDKs from `xcodebuild -showsdks` command.
*
* Falls back to iOS if platform is not supported.
*/
export declare function getPlatformInfo(platform: ApplePlatform): PlatformInfo;
export {};
//# sourceMappingURL=getPlatformInfo.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getPlatformInfo.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/getPlatformInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,UAAU,YAAY;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY,CA2BrE"}

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPlatformInfo = getPlatformInfo;
/**
* Returns platform readable name and list of SDKs for given platform.
* We can get list of SDKs from `xcodebuild -showsdks` command.
*
* Falls back to iOS if platform is not supported.
*/
function getPlatformInfo(platform) {
const iosPlatformInfo = {
readableName: 'iOS',
sdkNames: ['iphonesimulator', 'iphoneos']
};
switch (platform) {
case 'ios':
return iosPlatformInfo;
case 'tvos':
return {
readableName: 'tvOS',
sdkNames: ['appletvsimulator', 'appletvos']
};
case 'visionos':
return {
readableName: 'visionOS',
sdkNames: ['xrsimulator', 'xros']
};
case 'macos':
return {
readableName: 'macOS',
sdkNames: ['macosx']
};
default:
return iosPlatformInfo;
}
}
//# sourceMappingURL=getPlatformInfo.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getPlatformInfo","platform","iosPlatformInfo","readableName","sdkNames"],"sources":["../../../src/commands/runCommand/getPlatformInfo.ts"],"sourcesContent":["import {ApplePlatform} from '../../types';\n\ninterface PlatformInfo {\n readableName: string;\n sdkNames: string[];\n}\n\n/**\n * Returns platform readable name and list of SDKs for given platform.\n * We can get list of SDKs from `xcodebuild -showsdks` command.\n *\n * Falls back to iOS if platform is not supported.\n */\nexport function getPlatformInfo(platform: ApplePlatform): PlatformInfo {\n const iosPlatformInfo: PlatformInfo = {\n readableName: 'iOS',\n sdkNames: ['iphonesimulator', 'iphoneos'],\n };\n\n switch (platform) {\n case 'ios':\n return iosPlatformInfo;\n case 'tvos':\n return {\n readableName: 'tvOS',\n sdkNames: ['appletvsimulator', 'appletvos'],\n };\n case 'visionos':\n return {\n readableName: 'visionOS',\n sdkNames: ['xrsimulator', 'xros'],\n };\n case 'macos':\n return {\n readableName: 'macOS',\n sdkNames: ['macosx'],\n };\n default:\n return iosPlatformInfo;\n }\n}\n"],"mappings":";;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAe,CAACC,QAAuB,EAAgB;EACrE,MAAMC,eAA6B,GAAG;IACpCC,YAAY,EAAE,KAAK;IACnBC,QAAQ,EAAE,CAAC,iBAAiB,EAAE,UAAU;EAC1C,CAAC;EAED,QAAQH,QAAQ;IACd,KAAK,KAAK;MACR,OAAOC,eAAe;IACxB,KAAK,MAAM;MACT,OAAO;QACLC,YAAY,EAAE,MAAM;QACpBC,QAAQ,EAAE,CAAC,kBAAkB,EAAE,WAAW;MAC5C,CAAC;IACH,KAAK,UAAU;MACb,OAAO;QACLD,YAAY,EAAE,UAAU;QACxBC,QAAQ,EAAE,CAAC,aAAa,EAAE,MAAM;MAClC,CAAC;IACH,KAAK,OAAO;MACV,OAAO;QACLD,YAAY,EAAE,OAAO;QACrBC,QAAQ,EAAE,CAAC,QAAQ;MACrB,CAAC;IACH;MACE,OAAOF,eAAe;EAAC;AAE7B"}

View File

@@ -0,0 +1,15 @@
import { IOSProjectInfo } from '@react-native-community/cli-types';
import { ApplePlatform } from '../../types';
type Options = {
buildOutput: string;
xcodeProject: IOSProjectInfo;
mode: string;
scheme: string;
target?: string;
udid: string;
binaryPath?: string;
platform?: ApplePlatform;
};
export default function installApp({ buildOutput, xcodeProject, mode, scheme, target, udid, binaryPath, platform, }: Options): Promise<void>;
export {};
//# sourceMappingURL=installApp.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"installApp.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/installApp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAKjE,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAc1C,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,wBAA8B,UAAU,CAAC,EACvC,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,UAAU,EACV,QAAQ,GACT,EAAE,OAAO,iBAgET"}

View File

@@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = installApp;
function _child_process() {
const data = _interopRequireDefault(require("child_process"));
_child_process = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
var _getBuildPath = require("./getBuildPath");
var _getBuildSettings = require("./getBuildSettings");
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function handleLaunchResult(success, errorMessage, errorDetails = '') {
if (success) {
_cliTools().logger.success('Successfully launched the app');
} else {
_cliTools().logger.error(errorMessage, errorDetails);
}
}
async function installApp({
buildOutput,
xcodeProject,
mode,
scheme,
target,
udid,
binaryPath,
platform
}) {
let appPath = binaryPath;
const buildSettings = await (0, _getBuildSettings.getBuildSettings)(xcodeProject, mode, buildOutput, scheme, target);
if (!buildSettings) {
throw new (_cliTools().CLIError)('Failed to get build settings for your project');
}
if (!appPath) {
appPath = await (0, _getBuildPath.getBuildPath)(buildSettings, platform);
}
const targetBuildDir = buildSettings.TARGET_BUILD_DIR;
const infoPlistPath = buildSettings.INFOPLIST_PATH;
if (!infoPlistPath) {
throw new (_cliTools().CLIError)('Failed to find Info.plist');
}
if (!targetBuildDir) {
throw new (_cliTools().CLIError)('Failed to get target build directory.');
}
_cliTools().logger.info(`Installing "${_chalk().default.bold(appPath)}`);
if (udid && appPath) {
_child_process().default.spawnSync('xcrun', ['simctl', 'install', udid, appPath], {
stdio: 'inherit'
});
}
const bundleID = _child_process().default.execFileSync('/usr/libexec/PlistBuddy', ['-c', 'Print:CFBundleIdentifier', _path().default.join(targetBuildDir, infoPlistPath)], {
encoding: 'utf8'
}).trim();
_cliTools().logger.info(`Launching "${_chalk().default.bold(bundleID)}"`);
let result = _child_process().default.spawnSync('xcrun', ['simctl', 'launch', udid, bundleID]);
handleLaunchResult(result.status === 0, 'Failed to launch the app on simulator', result.stderr.toString());
}
//# sourceMappingURL=installApp.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["handleLaunchResult","success","errorMessage","errorDetails","logger","error","installApp","buildOutput","xcodeProject","mode","scheme","target","udid","binaryPath","platform","appPath","buildSettings","getBuildSettings","CLIError","getBuildPath","targetBuildDir","TARGET_BUILD_DIR","infoPlistPath","INFOPLIST_PATH","info","chalk","bold","child_process","spawnSync","stdio","bundleID","execFileSync","path","join","encoding","trim","result","status","stderr","toString"],"sources":["../../../src/commands/runCommand/installApp.ts"],"sourcesContent":["import child_process from 'child_process';\nimport {CLIError, logger} from '@react-native-community/cli-tools';\nimport {IOSProjectInfo} from '@react-native-community/cli-types';\nimport chalk from 'chalk';\nimport {getBuildPath} from './getBuildPath';\nimport {getBuildSettings} from './getBuildSettings';\nimport path from 'path';\nimport {ApplePlatform} from '../../types';\n\nfunction handleLaunchResult(\n success: boolean,\n errorMessage: string,\n errorDetails = '',\n) {\n if (success) {\n logger.success('Successfully launched the app');\n } else {\n logger.error(errorMessage, errorDetails);\n }\n}\n\ntype Options = {\n buildOutput: string;\n xcodeProject: IOSProjectInfo;\n mode: string;\n scheme: string;\n target?: string;\n udid: string;\n binaryPath?: string;\n platform?: ApplePlatform;\n};\n\nexport default async function installApp({\n buildOutput,\n xcodeProject,\n mode,\n scheme,\n target,\n udid,\n binaryPath,\n platform,\n}: Options) {\n let appPath = binaryPath;\n\n const buildSettings = await getBuildSettings(\n xcodeProject,\n mode,\n buildOutput,\n scheme,\n target,\n );\n\n if (!buildSettings) {\n throw new CLIError('Failed to get build settings for your project');\n }\n\n if (!appPath) {\n appPath = await getBuildPath(buildSettings, platform);\n }\n\n const targetBuildDir = buildSettings.TARGET_BUILD_DIR;\n const infoPlistPath = buildSettings.INFOPLIST_PATH;\n\n if (!infoPlistPath) {\n throw new CLIError('Failed to find Info.plist');\n }\n\n if (!targetBuildDir) {\n throw new CLIError('Failed to get target build directory.');\n }\n\n logger.info(`Installing \"${chalk.bold(appPath)}`);\n\n if (udid && appPath) {\n child_process.spawnSync('xcrun', ['simctl', 'install', udid, appPath], {\n stdio: 'inherit',\n });\n }\n\n const bundleID = child_process\n .execFileSync(\n '/usr/libexec/PlistBuddy',\n [\n '-c',\n 'Print:CFBundleIdentifier',\n path.join(targetBuildDir, infoPlistPath),\n ],\n {encoding: 'utf8'},\n )\n .trim();\n\n logger.info(`Launching \"${chalk.bold(bundleID)}\"`);\n\n let result = child_process.spawnSync('xcrun', [\n 'simctl',\n 'launch',\n udid,\n bundleID,\n ]);\n\n handleLaunchResult(\n result.status === 0,\n 'Failed to launch the app on simulator',\n result.stderr.toString(),\n );\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwB;AAGxB,SAASA,kBAAkB,CACzBC,OAAgB,EAChBC,YAAoB,EACpBC,YAAY,GAAG,EAAE,EACjB;EACA,IAAIF,OAAO,EAAE;IACXG,kBAAM,CAACH,OAAO,CAAC,+BAA+B,CAAC;EACjD,CAAC,MAAM;IACLG,kBAAM,CAACC,KAAK,CAACH,YAAY,EAAEC,YAAY,CAAC;EAC1C;AACF;AAae,eAAeG,UAAU,CAAC;EACvCC,WAAW;EACXC,YAAY;EACZC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,IAAI;EACJC,UAAU;EACVC;AACO,CAAC,EAAE;EACV,IAAIC,OAAO,GAAGF,UAAU;EAExB,MAAMG,aAAa,GAAG,MAAM,IAAAC,kCAAgB,EAC1CT,YAAY,EACZC,IAAI,EACJF,WAAW,EACXG,MAAM,EACNC,MAAM,CACP;EAED,IAAI,CAACK,aAAa,EAAE;IAClB,MAAM,KAAIE,oBAAQ,EAAC,+CAA+C,CAAC;EACrE;EAEA,IAAI,CAACH,OAAO,EAAE;IACZA,OAAO,GAAG,MAAM,IAAAI,0BAAY,EAACH,aAAa,EAAEF,QAAQ,CAAC;EACvD;EAEA,MAAMM,cAAc,GAAGJ,aAAa,CAACK,gBAAgB;EACrD,MAAMC,aAAa,GAAGN,aAAa,CAACO,cAAc;EAElD,IAAI,CAACD,aAAa,EAAE;IAClB,MAAM,KAAIJ,oBAAQ,EAAC,2BAA2B,CAAC;EACjD;EAEA,IAAI,CAACE,cAAc,EAAE;IACnB,MAAM,KAAIF,oBAAQ,EAAC,uCAAuC,CAAC;EAC7D;EAEAd,kBAAM,CAACoB,IAAI,CAAE,eAAcC,gBAAK,CAACC,IAAI,CAACX,OAAO,CAAE,EAAC,CAAC;EAEjD,IAAIH,IAAI,IAAIG,OAAO,EAAE;IACnBY,wBAAa,CAACC,SAAS,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAEhB,IAAI,EAAEG,OAAO,CAAC,EAAE;MACrEc,KAAK,EAAE;IACT,CAAC,CAAC;EACJ;EAEA,MAAMC,QAAQ,GAAGH,wBAAa,CAC3BI,YAAY,CACX,yBAAyB,EACzB,CACE,IAAI,EACJ,0BAA0B,EAC1BC,eAAI,CAACC,IAAI,CAACb,cAAc,EAAEE,aAAa,CAAC,CACzC,EACD;IAACY,QAAQ,EAAE;EAAM,CAAC,CACnB,CACAC,IAAI,EAAE;EAET/B,kBAAM,CAACoB,IAAI,CAAE,cAAaC,gBAAK,CAACC,IAAI,CAACI,QAAQ,CAAE,GAAE,CAAC;EAElD,IAAIM,MAAM,GAAGT,wBAAa,CAACC,SAAS,CAAC,OAAO,EAAE,CAC5C,QAAQ,EACR,QAAQ,EACRhB,IAAI,EACJkB,QAAQ,CACT,CAAC;EAEF9B,kBAAkB,CAChBoC,MAAM,CAACC,MAAM,KAAK,CAAC,EACnB,uCAAuC,EACvCD,MAAM,CAACE,MAAM,CAACC,QAAQ,EAAE,CACzB;AACH"}

View File

@@ -0,0 +1,5 @@
import { Device } from '../../types';
export declare function matchingDevice(devices: Array<Device>, deviceName: string | true | undefined): Device | undefined;
export declare function formattedDeviceName(simulator: Device): string;
export declare function printFoundDevices(devices: Array<Device>): string;
//# sourceMappingURL=matchingDevice.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"matchingDevice.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/matchingDevice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,wBAAgB,cAAc,CAC5B,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EACtB,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,sBA4BtC;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,UAIpD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,UAKvD"}

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.formattedDeviceName = formattedDeviceName;
exports.matchingDevice = matchingDevice;
exports.printFoundDevices = printFoundDevices;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function matchingDevice(devices, deviceName) {
if (deviceName === true) {
const firstIOSDevice = devices.find(d => d.type === 'device');
if (firstIOSDevice) {
_cliTools().logger.info(`Using first available device named "${_chalk().default.bold(firstIOSDevice.name)}" due to lack of name supplied.`);
return firstIOSDevice;
} else {
_cliTools().logger.error('No iOS devices connected.');
return undefined;
}
}
const deviceByName = devices.find(device => device.name === deviceName || formattedDeviceName(device) === deviceName);
if (!deviceByName) {
_cliTools().logger.error(`Could not find a device named: "${_chalk().default.bold(String(deviceName))}". ${printFoundDevices(devices)}`);
}
return deviceByName;
}
function formattedDeviceName(simulator) {
return simulator.version ? `${simulator.name} (${simulator.version})` : simulator.name;
}
function printFoundDevices(devices) {
return ['Available devices:', ...devices.map(device => ` - ${device.name} (${device.udid})`)].join('\n');
}
//# sourceMappingURL=matchingDevice.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["matchingDevice","devices","deviceName","firstIOSDevice","find","d","type","logger","info","chalk","bold","name","error","undefined","deviceByName","device","formattedDeviceName","String","printFoundDevices","simulator","version","map","udid","join"],"sources":["../../../src/commands/runCommand/matchingDevice.ts"],"sourcesContent":["import {logger} from '@react-native-community/cli-tools';\nimport chalk from 'chalk';\nimport {Device} from '../../types';\n\nexport function matchingDevice(\n devices: Array<Device>,\n deviceName: string | true | undefined,\n) {\n if (deviceName === true) {\n const firstIOSDevice = devices.find((d) => d.type === 'device')!;\n if (firstIOSDevice) {\n logger.info(\n `Using first available device named \"${chalk.bold(\n firstIOSDevice.name,\n )}\" due to lack of name supplied.`,\n );\n return firstIOSDevice;\n } else {\n logger.error('No iOS devices connected.');\n return undefined;\n }\n }\n const deviceByName = devices.find(\n (device) =>\n device.name === deviceName || formattedDeviceName(device) === deviceName,\n );\n if (!deviceByName) {\n logger.error(\n `Could not find a device named: \"${chalk.bold(\n String(deviceName),\n )}\". ${printFoundDevices(devices)}`,\n );\n }\n return deviceByName;\n}\n\nexport function formattedDeviceName(simulator: Device) {\n return simulator.version\n ? `${simulator.name} (${simulator.version})`\n : simulator.name;\n}\n\nexport function printFoundDevices(devices: Array<Device>) {\n return [\n 'Available devices:',\n ...devices.map((device) => ` - ${device.name} (${device.udid})`),\n ].join('\\n');\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0B;AAGnB,SAASA,cAAc,CAC5BC,OAAsB,EACtBC,UAAqC,EACrC;EACA,IAAIA,UAAU,KAAK,IAAI,EAAE;IACvB,MAAMC,cAAc,GAAGF,OAAO,CAACG,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,KAAK,QAAQ,CAAE;IAChE,IAAIH,cAAc,EAAE;MAClBI,kBAAM,CAACC,IAAI,CACR,uCAAsCC,gBAAK,CAACC,IAAI,CAC/CP,cAAc,CAACQ,IAAI,CACnB,iCAAgC,CACnC;MACD,OAAOR,cAAc;IACvB,CAAC,MAAM;MACLI,kBAAM,CAACK,KAAK,CAAC,2BAA2B,CAAC;MACzC,OAAOC,SAAS;IAClB;EACF;EACA,MAAMC,YAAY,GAAGb,OAAO,CAACG,IAAI,CAC9BW,MAAM,IACLA,MAAM,CAACJ,IAAI,KAAKT,UAAU,IAAIc,mBAAmB,CAACD,MAAM,CAAC,KAAKb,UAAU,CAC3E;EACD,IAAI,CAACY,YAAY,EAAE;IACjBP,kBAAM,CAACK,KAAK,CACT,mCAAkCH,gBAAK,CAACC,IAAI,CAC3CO,MAAM,CAACf,UAAU,CAAC,CAClB,MAAKgB,iBAAiB,CAACjB,OAAO,CAAE,EAAC,CACpC;EACH;EACA,OAAOa,YAAY;AACrB;AAEO,SAASE,mBAAmB,CAACG,SAAiB,EAAE;EACrD,OAAOA,SAAS,CAACC,OAAO,GACnB,GAAED,SAAS,CAACR,IAAK,KAAIQ,SAAS,CAACC,OAAQ,GAAE,GAC1CD,SAAS,CAACR,IAAI;AACpB;AAEO,SAASO,iBAAiB,CAACjB,OAAsB,EAAE;EACxD,OAAO,CACL,oBAAoB,EACpB,GAAGA,OAAO,CAACoB,GAAG,CAAEN,MAAM,IAAM,OAAMA,MAAM,CAACJ,IAAK,KAAII,MAAM,CAACO,IAAK,GAAE,CAAC,CAClE,CAACC,IAAI,CAAC,IAAI,CAAC;AACd"}

View File

@@ -0,0 +1,12 @@
import { IOSProjectInfo } from '@react-native-community/cli-types';
type Options = {
buildOutput: string;
xcodeProject: IOSProjectInfo;
mode: string;
scheme: string;
target?: string;
binaryPath?: string;
};
export default function openApp({ buildOutput, xcodeProject, mode, scheme, target, binaryPath, }: Options): Promise<void>;
export {};
//# sourceMappingURL=openApp.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"openApp.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/openApp.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAMjE,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAA8B,OAAO,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,MAAM,EACN,MAAM,EACN,UAAU,GACX,EAAE,OAAO,iBA2BT"}

View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = openApp;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
var _getBuildPath = require("./getBuildPath");
var _getBuildSettings = require("./getBuildSettings");
function _execa() {
const data = _interopRequireDefault(require("execa"));
_execa = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function openApp({
buildOutput,
xcodeProject,
mode,
scheme,
target,
binaryPath
}) {
let appPath = binaryPath;
const buildSettings = await (0, _getBuildSettings.getBuildSettings)(xcodeProject, mode, buildOutput, scheme, target);
if (!buildSettings) {
throw new (_cliTools().CLIError)('Failed to get build settings for your project');
}
if (!appPath) {
appPath = await (0, _getBuildPath.getBuildPath)(buildSettings, 'macos');
}
_cliTools().logger.info(`Opening "${_chalk().default.bold(appPath)}"`);
try {
await (0, _execa().default)(`open ${appPath}`);
_cliTools().logger.success('Successfully launched the app');
} catch (e) {
_cliTools().logger.error('Failed to launch the app', e);
}
}
//# sourceMappingURL=openApp.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["openApp","buildOutput","xcodeProject","mode","scheme","target","binaryPath","appPath","buildSettings","getBuildSettings","CLIError","getBuildPath","logger","info","chalk","bold","execa","success","e","error"],"sources":["../../../src/commands/runCommand/openApp.ts"],"sourcesContent":["import {CLIError, logger} from '@react-native-community/cli-tools';\nimport {IOSProjectInfo} from '@react-native-community/cli-types';\nimport chalk from 'chalk';\nimport {getBuildPath} from './getBuildPath';\nimport {getBuildSettings} from './getBuildSettings';\nimport execa from 'execa';\n\ntype Options = {\n buildOutput: string;\n xcodeProject: IOSProjectInfo;\n mode: string;\n scheme: string;\n target?: string;\n binaryPath?: string;\n};\n\nexport default async function openApp({\n buildOutput,\n xcodeProject,\n mode,\n scheme,\n target,\n binaryPath,\n}: Options) {\n let appPath = binaryPath;\n\n const buildSettings = await getBuildSettings(\n xcodeProject,\n mode,\n buildOutput,\n scheme,\n target,\n );\n\n if (!buildSettings) {\n throw new CLIError('Failed to get build settings for your project');\n }\n\n if (!appPath) {\n appPath = await getBuildPath(buildSettings, 'macos');\n }\n\n logger.info(`Opening \"${chalk.bold(appPath)}\"`);\n\n try {\n await execa(`open ${appPath}`);\n logger.success('Successfully launched the app');\n } catch (e) {\n logger.error('Failed to launch the app', e as string);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0B;AAWX,eAAeA,OAAO,CAAC;EACpCC,WAAW;EACXC,YAAY;EACZC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC;AACO,CAAC,EAAE;EACV,IAAIC,OAAO,GAAGD,UAAU;EAExB,MAAME,aAAa,GAAG,MAAM,IAAAC,kCAAgB,EAC1CP,YAAY,EACZC,IAAI,EACJF,WAAW,EACXG,MAAM,EACNC,MAAM,CACP;EAED,IAAI,CAACG,aAAa,EAAE;IAClB,MAAM,KAAIE,oBAAQ,EAAC,+CAA+C,CAAC;EACrE;EAEA,IAAI,CAACH,OAAO,EAAE;IACZA,OAAO,GAAG,MAAM,IAAAI,0BAAY,EAACH,aAAa,EAAE,OAAO,CAAC;EACtD;EAEAI,kBAAM,CAACC,IAAI,CAAE,YAAWC,gBAAK,CAACC,IAAI,CAACR,OAAO,CAAE,GAAE,CAAC;EAE/C,IAAI;IACF,MAAM,IAAAS,gBAAK,EAAE,QAAOT,OAAQ,EAAC,CAAC;IAC9BK,kBAAM,CAACK,OAAO,CAAC,+BAA+B,CAAC;EACjD,CAAC,CAAC,OAAOC,CAAC,EAAE;IACVN,kBAAM,CAACO,KAAK,CAAC,0BAA0B,EAAED,CAAC,CAAW;EACvD;AACF"}

View File

@@ -0,0 +1,5 @@
import { ApplePlatform, Device } from '../../types';
import { IOSProjectInfo } from '@react-native-community/cli-types';
import { FlagsT } from './createRun';
export declare function runOnDevice(selectedDevice: Device, platform: ApplePlatform, mode: string, scheme: string, xcodeProject: IOSProjectInfo, args: FlagsT): Promise<void>;
//# sourceMappingURL=runOnDevice.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"runOnDevice.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/runOnDevice.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAKjE,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAGnC,wBAAsB,WAAW,CAC/B,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,cAAc,EAC5B,IAAI,EAAE,MAAM,iBAqGb"}

View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.runOnDevice = runOnDevice;
function _child_process() {
const data = _interopRequireDefault(require("child_process"));
_child_process = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
var _buildProject = require("../buildCommand/buildProject");
var _getBuildPath = require("./getBuildPath");
var _getBuildSettings = require("./getBuildSettings");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function runOnDevice(selectedDevice, platform, mode, scheme, xcodeProject, args) {
if (args.binaryPath && selectedDevice.type === 'catalyst') {
throw new (_cliTools().CLIError)('binary-path was specified for catalyst device, which is not supported.');
}
const isIOSDeployInstalled = _child_process().default.spawnSync('ios-deploy', ['--version'], {
encoding: 'utf8'
});
if (isIOSDeployInstalled.error) {
throw new (_cliTools().CLIError)(`Failed to install the app on the device because we couldn't execute the "ios-deploy" command. Please install it by running "${_chalk().default.bold('brew install ios-deploy')}" and try again.`);
}
if (selectedDevice.type === 'catalyst') {
const buildOutput = await (0, _buildProject.buildProject)(xcodeProject, platform, selectedDevice.udid, mode, scheme, args);
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, platform, true);
const appProcess = _child_process().default.spawn(`${appPath}/${scheme}`, [], {
detached: true,
stdio: 'ignore'
});
appProcess.unref();
} else {
let buildOutput, appPath;
if (!args.binaryPath) {
buildOutput = await (0, _buildProject.buildProject)(xcodeProject, platform, selectedDevice.udid, mode, scheme, args);
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, platform);
} else {
appPath = args.binaryPath;
}
const iosDeployInstallArgs = ['--bundle', appPath, '--id', selectedDevice.udid, '--justlaunch'];
_cliTools().logger.info(`Installing and launching your app on ${selectedDevice.name}`);
const iosDeployOutput = _child_process().default.spawnSync('ios-deploy', iosDeployInstallArgs, {
encoding: 'utf8'
});
if (iosDeployOutput.error) {
throw new (_cliTools().CLIError)(`Failed to install the app on the device. We've encountered an error in "ios-deploy" command: ${iosDeployOutput.error.message}`);
}
}
return _cliTools().logger.success('Installed the app on the device.');
}
//# sourceMappingURL=runOnDevice.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
import { IOSProjectInfo } from '@react-native-community/cli-types';
import { ApplePlatform, Device } from '../../types';
import { FlagsT } from './createRun';
export declare function runOnSimulator(xcodeProject: IOSProjectInfo, platform: ApplePlatform, mode: string, scheme: string, args: FlagsT, simulator: Device): Promise<void>;
//# sourceMappingURL=runOnSimulator.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"runOnSimulator.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/runOnSimulator.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAEjE,OAAO,EAAC,aAAa,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAGnC,wBAAsB,cAAc,CAClC,YAAY,EAAE,cAAc,EAC5B,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,iBAmDlB"}

View File

@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.runOnSimulator = runOnSimulator;
function _child_process() {
const data = _interopRequireDefault(require("child_process"));
_child_process = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _buildProject = require("../buildCommand/buildProject");
var _matchingDevice = require("./matchingDevice");
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;
/**
* Booting simulator through `xcrun simctl boot` will boot it in the `headless` mode
* (running in the background).
*
* In order for user to see the app and the simulator itself, we have to make sure
* that the Simulator.app is running.
*
* We also pass it `-CurrentDeviceUDID` so that when we launch it for the first time,
* it will not boot the "default" device, but the one we set. If the app is already running,
* this flag has no effect.
*/
const activeDeveloperDir = _child_process().default.execFileSync('xcode-select', ['-p'], {
encoding: 'utf8'
}).trim();
_child_process().default.execFileSync('open', [`${activeDeveloperDir}/Applications/Simulator.app`, '--args', '-CurrentDeviceUDID', simulator.udid]);
if (simulator.state !== 'Booted') {
bootSimulator(simulator);
}
let buildOutput;
if (!binaryPath) {
buildOutput = await (0, _buildProject.buildProject)(xcodeProject, platform, simulator.udid, mode, scheme, args);
}
(0, _installApp.default)({
buildOutput: buildOutput ?? '',
xcodeProject,
mode,
scheme,
target,
udid: simulator.udid,
binaryPath
});
}
function bootSimulator(selectedSimulator) {
const simulatorFullName = (0, _matchingDevice.formattedDeviceName)(selectedSimulator);
_cliTools().logger.info(`Launching ${simulatorFullName}`);
_child_process().default.spawnSync('xcrun', ['simctl', 'boot', selectedSimulator.udid]);
}
//# sourceMappingURL=runOnSimulator.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["runOnSimulator","xcodeProject","platform","mode","scheme","args","simulator","binaryPath","target","activeDeveloperDir","child_process","execFileSync","encoding","trim","udid","state","bootSimulator","buildOutput","buildProject","installApp","selectedSimulator","simulatorFullName","formattedDeviceName","logger","info","spawnSync"],"sources":["../../../src/commands/runCommand/runOnSimulator.ts"],"sourcesContent":["import child_process from 'child_process';\nimport {IOSProjectInfo} from '@react-native-community/cli-types';\nimport {logger} from '@react-native-community/cli-tools';\nimport {ApplePlatform, Device} from '../../types';\nimport {buildProject} from '../buildCommand/buildProject';\nimport {formattedDeviceName} from './matchingDevice';\nimport {FlagsT} from './createRun';\nimport installApp from './installApp';\n\nexport async function runOnSimulator(\n xcodeProject: IOSProjectInfo,\n platform: ApplePlatform,\n mode: string,\n scheme: string,\n args: FlagsT,\n simulator: Device,\n) {\n const {binaryPath, target} = args;\n\n /**\n * Booting simulator through `xcrun simctl boot` will boot it in the `headless` mode\n * (running in the background).\n *\n * In order for user to see the app and the simulator itself, we have to make sure\n * that the Simulator.app is running.\n *\n * We also pass it `-CurrentDeviceUDID` so that when we launch it for the first time,\n * it will not boot the \"default\" device, but the one we set. If the app is already running,\n * this flag has no effect.\n */\n const activeDeveloperDir = child_process\n .execFileSync('xcode-select', ['-p'], {encoding: 'utf8'})\n .trim();\n\n child_process.execFileSync('open', [\n `${activeDeveloperDir}/Applications/Simulator.app`,\n '--args',\n '-CurrentDeviceUDID',\n simulator.udid,\n ]);\n\n if (simulator.state !== 'Booted') {\n bootSimulator(simulator);\n }\n\n let buildOutput;\n if (!binaryPath) {\n buildOutput = await buildProject(\n xcodeProject,\n platform,\n simulator.udid,\n mode,\n scheme,\n args,\n );\n }\n\n installApp({\n buildOutput: buildOutput ?? '',\n xcodeProject,\n mode,\n scheme,\n target,\n udid: simulator.udid,\n binaryPath,\n });\n}\n\nfunction bootSimulator(selectedSimulator: Device) {\n const simulatorFullName = formattedDeviceName(selectedSimulator);\n logger.info(`Launching ${simulatorFullName}`);\n\n child_process.spawnSync('xcrun', ['simctl', 'boot', selectedSimulator.udid]);\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AAEA;AAAsC;AAE/B,eAAeA,cAAc,CAClCC,YAA4B,EAC5BC,QAAuB,EACvBC,IAAY,EACZC,MAAc,EACdC,IAAY,EACZC,SAAiB,EACjB;EACA,MAAM;IAACC,UAAU;IAAEC;EAAM,CAAC,GAAGH,IAAI;;EAEjC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMI,kBAAkB,GAAGC,wBAAa,CACrCC,YAAY,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE;IAACC,QAAQ,EAAE;EAAM,CAAC,CAAC,CACxDC,IAAI,EAAE;EAETH,wBAAa,CAACC,YAAY,CAAC,MAAM,EAAE,CAChC,GAAEF,kBAAmB,6BAA4B,EAClD,QAAQ,EACR,oBAAoB,EACpBH,SAAS,CAACQ,IAAI,CACf,CAAC;EAEF,IAAIR,SAAS,CAACS,KAAK,KAAK,QAAQ,EAAE;IAChCC,aAAa,CAACV,SAAS,CAAC;EAC1B;EAEA,IAAIW,WAAW;EACf,IAAI,CAACV,UAAU,EAAE;IACfU,WAAW,GAAG,MAAM,IAAAC,0BAAY,EAC9BjB,YAAY,EACZC,QAAQ,EACRI,SAAS,CAACQ,IAAI,EACdX,IAAI,EACJC,MAAM,EACNC,IAAI,CACL;EACH;EAEA,IAAAc,mBAAU,EAAC;IACTF,WAAW,EAAEA,WAAW,IAAI,EAAE;IAC9BhB,YAAY;IACZE,IAAI;IACJC,MAAM;IACNI,MAAM;IACNM,IAAI,EAAER,SAAS,CAACQ,IAAI;IACpBP;EACF,CAAC,CAAC;AACJ;AAEA,SAASS,aAAa,CAACI,iBAAyB,EAAE;EAChD,MAAMC,iBAAiB,GAAG,IAAAC,mCAAmB,EAACF,iBAAiB,CAAC;EAChEG,kBAAM,CAACC,IAAI,CAAE,aAAYH,iBAAkB,EAAC,CAAC;EAE7CX,wBAAa,CAACe,SAAS,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAEL,iBAAiB,CAACN,IAAI,CAAC,CAAC;AAC9E"}

View File

@@ -0,0 +1,21 @@
import { BuilderCommand } from '../../types';
export declare const getRunOptions: ({ platformName }: BuilderCommand) => (false | {
name: string;
description: string;
parse?: undefined;
} | {
name: string;
description: string;
parse: (val: string) => string[];
} | {
name: string;
default: string | number;
parse: NumberConstructor;
description?: undefined;
} | {
name: string;
description: string;
default: string | undefined;
parse?: undefined;
})[];
//# sourceMappingURL=runOptions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"runOptions.d.ts","sourceRoot":"","sources":["../../../src/commands/runCommand/runOptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAI3C,eAAO,MAAM,aAAa,qBAAoB,cAAc;;;;;;;;;;;;;;;;;;IA+C3D,CAAC"}

View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getRunOptions = void 0;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _getPlatformInfo = require("./getPlatformInfo");
var _buildOptions = require("../buildCommand/buildOptions");
const getRunOptions = ({
platformName
}) => {
const {
readableName
} = (0, _getPlatformInfo.getPlatformInfo)(platformName);
const isMac = platformName === 'macos';
return [{
name: '--no-packager',
description: 'Do not launch packager while running the app'
}, {
name: '--port <number>',
default: process.env.RCT_METRO_PORT || 8081,
parse: Number
}, {
name: '--terminal <string>',
description: 'Launches the Metro Bundler in a new window using the specified terminal path.',
default: (0, _cliTools().getDefaultUserTerminal)()
}, {
name: '--binary-path <string>',
description: 'Path relative to project root where pre-built .app binary lives.'
}, {
name: '--list-devices',
description: `List all available ${readableName} devices and simulators and let you choose one to run the app. `
}, {
name: '--udid <string>',
description: 'Explicitly set the device to use by UDID'
}, !isMac && {
name: '--simulator <string>',
description: `Explicitly set the simulator to use. Optionally set the ${readableName} version ` + 'between parentheses at the end to match an exact version: ' + '"iPhone 15 (17.0)"'
}, !isMac && {
name: '--device [string]',
// here we're intentionally using [] over <> to make passed value optional to allow users to run only on physical devices
description: 'Explicitly set the device to use by name. If the value is not provided,' + 'the app will run on the first available physical device.'
}, ...(0, _buildOptions.getBuildOptions)({
platformName
})];
};
exports.getRunOptions = getRunOptions;
//# sourceMappingURL=runOptions.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getRunOptions","platformName","readableName","getPlatformInfo","isMac","name","description","default","process","env","RCT_METRO_PORT","parse","Number","getDefaultUserTerminal","getBuildOptions"],"sources":["../../../src/commands/runCommand/runOptions.ts"],"sourcesContent":["import {getDefaultUserTerminal} from '@react-native-community/cli-tools';\nimport {BuilderCommand} from '../../types';\nimport {getPlatformInfo} from './getPlatformInfo';\nimport {getBuildOptions} from '../buildCommand/buildOptions';\n\nexport const getRunOptions = ({platformName}: BuilderCommand) => {\n const {readableName} = getPlatformInfo(platformName);\n const isMac = platformName === 'macos';\n return [\n {\n name: '--no-packager',\n description: 'Do not launch packager while running the app',\n },\n {\n name: '--port <number>',\n default: process.env.RCT_METRO_PORT || 8081,\n parse: Number,\n },\n {\n name: '--terminal <string>',\n description:\n 'Launches the Metro Bundler in a new window using the specified terminal path.',\n default: getDefaultUserTerminal(),\n },\n {\n name: '--binary-path <string>',\n description:\n 'Path relative to project root where pre-built .app binary lives.',\n },\n {\n name: '--list-devices',\n description: `List all available ${readableName} devices and simulators and let you choose one to run the app. `,\n },\n {\n name: '--udid <string>',\n description: 'Explicitly set the device to use by UDID',\n },\n !isMac && {\n name: '--simulator <string>',\n description:\n `Explicitly set the simulator to use. Optionally set the ${readableName} version ` +\n 'between parentheses at the end to match an exact version: ' +\n '\"iPhone 15 (17.0)\"',\n },\n !isMac && {\n name: '--device [string]', // here we're intentionally using [] over <> to make passed value optional to allow users to run only on physical devices\n description:\n 'Explicitly set the device to use by name. If the value is not provided,' +\n 'the app will run on the first available physical device.',\n },\n ...getBuildOptions({platformName}),\n ];\n};\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AAEO,MAAMA,aAAa,GAAG,CAAC;EAACC;AAA4B,CAAC,KAAK;EAC/D,MAAM;IAACC;EAAY,CAAC,GAAG,IAAAC,gCAAe,EAACF,YAAY,CAAC;EACpD,MAAMG,KAAK,GAAGH,YAAY,KAAK,OAAO;EACtC,OAAO,CACL;IACEI,IAAI,EAAE,eAAe;IACrBC,WAAW,EAAE;EACf,CAAC,EACD;IACED,IAAI,EAAE,iBAAiB;IACvBE,OAAO,EAAEC,OAAO,CAACC,GAAG,CAACC,cAAc,IAAI,IAAI;IAC3CC,KAAK,EAAEC;EACT,CAAC,EACD;IACEP,IAAI,EAAE,qBAAqB;IAC3BC,WAAW,EACT,+EAA+E;IACjFC,OAAO,EAAE,IAAAM,kCAAsB;EACjC,CAAC,EACD;IACER,IAAI,EAAE,wBAAwB;IAC9BC,WAAW,EACT;EACJ,CAAC,EACD;IACED,IAAI,EAAE,gBAAgB;IACtBC,WAAW,EAAG,sBAAqBJ,YAAa;EAClD,CAAC,EACD;IACEG,IAAI,EAAE,iBAAiB;IACvBC,WAAW,EAAE;EACf,CAAC,EACD,CAACF,KAAK,IAAI;IACRC,IAAI,EAAE,sBAAsB;IAC5BC,WAAW,EACR,2DAA0DJ,YAAa,WAAU,GAClF,4DAA4D,GAC5D;EACJ,CAAC,EACD,CAACE,KAAK,IAAI;IACRC,IAAI,EAAE,mBAAmB;IAAE;IAC3BC,WAAW,EACT,yEAAyE,GACzE;EACJ,CAAC,EACD,GAAG,IAAAQ,6BAAe,EAAC;IAACb;EAAY,CAAC,CAAC,CACnC;AACH,CAAC;AAAC"}

View File

@@ -0,0 +1,26 @@
export declare const projectWithPodfileOnly: {
ios: {};
};
export declare const project: {
ios: {
Podfile: string;
'demoProject.xcodeproj': {
'project.pbxproj': any;
};
};
};
export declare const withExamples: {
Examples: {
Podfile: string;
'exampleProject.xcodeproj': {
'project.pbxproj': any;
};
};
ios: {
Podfile: string;
'demoProject.xcodeproj': {
'project.pbxproj': any;
};
};
};
//# sourceMappingURL=projects.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../../src/config/__fixtures__/projects.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB;;CAElC,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;CASnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAUxB,CAAC"}

View File

@@ -0,0 +1,2 @@
export default function findAllPodfilePaths(cwd: string): string[];
//# sourceMappingURL=findAllPodfilePaths.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"findAllPodfilePaths.d.ts","sourceRoot":"","sources":["../../src/config/findAllPodfilePaths.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,GAAG,EAAE,MAAM,YAKtD"}

View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = findAllPodfilePaths;
function _fastGlob() {
const data = _interopRequireDefault(require("fast-glob"));
_fastGlob = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// These folders will be excluded from search to speed it up
const GLOB_EXCLUDE_PATTERN = ['**/@(Pods|node_modules|Carthage|vendor)/**'];
function findAllPodfilePaths(cwd) {
return _fastGlob().default.sync('**/Podfile', {
cwd: (0, _cliTools().unixifyPaths)(cwd),
ignore: GLOB_EXCLUDE_PATTERN
});
}
//# sourceMappingURL=findAllPodfilePaths.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["GLOB_EXCLUDE_PATTERN","findAllPodfilePaths","cwd","glob","sync","unixifyPaths","ignore"],"sources":["../../src/config/findAllPodfilePaths.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport glob from 'fast-glob';\nimport {unixifyPaths} from '@react-native-community/cli-tools';\n\n// These folders will be excluded from search to speed it up\nconst GLOB_EXCLUDE_PATTERN = ['**/@(Pods|node_modules|Carthage|vendor)/**'];\n\nexport default function findAllPodfilePaths(cwd: string) {\n return glob.sync('**/Podfile', {\n cwd: unixifyPaths(cwd),\n ignore: GLOB_EXCLUDE_PATTERN,\n });\n}\n"],"mappings":";;;;;;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA+D;AAR/D;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA,MAAMA,oBAAoB,GAAG,CAAC,4CAA4C,CAAC;AAE5D,SAASC,mBAAmB,CAACC,GAAW,EAAE;EACvD,OAAOC,mBAAI,CAACC,IAAI,CAAC,YAAY,EAAE;IAC7BF,GAAG,EAAE,IAAAG,wBAAY,EAACH,GAAG,CAAC;IACtBI,MAAM,EAAEN;EACV,CAAC,CAAC;AACJ"}

View File

@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import { ApplePlatform } from '../types';
export default function findPodfilePath(cwd: string, platformName: ApplePlatform): string | null;
//# sourceMappingURL=findPodfilePath.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"findPodfilePath.d.ts","sourceRoot":"","sources":["../../src/config/findPodfilePath.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AASvC,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,aAAa,iBAkD5B"}

View File

@@ -0,0 +1,77 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = findPodfilePath;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
var _findAllPodfilePaths = _interopRequireDefault(require("./findAllPodfilePaths"));
var _supportedPlatforms = require("./supportedPlatforms");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// Regexp matching all test projects
const TEST_PROJECTS = /test|example|sample/i;
// Podfile in the bundle package
const BUNDLE_VENDORED_PODFILE = 'vendor/bundle/ruby';
function findPodfilePath(cwd, platformName) {
const podfiles = (0, _findAllPodfilePaths.default)(cwd)
/**
* Then, we will run a simple test to rule out most example projects,
* unless they are located in a `platformName` folder
*/.filter(project => {
if (_path().default.dirname(project) === platformName) {
// Pick the Podfile in the default project (in the iOS folder)
return true;
}
if (TEST_PROJECTS.test(project)) {
// Ignore the Podfile in test and example projects
return false;
}
if (project.indexOf(BUNDLE_VENDORED_PODFILE) > -1) {
// Ignore the podfile shipped with Cocoapods in bundle
return false;
}
// Accept all the others
return true;
})
/**
* Podfile from `platformName` folder will be picked up as a first one.
*/.sort(project => _path().default.dirname(project) === platformName ? -1 : 1);
const supportedPlatformsArray = Object.values(_supportedPlatforms.supportedPlatforms);
const containsUnsupportedPodfiles = podfiles.every(podfile => !supportedPlatformsArray.includes(podfile.split('/')[0]));
if (podfiles.length > 0) {
if (podfiles.length > 1 && containsUnsupportedPodfiles) {
_cliTools().logger.warn((0, _cliTools().inlineString)(`
Multiple Podfiles were found: ${podfiles}. Choosing ${podfiles[0]} automatically.
If you would like to select a different one, you can configure it via "project.${platformName}.sourceDir".
You can learn more about it here: https://github.com/react-native-community/cli/blob/main/docs/configuration.md
`));
}
return _path().default.join(cwd, podfiles[0]);
}
return null;
}
//# sourceMappingURL=findPodfilePath.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["TEST_PROJECTS","BUNDLE_VENDORED_PODFILE","findPodfilePath","cwd","platformName","podfiles","findAllPodfilePaths","filter","project","path","dirname","test","indexOf","sort","supportedPlatformsArray","Object","values","supportedPlatforms","containsUnsupportedPodfiles","every","podfile","includes","split","length","logger","warn","inlineString","join"],"sources":["../../src/config/findPodfilePath.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport {inlineString, logger} from '@react-native-community/cli-tools';\nimport path from 'path';\nimport findAllPodfilePaths from './findAllPodfilePaths';\nimport {ApplePlatform} from '../types';\nimport {supportedPlatforms} from './supportedPlatforms';\n\n// Regexp matching all test projects\nconst TEST_PROJECTS = /test|example|sample/i;\n\n// Podfile in the bundle package\nconst BUNDLE_VENDORED_PODFILE = 'vendor/bundle/ruby';\n\nexport default function findPodfilePath(\n cwd: string,\n platformName: ApplePlatform,\n) {\n const podfiles = findAllPodfilePaths(cwd)\n /**\n * Then, we will run a simple test to rule out most example projects,\n * unless they are located in a `platformName` folder\n */\n .filter((project) => {\n if (path.dirname(project) === platformName) {\n // Pick the Podfile in the default project (in the iOS folder)\n return true;\n }\n\n if (TEST_PROJECTS.test(project)) {\n // Ignore the Podfile in test and example projects\n return false;\n }\n\n if (project.indexOf(BUNDLE_VENDORED_PODFILE) > -1) {\n // Ignore the podfile shipped with Cocoapods in bundle\n return false;\n }\n\n // Accept all the others\n return true;\n })\n /**\n * Podfile from `platformName` folder will be picked up as a first one.\n */\n .sort((project) => (path.dirname(project) === platformName ? -1 : 1));\n\n const supportedPlatformsArray: string[] = Object.values(supportedPlatforms);\n const containsUnsupportedPodfiles = podfiles.every(\n (podfile) => !supportedPlatformsArray.includes(podfile.split('/')[0]),\n );\n\n if (podfiles.length > 0) {\n if (podfiles.length > 1 && containsUnsupportedPodfiles) {\n logger.warn(\n inlineString(`\n Multiple Podfiles were found: ${podfiles}. Choosing ${podfiles[0]} automatically.\n If you would like to select a different one, you can configure it via \"project.${platformName}.sourceDir\".\n You can learn more about it here: https://github.com/react-native-community/cli/blob/main/docs/configuration.md\n `),\n );\n }\n return path.join(cwd, podfiles[0]);\n }\n\n return null;\n}\n"],"mappings":";;;;;;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAEA;AAAwD;AAZxD;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA,MAAMA,aAAa,GAAG,sBAAsB;;AAE5C;AACA,MAAMC,uBAAuB,GAAG,oBAAoB;AAErC,SAASC,eAAe,CACrCC,GAAW,EACXC,YAA2B,EAC3B;EACA,MAAMC,QAAQ,GAAG,IAAAC,4BAAmB,EAACH,GAAG;EACtC;AACJ;AACA;AACA,KAHI,CAICI,MAAM,CAAEC,OAAO,IAAK;IACnB,IAAIC,eAAI,CAACC,OAAO,CAACF,OAAO,CAAC,KAAKJ,YAAY,EAAE;MAC1C;MACA,OAAO,IAAI;IACb;IAEA,IAAIJ,aAAa,CAACW,IAAI,CAACH,OAAO,CAAC,EAAE;MAC/B;MACA,OAAO,KAAK;IACd;IAEA,IAAIA,OAAO,CAACI,OAAO,CAACX,uBAAuB,CAAC,GAAG,CAAC,CAAC,EAAE;MACjD;MACA,OAAO,KAAK;IACd;;IAEA;IACA,OAAO,IAAI;EACb,CAAC;EACD;AACJ;AACA,KAFI,CAGCY,IAAI,CAAEL,OAAO,IAAMC,eAAI,CAACC,OAAO,CAACF,OAAO,CAAC,KAAKJ,YAAY,GAAG,CAAC,CAAC,GAAG,CAAE,CAAC;EAEvE,MAAMU,uBAAiC,GAAGC,MAAM,CAACC,MAAM,CAACC,sCAAkB,CAAC;EAC3E,MAAMC,2BAA2B,GAAGb,QAAQ,CAACc,KAAK,CAC/CC,OAAO,IAAK,CAACN,uBAAuB,CAACO,QAAQ,CAACD,OAAO,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CACtE;EAED,IAAIjB,QAAQ,CAACkB,MAAM,GAAG,CAAC,EAAE;IACvB,IAAIlB,QAAQ,CAACkB,MAAM,GAAG,CAAC,IAAIL,2BAA2B,EAAE;MACtDM,kBAAM,CAACC,IAAI,CACT,IAAAC,wBAAY,EAAE;AACtB,0CAA0CrB,QAAS,cAAaA,QAAQ,CAAC,CAAC,CAAE;AAC5E,2FAA2FD,YAAa;AACxG;AACA,SAAS,CAAC,CACH;IACH;IACA,OAAOK,eAAI,CAACkB,IAAI,CAACxB,GAAG,EAAEE,QAAQ,CAAC,CAAC,CAAC,CAAC;EACpC;EAEA,OAAO,IAAI;AACb"}

View File

@@ -0,0 +1,2 @@
export default function findPodspec(folder: string): string | null;
//# sourceMappingURL=findPodspec.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"findPodspec.d.ts","sourceRoot":"","sources":["../../src/config/findPodspec.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAajE"}

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = findPodspec;
function _fastGlob() {
const data = _interopRequireDefault(require("fast-glob"));
_fastGlob = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function findPodspec(folder) {
const podspecs = _fastGlob().default.sync('*.podspec', {
cwd: (0, _cliTools().unixifyPaths)(folder)
});
if (podspecs.length === 0) {
return null;
}
const packagePodspec = _path().default.basename(folder) + '.podspec';
const podspecFile = podspecs.includes(packagePodspec) ? packagePodspec : podspecs[0];
return _path().default.join(folder, podspecFile);
}
//# sourceMappingURL=findPodspec.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["findPodspec","folder","podspecs","glob","sync","cwd","unixifyPaths","length","packagePodspec","path","basename","podspecFile","includes","join"],"sources":["../../src/config/findPodspec.ts"],"sourcesContent":["import glob from 'fast-glob';\nimport path from 'path';\nimport {unixifyPaths} from '@react-native-community/cli-tools';\n\nexport default function findPodspec(folder: string): string | null {\n const podspecs = glob.sync('*.podspec', {cwd: unixifyPaths(folder)});\n\n if (podspecs.length === 0) {\n return null;\n }\n\n const packagePodspec = path.basename(folder) + '.podspec';\n const podspecFile = podspecs.includes(packagePodspec)\n ? packagePodspec\n : podspecs[0];\n\n return path.join(folder, podspecFile);\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA+D;AAEhD,SAASA,WAAW,CAACC,MAAc,EAAiB;EACjE,MAAMC,QAAQ,GAAGC,mBAAI,CAACC,IAAI,CAAC,WAAW,EAAE;IAACC,GAAG,EAAE,IAAAC,wBAAY,EAACL,MAAM;EAAC,CAAC,CAAC;EAEpE,IAAIC,QAAQ,CAACK,MAAM,KAAK,CAAC,EAAE;IACzB,OAAO,IAAI;EACb;EAEA,MAAMC,cAAc,GAAGC,eAAI,CAACC,QAAQ,CAACT,MAAM,CAAC,GAAG,UAAU;EACzD,MAAMU,WAAW,GAAGT,QAAQ,CAACU,QAAQ,CAACJ,cAAc,CAAC,GACjDA,cAAc,GACdN,QAAQ,CAAC,CAAC,CAAC;EAEf,OAAOO,eAAI,CAACI,IAAI,CAACZ,MAAM,EAAEU,WAAW,CAAC;AACvC"}

View File

@@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import { IOSProjectInfo } from '@react-native-community/cli-types';
declare function findXcodeProject(files: Array<string>): IOSProjectInfo | null;
export default findXcodeProject;
//# sourceMappingURL=findXcodeProject.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"findXcodeProject.d.ts","sourceRoot":"","sources":["../../src/config/findXcodeProject.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAEjE,iBAAS,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,cAAc,GAAG,IAAI,CAsBrE;AAED,eAAe,gBAAgB,CAAC"}

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function findXcodeProject(files) {
const sortedFiles = files.sort();
for (let i = sortedFiles.length - 1; i >= 0; i--) {
const fileName = files[i];
const ext = _path().default.extname(fileName);
if (ext === '.xcworkspace') {
return {
name: fileName,
isWorkspace: true
};
}
if (ext === '.xcodeproj') {
return {
name: fileName,
isWorkspace: false
};
}
}
return null;
}
var _default = findXcodeProject;
exports.default = _default;
//# sourceMappingURL=findXcodeProject.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["findXcodeProject","files","sortedFiles","sort","i","length","fileName","ext","path","extname","name","isWorkspace"],"sources":["../../src/config/findXcodeProject.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport path from 'path';\nimport {IOSProjectInfo} from '@react-native-community/cli-types';\n\nfunction findXcodeProject(files: Array<string>): IOSProjectInfo | null {\n const sortedFiles = files.sort();\n\n for (let i = sortedFiles.length - 1; i >= 0; i--) {\n const fileName = files[i];\n const ext = path.extname(fileName);\n\n if (ext === '.xcworkspace') {\n return {\n name: fileName,\n isWorkspace: true,\n };\n }\n if (ext === '.xcodeproj') {\n return {\n name: fileName,\n isWorkspace: false,\n };\n }\n }\n\n return null;\n}\n\nexport default findXcodeProject;\n"],"mappings":";;;;;;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwB;AARxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASA,gBAAgB,CAACC,KAAoB,EAAyB;EACrE,MAAMC,WAAW,GAAGD,KAAK,CAACE,IAAI,EAAE;EAEhC,KAAK,IAAIC,CAAC,GAAGF,WAAW,CAACG,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAChD,MAAME,QAAQ,GAAGL,KAAK,CAACG,CAAC,CAAC;IACzB,MAAMG,GAAG,GAAGC,eAAI,CAACC,OAAO,CAACH,QAAQ,CAAC;IAElC,IAAIC,GAAG,KAAK,cAAc,EAAE;MAC1B,OAAO;QACLG,IAAI,EAAEJ,QAAQ;QACdK,WAAW,EAAE;MACf,CAAC;IACH;IACA,IAAIJ,GAAG,KAAK,YAAY,EAAE;MACxB,OAAO;QACLG,IAAI,EAAEJ,QAAQ;QACdK,WAAW,EAAE;MACf,CAAC;IACH;EACF;EAEA,OAAO,IAAI;AACb;AAAC,eAEcX,gBAAgB;AAAA"}

View File

@@ -0,0 +1,14 @@
import findAllPodfilePaths from './findAllPodfilePaths';
import { IOSProjectParams, IOSDependencyParams, IOSProjectConfig, IOSDependencyConfig } from '@react-native-community/cli-types';
import { BuilderCommand } from '../types';
/**
* Returns project config by analyzing given folder and applying some user defaults
* when constructing final object
*/
export declare const getProjectConfig: ({ platformName }: BuilderCommand) => (folder: string, userConfig: IOSProjectParams) => IOSProjectConfig | null;
/**
* Make getDependencyConfig follow the same pattern as getProjectConfig
*/
export declare const getDependencyConfig: ({}: BuilderCommand) => (folder: string, userConfig?: IOSDependencyParams | null) => IOSDependencyConfig | null;
export declare const findPodfilePaths: typeof findAllPodfilePaths;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAaA,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,qBACV,cAAc,cACtB,MAAM,cAAc,gBAAgB,KAAG,gBAAgB,GAAG,IAiClE,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,mBAAmB,OACzB,cAAc,cAET,MAAM,eACF,mBAAmB,GAAG,IAAI,KACrC,mBAAmB,GAAG,IAiCxB,CAAC;AAEJ,eAAO,MAAM,gBAAgB,4BAAsB,CAAC"}

View File

@@ -0,0 +1,115 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getProjectConfig = exports.getDependencyConfig = exports.findPodfilePaths = void 0;
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
var _findPodfilePath = _interopRequireDefault(require("./findPodfilePath"));
var _findXcodeProject = _interopRequireDefault(require("./findXcodeProject"));
var _findPodspec = _interopRequireDefault(require("./findPodspec"));
var _findAllPodfilePaths = _interopRequireDefault(require("./findAllPodfilePaths"));
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/**
* Returns project config by analyzing given folder and applying some user defaults
* when constructing final object
*/
const getProjectConfig = ({
platformName
}) => (folder, userConfig) => {
if (!userConfig) {
return null;
}
const src = _path().default.join(folder, userConfig.sourceDir ?? '');
const podfile = (0, _findPodfilePath.default)(src, platformName);
/**
* In certain repos, the Xcode project can be generated by a tool.
* The only file that we can assume to exist on disk is `Podfile`.
*/
if (!podfile) {
return null;
}
const sourceDir = _path().default.dirname(podfile);
const xcodeProject = (0, _findXcodeProject.default)(_fs().default.readdirSync(sourceDir));
// @ts-ignore @todo remove for RN 0.75
if (userConfig.unstable_reactLegacyComponentNames) {
_cliTools().logger.warn('The "project.ios.unstable_reactLegacyComponentNames" config option is not necessary anymore for React Native 0.74 and does nothing. Please remove it from the "react-native.config.js" file.');
}
return {
sourceDir,
watchModeCommandParams: userConfig.watchModeCommandParams,
xcodeProject,
automaticPodsInstallation: userConfig.automaticPodsInstallation
};
};
/**
* Make getDependencyConfig follow the same pattern as getProjectConfig
*/
exports.getProjectConfig = getProjectConfig;
const getDependencyConfig = ({}) => (folder, userConfig = {}) => {
if (userConfig === null) {
return null;
}
const podspecPath = (0, _findPodspec.default)(folder);
if (!podspecPath) {
return null;
}
let version = 'unresolved';
try {
const packageJson = require(_path().default.join(folder, 'package.json'));
if (packageJson.version) {
version = packageJson.version;
}
} catch {
throw new (_cliTools().CLIError)(`Failed to locate package.json file from ${_chalk().default.underline(folder)}. This is most likely issue with your node_modules folder being corrupted. Please force install dependencies and try again`);
}
return {
podspecPath,
version,
configurations: userConfig.configurations || [],
scriptPhases: userConfig.scriptPhases || []
};
};
exports.getDependencyConfig = getDependencyConfig;
const findPodfilePaths = _findAllPodfilePaths.default;
exports.findPodfilePaths = findPodfilePaths;
//# sourceMappingURL=index.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
export declare const supportedPlatforms: {
readonly ios: "ios";
readonly macos: "macos";
readonly visionos: "visionos";
readonly tvos: "tvos";
};
//# sourceMappingURL=supportedPlatforms.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"supportedPlatforms.d.ts","sourceRoot":"","sources":["../../src/config/supportedPlatforms.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC"}

Some files were not shown because too many files have changed in this diff Show More