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,2 @@
export declare function checkIfConfigurationExists(configurations: string[], mode: string): void;
//# sourceMappingURL=checkIfConfigurationExists.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"checkIfConfigurationExists.d.ts","sourceRoot":"","sources":["../../src/tools/checkIfConfigurationExists.ts"],"names":[],"mappings":"AAEA,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,EAAE,EACxB,IAAI,EAAE,MAAM,QAcb"}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.checkIfConfigurationExists = checkIfConfigurationExists;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function checkIfConfigurationExists(configurations, mode) {
if (configurations.length === 0) {
_cliTools().logger.warn(`Unable to check whether "${mode}" exists in your project`);
return;
}
if (!configurations.includes(mode)) {
throw new (_cliTools().CLIError)(`Configuration "${mode}" does not exist in your project. Please use one of the existing configurations: ${configurations.join(', ')}`);
}
}
//# sourceMappingURL=checkIfConfigurationExists.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["checkIfConfigurationExists","configurations","mode","length","logger","warn","includes","CLIError","join"],"sources":["../../src/tools/checkIfConfigurationExists.ts"],"sourcesContent":["import {CLIError, logger} from '@react-native-community/cli-tools';\n\nexport function checkIfConfigurationExists(\n configurations: string[],\n mode: string,\n) {\n if (configurations.length === 0) {\n logger.warn(`Unable to check whether \"${mode}\" exists in your project`);\n return;\n }\n\n if (!configurations.includes(mode)) {\n throw new CLIError(\n `Configuration \"${mode}\" does not exist in your project. Please use one of the existing configurations: ${configurations.join(\n ', ',\n )}`,\n );\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,SAASA,0BAA0B,CACxCC,cAAwB,EACxBC,IAAY,EACZ;EACA,IAAID,cAAc,CAACE,MAAM,KAAK,CAAC,EAAE;IAC/BC,kBAAM,CAACC,IAAI,CAAE,4BAA2BH,IAAK,0BAAyB,CAAC;IACvE;EACF;EAEA,IAAI,CAACD,cAAc,CAACK,QAAQ,CAACJ,IAAI,CAAC,EAAE;IAClC,MAAM,KAAIK,oBAAQ,EACf,kBAAiBL,IAAK,oFAAmFD,cAAc,CAACO,IAAI,CAC3H,IAAI,CACJ,EAAC,CACJ;EACH;AACF"}

View File

@@ -0,0 +1,37 @@
/**
* 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 { Device } from '../types';
/**
* Takes in a parsed simulator list and a desired name, and returns an object with the matching simulator. The desired
* name can optionally include the iOS version in between parenthesis after the device name. Ex: "iPhone 6 (9.2)" in
* which case it'll attempt to find a simulator with the exact version specified.
*
* If the simulatorString argument is null, we'll go into default mode and return the currently booted simulator,
* the last booted simulator or
* if none is booted, it will be the first in the list.
*
* @param simulators a parsed list from `xcrun simctl list --json devices` command
* @param findOptions null or an object containing:
* ```
* {
* simulator: name of desired simulator
* udid: udid of desired simulator
* }
* ```
* If null, it will use the currently booted simulator, or if none are booted, the first in the list.
*/
declare function findMatchingSimulator(simulators: {
devices: {
[index: string]: Array<Device>;
};
}, findOptions?: null | {
simulator?: string;
udid?: string;
}): Device | null;
export default findMatchingSimulator;
//# sourceMappingURL=findMatchingSimulator.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"findMatchingSimulator.d.ts","sourceRoot":"","sources":["../../src/tools/findMatchingSimulator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,qBAAqB,CAC5B,UAAU,EAAE;IAAC,OAAO,EAAE;QAAC,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;KAAC,CAAA;CAAC,EACvD,WAAW,CAAC,EAAE,IAAI,GAAG;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,iBA2FzD;AAED,eAAe,qBAAqB,CAAC"}

View File

@@ -0,0 +1,110 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* 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.
*
*/
/**
* Takes in a parsed simulator list and a desired name, and returns an object with the matching simulator. The desired
* name can optionally include the iOS version in between parenthesis after the device name. Ex: "iPhone 6 (9.2)" in
* which case it'll attempt to find a simulator with the exact version specified.
*
* If the simulatorString argument is null, we'll go into default mode and return the currently booted simulator,
* the last booted simulator or
* if none is booted, it will be the first in the list.
*
* @param simulators a parsed list from `xcrun simctl list --json devices` command
* @param findOptions null or an object containing:
* ```
* {
* simulator: name of desired simulator
* udid: udid of desired simulator
* }
* ```
* If null, it will use the currently booted simulator, or if none are booted, the first in the list.
*/
function findMatchingSimulator(simulators, findOptions) {
if (!simulators.devices) {
return null;
}
const devices = simulators.devices;
let simulatorVersion;
let simulatorName = null;
if (findOptions && findOptions.simulator) {
const parsedSimulatorName = findOptions.simulator.match(/(.*)? (?:\((\d+\.\d+)?\))$/);
if (parsedSimulatorName && parsedSimulatorName[2] !== undefined) {
simulatorVersion = parsedSimulatorName[2];
simulatorName = parsedSimulatorName[1];
} else {
simulatorName = findOptions.simulator;
}
}
let match;
let fallbackMatch;
const sortedDevices = Object.fromEntries(Object.entries(devices).sort((a, b) => Number(b[0].includes('iOS')) - Number(a[0].includes('iOS'))));
for (const versionDescriptor in sortedDevices) {
const device = sortedDevices[versionDescriptor];
let version = versionDescriptor;
if (/^com\.apple\.CoreSimulator\.SimRuntime\./g.test(version)) {
// Transform "com.apple.CoreSimulator.SimRuntime.iOS-12-2" into "iOS 12.2"
version = version.replace(/^com\.apple\.CoreSimulator\.SimRuntime\.([^-]+)-([^-]+)-([^-]+)$/g, '$1 $2.$3');
}
// Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc)
if (!version.includes('iOS') && !version.includes('tvOS')) {
continue;
}
if (simulatorVersion && !version.endsWith(simulatorVersion)) {
continue;
}
for (const i in device) {
const simulator = device[i];
// Skipping non-available simulator
if (simulator.availability !== '(available)' &&
// @ts-ignore verify isAvailable parameter
simulator.isAvailable !== 'YES' && simulator.isAvailable !== true) {
continue;
}
const lastBootedAt = simulator.lastBootedAt;
const simulatorDescriptor = {
udid: simulator.udid,
name: simulator.name,
state: simulator.state,
version
};
if (findOptions && findOptions.udid) {
if (simulator.udid === findOptions.udid) {
return simulatorDescriptor;
}
} else {
if (simulator.state === 'Booted' && simulatorName === null) {
return simulatorDescriptor;
}
if (simulator.name === simulatorName && !match) {
match = simulatorDescriptor;
}
// If no match found, use first available simulator that was booted before
if (!!lastBootedAt && !match) {
fallbackMatch = simulatorDescriptor;
}
// Keeps track of the first available simulator for use if we can't find one above.
if (simulatorName === null && !match) {
match = simulatorDescriptor;
}
}
}
}
return match ?? fallbackMatch ?? null;
}
var _default = findMatchingSimulator;
exports.default = _default;
//# sourceMappingURL=findMatchingSimulator.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
export default function getArchitecture(iosSourceDir: string): Promise<boolean>;
//# sourceMappingURL=getArchitecture.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getArchitecture.d.ts","sourceRoot":"","sources":["../../src/tools/getArchitecture.ts"],"names":[],"mappings":"AAGA,wBAA8B,eAAe,CAAC,YAAY,EAAE,MAAM,oBAUjE"}

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getArchitecture;
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = 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 getArchitecture(iosSourceDir) {
try {
const project = await (0, _fsExtra().readFile)(_path().default.join(iosSourceDir, '/Pods/Pods.xcodeproj/project.pbxproj'));
return project.includes('-DRCT_NEW_ARCH_ENABLED=1');
} catch {
return false;
}
}
//# sourceMappingURL=getArchitecture.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getArchitecture","iosSourceDir","project","readFile","path","join","includes"],"sources":["../../src/tools/getArchitecture.ts"],"sourcesContent":["import {readFile} from 'fs-extra';\nimport path from 'path';\n\nexport default async function getArchitecture(iosSourceDir: string) {\n try {\n const project = await readFile(\n path.join(iosSourceDir, '/Pods/Pods.xcodeproj/project.pbxproj'),\n );\n\n return project.includes('-DRCT_NEW_ARCH_ENABLED=1');\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwB;AAET,eAAeA,eAAe,CAACC,YAAoB,EAAE;EAClE,IAAI;IACF,MAAMC,OAAO,GAAG,MAAM,IAAAC,mBAAQ,EAC5BC,eAAI,CAACC,IAAI,CAACJ,YAAY,EAAE,sCAAsC,CAAC,CAChE;IAED,OAAOC,OAAO,CAACI,QAAQ,CAAC,0BAA0B,CAAC;EACrD,CAAC,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF"}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"getBuildConfigurationFromXcScheme.d.ts","sourceRoot":"","sources":["../../src/tools/getBuildConfigurationFromXcScheme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAIjC,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,OAAO,GAAG,SAAS,GAC/B,MAAM,CAwCR"}

View File

@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBuildConfigurationFromXcScheme = getBuildConfigurationFromXcScheme;
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 _fastXmlParser() {
const data = require("fast-xml-parser");
_fastXmlParser = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = 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 }; }
const xmlParser = new (_fastXmlParser().XMLParser)({
ignoreAttributes: false
});
function getBuildConfigurationFromXcScheme(scheme, configuration, sourceDir, projectInfo) {
// can not assume .xcodeproj exists.
// for more info see: https://github.com/react-native-community/cli/pull/2196
try {
const xcProject = _fs().default.readdirSync(sourceDir).find(dir => dir.endsWith('.xcodeproj'));
if (xcProject) {
const xmlScheme = _fs().default.readFileSync(_path().default.join(sourceDir, xcProject, 'xcshareddata', 'xcschemes', `${scheme}.xcscheme`), {
encoding: 'utf-8'
});
const {
Scheme
} = xmlParser.parse(xmlScheme);
return Scheme.LaunchAction['@_buildConfiguration'];
}
} catch {
const availableSchemas = projectInfo && projectInfo.schemes && projectInfo.schemes.length > 0 ? `Available schemas are: ${projectInfo.schemes.map(name => _chalk().default.bold(name)).join(', ')}'` : '';
throw new (_cliTools().CLIError)(`Could not find scheme ${scheme}. Please make sure the schema you want to run exists. ${availableSchemas}`);
}
return configuration;
}
//# sourceMappingURL=getBuildConfigurationFromXcScheme.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["xmlParser","XMLParser","ignoreAttributes","getBuildConfigurationFromXcScheme","scheme","configuration","sourceDir","projectInfo","xcProject","fs","readdirSync","find","dir","endsWith","xmlScheme","readFileSync","path","join","encoding","Scheme","parse","LaunchAction","availableSchemas","schemes","length","map","name","chalk","bold","CLIError"],"sources":["../../src/tools/getBuildConfigurationFromXcScheme.ts"],"sourcesContent":["import {CLIError} from '@react-native-community/cli-tools';\nimport chalk from 'chalk';\nimport {XMLParser} from 'fast-xml-parser';\nimport fs from 'fs';\nimport path from 'path';\nimport {IosInfo} from '../types';\n\nconst xmlParser = new XMLParser({ignoreAttributes: false});\n\nexport function getBuildConfigurationFromXcScheme(\n scheme: string,\n configuration: string,\n sourceDir: string,\n projectInfo: IosInfo | undefined,\n): string {\n // can not assume .xcodeproj exists.\n // for more info see: https://github.com/react-native-community/cli/pull/2196\n try {\n const xcProject = fs\n .readdirSync(sourceDir)\n .find((dir) => dir.endsWith('.xcodeproj'));\n\n if (xcProject) {\n const xmlScheme = fs.readFileSync(\n path.join(\n sourceDir,\n xcProject,\n 'xcshareddata',\n 'xcschemes',\n `${scheme}.xcscheme`,\n ),\n {\n encoding: 'utf-8',\n },\n );\n\n const {Scheme} = xmlParser.parse(xmlScheme);\n\n return Scheme.LaunchAction['@_buildConfiguration'];\n }\n } catch {\n const availableSchemas =\n projectInfo && projectInfo.schemes && projectInfo.schemes.length > 0\n ? `Available schemas are: ${projectInfo.schemes\n .map((name) => chalk.bold(name))\n .join(', ')}'`\n : '';\n\n throw new CLIError(\n `Could not find scheme ${scheme}. Please make sure the schema you want to run exists. ${availableSchemas}`,\n );\n }\n\n return configuration;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwB;AAGxB,MAAMA,SAAS,GAAG,KAAIC,0BAAS,EAAC;EAACC,gBAAgB,EAAE;AAAK,CAAC,CAAC;AAEnD,SAASC,iCAAiC,CAC/CC,MAAc,EACdC,aAAqB,EACrBC,SAAiB,EACjBC,WAAgC,EACxB;EACR;EACA;EACA,IAAI;IACF,MAAMC,SAAS,GAAGC,aAAE,CACjBC,WAAW,CAACJ,SAAS,CAAC,CACtBK,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAE5C,IAAIL,SAAS,EAAE;MACb,MAAMM,SAAS,GAAGL,aAAE,CAACM,YAAY,CAC/BC,eAAI,CAACC,IAAI,CACPX,SAAS,EACTE,SAAS,EACT,cAAc,EACd,WAAW,EACV,GAAEJ,MAAO,WAAU,CACrB,EACD;QACEc,QAAQ,EAAE;MACZ,CAAC,CACF;MAED,MAAM;QAACC;MAAM,CAAC,GAAGnB,SAAS,CAACoB,KAAK,CAACN,SAAS,CAAC;MAE3C,OAAOK,MAAM,CAACE,YAAY,CAAC,sBAAsB,CAAC;IACpD;EACF,CAAC,CAAC,MAAM;IACN,MAAMC,gBAAgB,GACpBf,WAAW,IAAIA,WAAW,CAACgB,OAAO,IAAIhB,WAAW,CAACgB,OAAO,CAACC,MAAM,GAAG,CAAC,GAC/D,0BAAyBjB,WAAW,CAACgB,OAAO,CAC1CE,GAAG,CAAEC,IAAI,IAAKC,gBAAK,CAACC,IAAI,CAACF,IAAI,CAAC,CAAC,CAC/BT,IAAI,CAAC,IAAI,CAAE,GAAE,GAChB,EAAE;IAER,MAAM,KAAIY,oBAAQ,EACf,yBAAwBzB,MAAO,yDAAwDkB,gBAAiB,EAAC,CAC3G;EACH;EAEA,OAAOjB,aAAa;AACtB"}

View File

@@ -0,0 +1,8 @@
import { Device } from '../types';
type FlagsT = {
simulator?: string;
udid?: string;
};
export declare function getDestinationSimulator(args: FlagsT, fallbackSimulators?: string[]): Device;
export {};
//# sourceMappingURL=getDestinationSimulator.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getDestinationSimulator.d.ts","sourceRoot":"","sources":["../../src/tools/getDestinationSimulator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,KAAK,MAAM,GAAG;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,kBAAkB,GAAE,MAAM,EAAO,UAgClC"}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getDestinationSimulator = getDestinationSimulator;
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 _findMatchingSimulator = _interopRequireDefault(require("./findMatchingSimulator"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getDestinationSimulator(args, fallbackSimulators = []) {
let simulators;
try {
simulators = JSON.parse(_child_process().default.execFileSync('xcrun', ['simctl', 'list', '--json', 'devices'], {
encoding: 'utf8'
}));
} catch (error) {
throw new (_cliTools().CLIError)('Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues.', error);
}
const selectedSimulator = fallbackSimulators.reduce((simulator, fallback) => {
return simulator || (0, _findMatchingSimulator.default)(simulators, {
simulator: fallback
});
}, (0, _findMatchingSimulator.default)(simulators, args));
if (!selectedSimulator) {
throw new (_cliTools().CLIError)(`No simulator available with ${args.simulator ? `name "${args.simulator}"` : `udid "${args.udid}"`}`);
}
return selectedSimulator;
}
//# sourceMappingURL=getDestinationSimulator.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getDestinationSimulator","args","fallbackSimulators","simulators","JSON","parse","child_process","execFileSync","encoding","error","CLIError","selectedSimulator","reduce","simulator","fallback","findMatchingSimulator","udid"],"sources":["../../src/tools/getDestinationSimulator.ts"],"sourcesContent":["import child_process from 'child_process';\nimport {CLIError} from '@react-native-community/cli-tools';\nimport {Device} from '../types';\nimport findMatchingSimulator from './findMatchingSimulator';\n\ntype FlagsT = {\n simulator?: string;\n udid?: string;\n};\n\nexport function getDestinationSimulator(\n args: FlagsT,\n fallbackSimulators: string[] = [],\n) {\n let simulators: {devices: {[index: string]: Array<Device>}};\n try {\n simulators = JSON.parse(\n child_process.execFileSync(\n 'xcrun',\n ['simctl', 'list', '--json', 'devices'],\n {encoding: 'utf8'},\n ),\n );\n } catch (error) {\n throw new CLIError(\n 'Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues.',\n error as Error,\n );\n }\n\n const selectedSimulator = fallbackSimulators.reduce((simulator, fallback) => {\n return (\n simulator || findMatchingSimulator(simulators, {simulator: fallback})\n );\n }, findMatchingSimulator(simulators, args));\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 return selectedSimulator;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAA4D;AAOrD,SAASA,uBAAuB,CACrCC,IAAY,EACZC,kBAA4B,GAAG,EAAE,EACjC;EACA,IAAIC,UAAuD;EAC3D,IAAI;IACFA,UAAU,GAAGC,IAAI,CAACC,KAAK,CACrBC,wBAAa,CAACC,YAAY,CACxB,OAAO,EACP,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EACvC;MAACC,QAAQ,EAAE;IAAM,CAAC,CACnB,CACF;EACH,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,MAAM,KAAIC,oBAAQ,EAChB,6IAA6I,EAC7ID,KAAK,CACN;EACH;EAEA,MAAME,iBAAiB,GAAGT,kBAAkB,CAACU,MAAM,CAAC,CAACC,SAAS,EAAEC,QAAQ,KAAK;IAC3E,OACED,SAAS,IAAI,IAAAE,8BAAqB,EAACZ,UAAU,EAAE;MAACU,SAAS,EAAEC;IAAQ,CAAC,CAAC;EAEzE,CAAC,EAAE,IAAAC,8BAAqB,EAACZ,UAAU,EAAEF,IAAI,CAAC,CAAC;EAE3C,IAAI,CAACU,iBAAiB,EAAE;IACtB,MAAM,KAAID,oBAAQ,EACf,+BACCT,IAAI,CAACY,SAAS,GAAI,SAAQZ,IAAI,CAACY,SAAU,GAAE,GAAI,SAAQZ,IAAI,CAACe,IAAK,GAClE,EAAC,CACH;EACH;EACA,OAAOL,iBAAiB;AAC1B"}

View File

@@ -0,0 +1,3 @@
import { IosInfo } from '../types';
export declare function getInfo(): IosInfo | undefined;
//# sourceMappingURL=getInfo.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getInfo.d.ts","sourceRoot":"","sources":["../../src/tools/getInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAEjC,wBAAgB,OAAO,IAAI,OAAO,GAAG,SAAS,CAwB7C"}

View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getInfo = getInfo;
function _execa() {
const data = _interopRequireDefault(require("execa"));
_execa = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getInfo() {
try {
const value = JSON.parse(_execa().default.sync('xcodebuild', ['-list', '-json']).stdout);
if ('project' in value) {
return value.project;
} else if ('workspace' in value) {
return value.workspace;
}
return undefined;
} catch (error) {
var _ref;
if (((_ref = error) === null || _ref === void 0 ? void 0 : _ref.message) && error.message.includes('xcodebuild: error:')) {
const match = error.message.match(/xcodebuild: error: (.*)/);
const err = match ? match[0] : error;
throw new Error(err);
}
throw new Error(error);
}
}
//# sourceMappingURL=getInfo.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getInfo","value","JSON","parse","execa","sync","stdout","project","workspace","undefined","error","message","includes","match","err","Error"],"sources":["../../src/tools/getInfo.ts"],"sourcesContent":["import execa from 'execa';\nimport {IosInfo} from '../types';\n\nexport function getInfo(): IosInfo | undefined {\n try {\n const value = JSON.parse(\n execa.sync('xcodebuild', ['-list', '-json']).stdout,\n );\n\n if ('project' in value) {\n return value.project;\n } else if ('workspace' in value) {\n return value.workspace;\n }\n\n return undefined;\n } catch (error) {\n if (\n (error as Error)?.message &&\n (error as Error).message.includes('xcodebuild: error:')\n ) {\n const match = (error as Error).message.match(/xcodebuild: error: (.*)/);\n const err = match ? match[0] : error;\n throw new Error(err as any);\n }\n throw new Error(error as any);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0B;AAGnB,SAASA,OAAO,GAAwB;EAC7C,IAAI;IACF,MAAMC,KAAK,GAAGC,IAAI,CAACC,KAAK,CACtBC,gBAAK,CAACC,IAAI,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAACC,MAAM,CACpD;IAED,IAAI,SAAS,IAAIL,KAAK,EAAE;MACtB,OAAOA,KAAK,CAACM,OAAO;IACtB,CAAC,MAAM,IAAI,WAAW,IAAIN,KAAK,EAAE;MAC/B,OAAOA,KAAK,CAACO,SAAS;IACxB;IAEA,OAAOC,SAAS;EAClB,CAAC,CAAC,OAAOC,KAAK,EAAE;IAAA;IACd,IACE,SAACA,KAAK,yCAAN,KAAkBC,OAAO,KACxBD,KAAK,CAAWC,OAAO,CAACC,QAAQ,CAAC,oBAAoB,CAAC,EACvD;MACA,MAAMC,KAAK,GAAIH,KAAK,CAAWC,OAAO,CAACE,KAAK,CAAC,yBAAyB,CAAC;MACvE,MAAMC,GAAG,GAAGD,KAAK,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGH,KAAK;MACpC,MAAM,IAAIK,KAAK,CAACD,GAAG,CAAQ;IAC7B;IACA,MAAM,IAAIC,KAAK,CAACL,KAAK,CAAQ;EAC/B;AACF"}

View File

@@ -0,0 +1,11 @@
import type { Ora } from 'ora';
interface PodInstallOptions {
skipBundleInstall?: boolean;
newArchEnabled?: boolean;
iosFolderPath?: string;
}
declare function installCocoaPods(loader: Ora): Promise<Ora>;
declare function installPods(loader?: Ora, options?: PodInstallOptions): Promise<void>;
export { installCocoaPods };
export default installPods;
//# sourceMappingURL=installPods.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"installPods.d.ts","sourceRoot":"","sources":["../../src/tools/installPods.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAW7B,UAAU,iBAAiB;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAuFD,iBAAe,gBAAgB,CAAC,MAAM,EAAE,GAAG,gBAmB1C;AAED,iBAAe,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,iBAqCnE;AAED,OAAO,EAAC,gBAAgB,EAAC,CAAC;AAE1B,eAAe,WAAW,CAAC"}

View File

@@ -0,0 +1,142 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.installCocoaPods = installCocoaPods;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _execa() {
const data = _interopRequireDefault(require("execa"));
_execa = 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 _runBundleInstall = _interopRequireDefault(require("./runBundleInstall"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function runPodInstall(loader, options) {
const shouldHandleRepoUpdate = (options === null || options === void 0 ? void 0 : options.shouldHandleRepoUpdate) || true;
try {
loader.start(`Installing CocoaPods dependencies ${_chalk().default.bold((options === null || options === void 0 ? void 0 : options.newArchEnabled) ? 'with New Architecture' : '')} ${_chalk().default.dim('(this may take a few minutes)')}`);
await (0, _execa().default)('bundle', ['exec', 'pod', 'install'], {
env: {
RCT_NEW_ARCH_ENABLED: (options === null || options === void 0 ? void 0 : options.newArchEnabled) ? '1' : '0'
}
});
} catch (error) {
_cliTools().logger.debug(error);
// "pod" command outputs errors to stdout (at least some of them)
const stderr = error.stderr || error.stdout;
/**
* If CocoaPods failed due to repo being out of date, it will
* include the update command in the error message.
*
* `shouldHandleRepoUpdate` will be set to `false` to
* prevent infinite loop (unlikely scenario)
*/
if (stderr.includes('pod repo update') && shouldHandleRepoUpdate) {
await runPodUpdate(loader);
await runPodInstall(loader, {
shouldHandleRepoUpdate: false,
newArchEnabled: options === null || options === void 0 ? void 0 : options.newArchEnabled
});
} else {
loader.fail();
_cliTools().logger.error(stderr);
throw new (_cliTools().CLIError)(`Looks like your iOS environment is not properly set. Please go to ${_cliTools().link.docs('environment-setup', 'ios', {
guide: 'native'
})} and follow the React Native CLI QuickStart guide for macOS and iOS.`);
}
}
}
async function runPodUpdate(loader) {
try {
loader.start(`Updating CocoaPods repositories ${_chalk().default.dim('(this may take a few minutes)')}`);
await (0, _execa().default)('pod', ['repo', 'update']);
} catch (error) {
// "pod" command outputs errors to stdout (at least some of them)
_cliTools().logger.log(error.stderr || error.stdout);
loader.fail();
throw new (_cliTools().CLIError)(`Failed to update CocoaPods repositories for iOS project.\nPlease try again manually: "pod repo update".\nCocoaPods documentation: ${_chalk().default.dim.underline('https://cocoapods.org/')}`);
}
}
async function installCocoaPodsWithGem() {
const options = ['install', 'cocoapods', '--no-document'];
try {
// First attempt to install `cocoapods`
await (0, _execa().default)('gem', options);
} catch (_error) {
// If that doesn't work then try with sudo
await (0, _cliTools().runSudo)(`gem ${options.join(' ')}`);
}
}
async function installCocoaPods(loader) {
loader.stop();
loader.start('Installing CocoaPods');
try {
await installCocoaPodsWithGem();
return loader.succeed();
} catch (error) {
loader.fail();
_cliTools().logger.error(error.stderr);
throw new (_cliTools().CLIError)(`An error occured while trying to install CocoaPods, which is required by this template.\nPlease try again manually: sudo gem install cocoapods.\nCocoaPods documentation: ${_chalk().default.dim.underline('https://cocoapods.org/')}`);
}
}
async function installPods(loader, options) {
loader = loader || new (_cliTools().NoopLoader)();
try {
if (!(options === null || options === void 0 ? void 0 : options.iosFolderPath) && !_fs().default.existsSync('ios')) {
return;
}
process.chdir((options === null || options === void 0 ? void 0 : options.iosFolderPath) ?? 'ios');
const hasPods = _fs().default.existsSync('Podfile');
if (!hasPods) {
return;
}
if (_fs().default.existsSync('../Gemfile') && !(options === null || options === void 0 ? void 0 : options.skipBundleInstall)) {
await (0, _runBundleInstall.default)(loader);
} else if (!_fs().default.existsSync('../Gemfile')) {
throw new (_cliTools().CLIError)('Could not find the Gemfile. Currently the CLI requires to have this file in the root directory of the project to install CocoaPods. If your configuration is different, please install the CocoaPods manually.');
}
try {
// Check if "pod" is available and usable. It happens that there are
// multiple versions of "pod" command and even though it's there, it exits
// with a failure
await (0, _execa().default)('pod', ['--version']);
} catch (e) {
loader.info();
await installCocoaPods(loader);
}
await runPodInstall(loader, {
newArchEnabled: options === null || options === void 0 ? void 0 : options.newArchEnabled
});
} finally {
process.chdir('..');
}
}
var _default = installPods;
exports.default = _default;
//# sourceMappingURL=installPods.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
import { Device } from '../types';
/**
* Executes `xcrun xcdevice list` and `xcrun simctl list --json devices`, and connects parsed output of these two commands. We are running these two commands as they are necessary to display both physical devices and simulators. However, it's important to note that neither command provides a combined output of both.
* @param sdkNames
* @returns List of available devices and simulators.
*/
declare function listDevices(sdkNames: string[]): Promise<Device[]>;
export declare function stripPlatform(platform: string): string;
export default listDevices;
//# sourceMappingURL=listDevices.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"listDevices.d.ts","sourceRoot":"","sources":["../../src/tools/listDevices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAmDhC;;;;GAIG;AACH,iBAAe,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkChE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,eAAe,WAAW,CAAC"}

View File

@@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.stripPlatform = stripPlatform;
function _execa() {
const data = _interopRequireDefault(require("execa"));
_execa = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const parseXcdeviceList = (text, sdkNames = []) => {
const rawOutput = JSON.parse(text);
const devices = rawOutput.filter(device => sdkNames.includes(stripPlatform(device === null || device === void 0 ? void 0 : device.platform))).sort(device => device.simulator ? 1 : -1).map(device => {
var _device$error;
return {
isAvailable: device.available,
name: device.name,
udid: device.identifier,
sdk: device.platform,
version: device.operatingSystemVersion,
availabilityError: (_device$error = device.error) === null || _device$error === void 0 ? void 0 : _device$error.description,
type: device.simulator ? 'simulator' : 'device'
};
});
return devices;
};
/**
* Executes `xcrun xcdevice list` and `xcrun simctl list --json devices`, and connects parsed output of these two commands. We are running these two commands as they are necessary to display both physical devices and simulators. However, it's important to note that neither command provides a combined output of both.
* @param sdkNames
* @returns List of available devices and simulators.
*/
async function listDevices(sdkNames) {
const xcdeviceOutput = _execa().default.sync('xcrun', ['xcdevice', 'list']).stdout;
const parsedXcdeviceOutput = parseXcdeviceList(xcdeviceOutput, sdkNames);
const simctlOutput = JSON.parse(_execa().default.sync('xcrun', ['simctl', 'list', '--json', 'devices']).stdout);
const parsedSimctlOutput = Object.keys(simctlOutput.devices).map(key => simctlOutput.devices[key]).reduce((acc, val) => acc.concat(val), []);
const merged = [];
const matchedUdids = new Set();
parsedXcdeviceOutput.forEach(first => {
const match = parsedSimctlOutput.find(second => first.udid === second.udid);
if (match) {
matchedUdids.add(first.udid);
merged.push({
...first,
...match
});
} else {
merged.push({
...first
});
}
});
parsedSimctlOutput.forEach(item => {
if (!matchedUdids.has(item.udid)) {
merged.push({
...item
});
}
});
return merged.filter(({
isAvailable
}) => isAvailable === true);
}
function stripPlatform(platform) {
return platform.replace('com.apple.platform.', '');
}
var _default = listDevices;
exports.default = _default;
//# sourceMappingURL=listDevices.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
import { DependencyConfig } from '@react-native-community/cli-types';
import { ApplePlatform } from '../types';
interface ResolvePodsOptions {
forceInstall?: boolean;
newArchEnabled?: boolean;
}
interface NativeDependencies {
[key: string]: DependencyConfig;
}
export declare function getPackageJson(root: string): any;
export declare function getPlatformDependencies(dependencies: NativeDependencies, platformName: ApplePlatform): string[];
export declare function dependenciesToString(dependencies: string[]): string;
export declare function generateMd5Hash(text: string): string;
export declare function compareMd5Hashes(hash1: string, hash2: string): boolean;
export default function resolvePods(root: string, nativeDependencies: NativeDependencies, platformName: ApplePlatform, options?: ResolvePodsOptions): Promise<void>;
export {};
//# sourceMappingURL=pods.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"pods.d.ts","sourceRoot":"","sources":["../../src/tools/pods.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,gBAAgB,EAEjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,UAAU,kBAAkB;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,UAAU,kBAAkB;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,OAQ1C;AAED,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,kBAAkB,EAChC,YAAY,EAAE,aAAa,YAe5B;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,UAE1D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,UAE3C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAE5D;AA0BD,wBAA8B,WAAW,CACvC,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,aAAa,EAC3B,OAAO,CAAC,EAAE,kBAAkB,iBAwD7B"}

View File

@@ -0,0 +1,120 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.compareMd5Hashes = compareMd5Hashes;
exports.default = resolvePods;
exports.dependenciesToString = dependenciesToString;
exports.generateMd5Hash = generateMd5Hash;
exports.getPackageJson = getPackageJson;
exports.getPlatformDependencies = getPlatformDependencies;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = _interopRequireDefault(require("fs-extra"));
_fsExtra = function () {
return data;
};
return data;
}
function _crypto() {
const data = require("crypto");
_crypto = 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 _installPods = _interopRequireDefault(require("./installPods"));
var _findPodfilePath = _interopRequireDefault(require("../config/findPodfilePath"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getPackageJson(root) {
try {
return require(_path().default.join(root, 'package.json'));
} catch {
throw new (_cliTools().CLIError)('No package.json found. Please make sure the file exists in the current folder.');
}
}
function getPlatformDependencies(dependencies, platformName) {
return Object.keys(dependencies).filter(dependency => {
var _dependencies$depende;
return (_dependencies$depende = dependencies[dependency].platforms) === null || _dependencies$depende === void 0 ? void 0 : _dependencies$depende[platformName];
}).map(dependency => {
var _dependencies$depende2;
return `${dependency}@${((_dependencies$depende2 = dependencies[dependency].platforms) === null || _dependencies$depende2 === void 0 ? void 0 : _dependencies$depende2[platformName]).version}`;
}).sort();
}
function dependenciesToString(dependencies) {
return dependencies.join('\n');
}
function generateMd5Hash(text) {
return (0, _crypto().createHash)('md5').update(text).digest('hex');
}
function compareMd5Hashes(hash1, hash2) {
return hash1 === hash2;
}
async function install(packageJson, cachedDependenciesHash, currentDependenciesHash, iosFolderPath) {
const loader = (0, _cliTools().getLoader)('Installing CocoaPods...');
try {
await (0, _installPods.default)(loader, {
skipBundleInstall: !!cachedDependenciesHash,
iosFolderPath
});
_cliTools().cacheManager.set(packageJson.name, 'dependencies', currentDependenciesHash);
loader.succeed();
} catch {
loader.fail();
throw new (_cliTools().CLIError)(`Something when wrong while installing CocoaPods. Please run ${_chalk().default.bold('pod install')} manually`);
}
}
async function resolvePods(root, nativeDependencies, platformName, options) {
const packageJson = getPackageJson(root);
const podfilePath = (0, _findPodfilePath.default)(root, platformName);
const platformFolderPath = podfilePath ? podfilePath.slice(0, podfilePath.lastIndexOf('/')) : _path().default.join(root, platformName);
const podsPath = _path().default.join(platformFolderPath, 'Pods');
const arePodsInstalled = _fsExtra().default.existsSync(podsPath);
const platformDependencies = getPlatformDependencies(nativeDependencies, platformName);
const dependenciesString = dependenciesToString(platformDependencies);
const currentDependenciesHash = generateMd5Hash(dependenciesString);
const cachedDependenciesHash = _cliTools().cacheManager.get(packageJson.name, 'dependencies');
if (options === null || options === void 0 ? void 0 : options.forceInstall) {
await install(packageJson, cachedDependenciesHash, currentDependenciesHash, platformFolderPath);
} else if (arePodsInstalled && cachedDependenciesHash === undefined) {
_cliTools().cacheManager.set(packageJson.name, 'dependencies', currentDependenciesHash);
} else if (!cachedDependenciesHash || !compareMd5Hashes(currentDependenciesHash, cachedDependenciesHash) || !arePodsInstalled) {
const loader = (0, _cliTools().getLoader)('Installing CocoaPods...');
try {
await (0, _installPods.default)(loader, {
skipBundleInstall: !!cachedDependenciesHash,
newArchEnabled: options === null || options === void 0 ? void 0 : options.newArchEnabled,
iosFolderPath: platformFolderPath
});
_cliTools().cacheManager.set(packageJson.name, 'dependencies', currentDependenciesHash);
loader.succeed();
} catch {
loader.fail();
throw new (_cliTools().CLIError)(`Something when wrong while installing CocoaPods. Please run ${_chalk().default.bold('pod install')} manually`);
}
}
}
//# sourceMappingURL=pods.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import { Device } from '../types';
export declare function promptForSchemeSelection(schemes: string[]): Promise<string>;
export declare function promptForConfigurationSelection(configurations: string[]): Promise<string>;
export declare function promptForDeviceSelection(devices: Device[], lastUsedIOSDeviceId?: string): Promise<Device | undefined>;
export declare function promptForDeviceToTailLogs(platformReadableName: string, simulators: Device[]): Promise<string>;
//# sourceMappingURL=prompts.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/tools/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAOhC,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,wBAAsB,+BAA+B,CACnD,cAAc,EAAE,MAAM,EAAE,GACvB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoC7B;AAED,wBAAsB,yBAAyB,CAC7C,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,MAAM,CAAC,CAYjB"}

View File

@@ -0,0 +1,106 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.promptForConfigurationSelection = promptForConfigurationSelection;
exports.promptForDeviceSelection = promptForDeviceSelection;
exports.promptForDeviceToTailLogs = promptForDeviceToTailLogs;
exports.promptForSchemeSelection = promptForSchemeSelection;
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;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getVersionFromDevice({
version
}) {
var _version$match;
return version ? ` (${(_version$match = version.match(/^(\d+\.\d+)/)) === null || _version$match === void 0 ? void 0 : _version$match[1]})` : '';
}
async function promptForSchemeSelection(schemes) {
const {
scheme
} = await (0, _cliTools().prompt)({
name: 'scheme',
type: 'select',
message: 'Select the scheme you want to use',
choices: schemes.map(value => ({
title: value,
value: value
}))
});
return scheme;
}
async function promptForConfigurationSelection(configurations) {
const {
configuration
} = await (0, _cliTools().prompt)({
name: 'configuration',
type: 'select',
message: 'Select the configuration you want to use',
choices: configurations.map(value => ({
title: value,
value: value
}))
});
return configuration;
}
async function promptForDeviceSelection(devices, lastUsedIOSDeviceId) {
const sortedDevices = [...devices];
const devicesIds = sortedDevices.map(({
udid
}) => udid);
if (lastUsedIOSDeviceId) {
const preferredDeviceIndex = devicesIds.indexOf(lastUsedIOSDeviceId);
if (preferredDeviceIndex > -1) {
const [preferredDevice] = sortedDevices.splice(preferredDeviceIndex, 1);
sortedDevices.unshift(preferredDevice);
}
}
const {
device
} = await (0, _cliTools().prompt)({
type: 'select',
name: 'device',
message: 'Select the device you want to use',
choices: sortedDevices.filter(({
type
}) => type === 'device' || type === 'simulator').map(d => {
const availability = !d.isAvailable && !!d.availabilityError ? _chalk().default.red(`(unavailable - ${d.availabilityError})`) : '';
return {
title: `${_chalk().default.bold(`${d.name}${getVersionFromDevice(d)}`)} ${availability}`,
value: d,
disabled: !d.isAvailable
};
}),
min: 1
});
return device;
}
async function promptForDeviceToTailLogs(platformReadableName, simulators) {
const {
udid
} = await (0, _cliTools().prompt)({
type: 'select',
name: 'udid',
message: `Select ${platformReadableName} simulators to tail logs from`,
choices: simulators.map(simulator => ({
title: `${simulator.name}${getVersionFromDevice(simulator)}`.trim(),
value: simulator.udid
}))
});
return udid;
}
//# sourceMappingURL=prompts.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import type { Ora } from 'ora';
declare function runBundleInstall(loader: Ora): Promise<void>;
export default runBundleInstall;
//# sourceMappingURL=runBundleInstall.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"runBundleInstall.d.ts","sourceRoot":"","sources":["../../src/tools/runBundleInstall.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAE7B,iBAAe,gBAAgB,CAAC,MAAM,EAAE,GAAG,iBAkB1C;AAED,eAAe,gBAAgB,CAAC"}

View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _execa() {
const data = _interopRequireDefault(require("execa"));
_execa = 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 }; }
async function runBundleInstall(loader) {
try {
loader.start('Installing Ruby Gems');
await (0, _execa().default)('bundle', ['install']);
} catch (error) {
loader.fail();
_cliTools().logger.error(error.stderr || error.stdout);
throw new (_cliTools().CLIError)(`Looks like your iOS environment is not properly set. Please go to ${_cliTools().link.docs('environment-setup', 'ios', {
guide: 'native'
})} and follow the React Native CLI QuickStart guide for macOS and iOS.`);
}
loader.succeed();
}
var _default = runBundleInstall;
exports.default = _default;
//# sourceMappingURL=runBundleInstall.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["runBundleInstall","loader","start","execa","error","fail","logger","stderr","stdout","CLIError","link","docs","guide","succeed"],"sources":["../../src/tools/runBundleInstall.ts"],"sourcesContent":["import execa from 'execa';\nimport {CLIError, logger, link} from '@react-native-community/cli-tools';\nimport type {Ora} from 'ora';\n\nasync function runBundleInstall(loader: Ora) {\n try {\n loader.start('Installing Ruby Gems');\n\n await execa('bundle', ['install']);\n } catch (error) {\n loader.fail();\n logger.error((error as any).stderr || (error as any).stdout);\n throw new CLIError(\n `Looks like your iOS environment is not properly set. Please go to ${link.docs(\n 'environment-setup',\n 'ios',\n {guide: 'native'},\n )} and follow the React Native CLI QuickStart guide for macOS and iOS.`,\n );\n }\n\n loader.succeed();\n}\n\nexport default runBundleInstall;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAyE;AAGzE,eAAeA,gBAAgB,CAACC,MAAW,EAAE;EAC3C,IAAI;IACFA,MAAM,CAACC,KAAK,CAAC,sBAAsB,CAAC;IAEpC,MAAM,IAAAC,gBAAK,EAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC;EACpC,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdH,MAAM,CAACI,IAAI,EAAE;IACbC,kBAAM,CAACF,KAAK,CAAEA,KAAK,CAASG,MAAM,IAAKH,KAAK,CAASI,MAAM,CAAC;IAC5D,MAAM,KAAIC,oBAAQ,EACf,qEAAoEC,gBAAI,CAACC,IAAI,CAC5E,mBAAmB,EACnB,KAAK,EACL;MAACC,KAAK,EAAE;IAAQ,CAAC,CACjB,sEAAqE,CACxE;EACH;EAEAX,MAAM,CAACY,OAAO,EAAE;AAClB;AAAC,eAEcb,gBAAgB;AAAA"}

View File

@@ -0,0 +1,12 @@
import { IosInfo } from '../types';
interface Args {
scheme?: string;
mode?: string;
info: IosInfo | undefined;
}
export declare function selectFromInteractiveMode({ scheme, mode, info, }: Args): Promise<{
scheme?: string;
mode?: string;
}>;
export {};
//# sourceMappingURL=selectFromInteractiveMode.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"selectFromInteractiveMode.d.ts","sourceRoot":"","sources":["../../src/tools/selectFromInteractiveMode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAMjC,UAAU,IAAI;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;CAC3B;AAED,wBAAsB,yBAAyB,CAAC,EAC9C,MAAM,EACN,IAAI,EACJ,IAAI,GACL,EAAE,IAAI,GAAG,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC,CAsBlD"}

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.selectFromInteractiveMode = selectFromInteractiveMode;
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 _prompts = require("./prompts");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function selectFromInteractiveMode({
scheme,
mode,
info
}) {
let newScheme = scheme;
let newMode = mode;
const schemes = info === null || info === void 0 ? void 0 : info.schemes;
if (schemes && schemes.length > 1) {
newScheme = await (0, _prompts.promptForSchemeSelection)(schemes);
} else {
_cliTools().logger.info(`Automatically selected ${_chalk().default.bold(scheme)} scheme.`);
}
const configurations = info === null || info === void 0 ? void 0 : info.configurations;
if (configurations && configurations.length > 1) {
newMode = await (0, _prompts.promptForConfigurationSelection)(configurations);
} else {
_cliTools().logger.info(`Automatically selected ${_chalk().default.bold(mode)} configuration.`);
}
return {
scheme: newScheme,
mode: newMode
};
}
//# sourceMappingURL=selectFromInteractiveMode.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["selectFromInteractiveMode","scheme","mode","info","newScheme","newMode","schemes","length","promptForSchemeSelection","logger","chalk","bold","configurations","promptForConfigurationSelection"],"sources":["../../src/tools/selectFromInteractiveMode.ts"],"sourcesContent":["import {logger} from '@react-native-community/cli-tools';\nimport chalk from 'chalk';\nimport {IosInfo} from '../types';\nimport {\n promptForConfigurationSelection,\n promptForSchemeSelection,\n} from './prompts';\n\ninterface Args {\n scheme?: string;\n mode?: string;\n info: IosInfo | undefined;\n}\n\nexport async function selectFromInteractiveMode({\n scheme,\n mode,\n info,\n}: Args): Promise<{scheme?: string; mode?: string}> {\n let newScheme = scheme;\n let newMode = mode;\n\n const schemes = info?.schemes;\n if (schemes && schemes.length > 1) {\n newScheme = await promptForSchemeSelection(schemes);\n } else {\n logger.info(`Automatically selected ${chalk.bold(scheme)} scheme.`);\n }\n\n const configurations = info?.configurations;\n if (configurations && configurations.length > 1) {\n newMode = await promptForConfigurationSelection(configurations);\n } else {\n logger.info(`Automatically selected ${chalk.bold(mode)} configuration.`);\n }\n\n return {\n scheme: newScheme,\n mode: newMode,\n };\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAGmB;AAQZ,eAAeA,yBAAyB,CAAC;EAC9CC,MAAM;EACNC,IAAI;EACJC;AACI,CAAC,EAA6C;EAClD,IAAIC,SAAS,GAAGH,MAAM;EACtB,IAAII,OAAO,GAAGH,IAAI;EAElB,MAAMI,OAAO,GAAGH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,OAAO;EAC7B,IAAIA,OAAO,IAAIA,OAAO,CAACC,MAAM,GAAG,CAAC,EAAE;IACjCH,SAAS,GAAG,MAAM,IAAAI,iCAAwB,EAACF,OAAO,CAAC;EACrD,CAAC,MAAM;IACLG,kBAAM,CAACN,IAAI,CAAE,0BAAyBO,gBAAK,CAACC,IAAI,CAACV,MAAM,CAAE,UAAS,CAAC;EACrE;EAEA,MAAMW,cAAc,GAAGT,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAES,cAAc;EAC3C,IAAIA,cAAc,IAAIA,cAAc,CAACL,MAAM,GAAG,CAAC,EAAE;IAC/CF,OAAO,GAAG,MAAM,IAAAQ,wCAA+B,EAACD,cAAc,CAAC;EACjE,CAAC,MAAM;IACLH,kBAAM,CAACN,IAAI,CAAE,0BAAyBO,gBAAK,CAACC,IAAI,CAACT,IAAI,CAAE,iBAAgB,CAAC;EAC1E;EAEA,OAAO;IACLD,MAAM,EAAEG,SAAS;IACjBF,IAAI,EAAEG;EACR,CAAC;AACH"}