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,17 @@
import { DetachedCommandFunction } from '@react-native-community/cli-types';
type FlagsT = {
fix: boolean | void;
contributor: boolean | void;
};
declare const _default: {
func: DetachedCommandFunction<FlagsT>;
detached: boolean;
name: string;
description: string;
options: {
name: string;
description: string;
}[];
};
export default _default;
//# sourceMappingURL=doctor.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,uBAAuB,EAAC,MAAM,mCAAmC,CAAC;AAiF1E,KAAK,MAAM,GAAG;IACZ,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7B,CAAC;;;;;;;;;;;AA8KF,wBAiBE"}

View File

@@ -0,0 +1,229 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
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 _healthchecks = require("../tools/healthchecks");
var _printFixOptions = _interopRequireWildcard(require("../tools/printFixOptions"));
var _runAutomaticFix = _interopRequireWildcard(require("../tools/runAutomaticFix"));
var _envinfo = _interopRequireDefault(require("../tools/envinfo"));
var _common = require("../tools/healthchecks/common");
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 }; }
const printCategory = ({
label,
key
}) => {
if (key > 0) {
_cliTools().logger.log();
}
_cliTools().logger.log(_chalk().default.dim(label));
};
const printVersions = ({
version,
versions,
versionRange
}) => {
if (versions) {
const versionsToShow = Array.isArray(versions) ? versions.join(', ') : 'N/A';
(0, _common.logMessage)(`- Versions found: ${_chalk().default.red(versionsToShow)}`);
(0, _common.logMessage)(`- Version supported: ${_chalk().default.green(versionRange)}`);
return;
}
const versionsToShow = version && version !== 'Not Found' ? version : 'N/A';
(0, _common.logMessage)(`- Version found: ${_chalk().default.red(versionsToShow)}`);
(0, _common.logMessage)(`- Version supported: ${_chalk().default.green(versionRange)}`);
return;
};
const printIssue = ({
label,
needsToBeFixed,
version,
versions,
versionRange,
isRequired,
description
}) => {
const symbol = needsToBeFixed ? isRequired ? _chalk().default.red('✖') : _chalk().default.yellow('●') : _chalk().default.green('✓');
const descriptionToShow = description ? ` - ${description}` : '';
_cliTools().logger.log(` ${symbol} ${label}${descriptionToShow}`);
if (needsToBeFixed && versionRange) {
return printVersions({
version,
versions,
versionRange
});
}
};
const printOverallStats = ({
errors,
warnings
}) => {
_cliTools().logger.log(`\n${_chalk().default.bold('Errors:')} ${errors}`);
_cliTools().logger.log(`${_chalk().default.bold('Warnings:')} ${warnings}`);
};
/**
* Given a `healthcheck` and a `platform`, returns the specific fix for
* it or the fallback one if there is not one (`runAutomaticFix`).
*/
const getAutomaticFixForPlatform = (healthcheck, platform) => {
switch (platform) {
case 'win32':
return healthcheck.win32AutomaticFix || healthcheck.runAutomaticFix;
case 'darwin':
return healthcheck.darwinAutomaticFix || healthcheck.runAutomaticFix;
case 'linux':
return healthcheck.linuxAutomaticFix || healthcheck.runAutomaticFix;
default:
return healthcheck.runAutomaticFix;
}
};
const doctorCommand = async (_, options, config) => {
const loader = (0, _cliTools().getLoader)();
loader.start('Running diagnostics...');
const environmentInfo = await (0, _envinfo.default)();
const iterateOverHealthChecks = async ({
label,
healthchecks
}) => ({
label,
healthchecks: (await Promise.all(healthchecks.map(async healthcheck => {
if (healthcheck.visible === false) {
return;
}
const {
description,
needsToBeFixed,
version,
versions,
versionRange
} = await healthcheck.getDiagnostics(environmentInfo, config);
// Assume that it's required unless specified otherwise
const isRequired = healthcheck.isRequired !== false;
const isWarning = needsToBeFixed && !isRequired;
return {
label: healthcheck.label,
needsToBeFixed: Boolean(needsToBeFixed),
version,
versions,
versionRange,
description: description ?? healthcheck.description,
runAutomaticFix: getAutomaticFixForPlatform(healthcheck, process.platform),
isRequired,
type: needsToBeFixed ? isWarning ? _healthchecks.HEALTHCHECK_TYPES.WARNING : _healthchecks.HEALTHCHECK_TYPES.ERROR : undefined
};
}))).filter(healthcheck => healthcheck !== undefined)
});
// Remove all the categories that don't have any healthcheck with
// `needsToBeFixed` so they don't show when the user taps to fix encountered
// issues
const removeFixedCategories = categories => categories.filter(category => category.healthchecks.some(healthcheck => healthcheck.needsToBeFixed));
const iterateOverCategories = categories => Promise.all(categories.map(iterateOverHealthChecks));
const healthchecksPerCategory = await iterateOverCategories(Object.values((0, _healthchecks.getHealthchecks)(options)).filter(category => category !== undefined));
loader.stop();
const stats = {
errors: 0,
warnings: 0
};
healthchecksPerCategory.forEach((issueCategory, key) => {
printCategory({
...issueCategory,
key
});
issueCategory.healthchecks.forEach(healthcheck => {
printIssue(healthcheck);
if (healthcheck.type === _healthchecks.HEALTHCHECK_TYPES.WARNING) {
stats.warnings++;
return;
}
if (healthcheck.type === _healthchecks.HEALTHCHECK_TYPES.ERROR) {
stats.errors++;
return;
}
});
});
printOverallStats(stats);
if (options.fix) {
return await (0, _runAutomaticFix.default)({
healthchecks: removeFixedCategories(healthchecksPerCategory),
automaticFixLevel: _runAutomaticFix.AUTOMATIC_FIX_LEVELS.ALL_ISSUES,
stats,
loader,
environmentInfo,
config
});
}
const removeKeyPressListener = () => {
if (typeof process.stdin.setRawMode === 'function') {
process.stdin.setRawMode(false);
}
process.stdin.removeAllListeners('data');
};
const onKeyPress = async key => {
if (key === _printFixOptions.KEYS.EXIT || key === '\u0003') {
removeKeyPressListener();
process.exit(0);
}
if ([_printFixOptions.KEYS.FIX_ALL_ISSUES, _printFixOptions.KEYS.FIX_ERRORS, _printFixOptions.KEYS.FIX_WARNINGS].includes(key)) {
removeKeyPressListener();
try {
const automaticFixLevel = {
[_printFixOptions.KEYS.FIX_ALL_ISSUES]: _runAutomaticFix.AUTOMATIC_FIX_LEVELS.ALL_ISSUES,
[_printFixOptions.KEYS.FIX_ERRORS]: _runAutomaticFix.AUTOMATIC_FIX_LEVELS.ERRORS,
[_printFixOptions.KEYS.FIX_WARNINGS]: _runAutomaticFix.AUTOMATIC_FIX_LEVELS.WARNINGS
};
await (0, _runAutomaticFix.default)({
healthchecks: removeFixedCategories(healthchecksPerCategory),
automaticFixLevel: automaticFixLevel[key],
stats,
loader,
environmentInfo,
config
});
process.exit(0);
} catch (err) {
_cliTools().logger.log(err.stderr || err.stdout);
throw new (_cliTools().CLIError)('Failed to run automatic fixes.', err);
}
}
};
if (stats.errors || stats.warnings) {
(0, _printFixOptions.default)({
onKeyPress
});
}
};
var _default = {
func: doctorCommand,
detached: true,
name: 'doctor',
description: 'Diagnose and fix common Node.js, iOS, Android & React Native issues.',
options: [{
name: '--fix',
description: 'Attempt to fix all diagnosed issues.'
}, {
name: '--contributor',
description: 'Add healthchecks required to installations required for contributing to React Native.'
}]
};
exports.default = _default;
//# sourceMappingURL=doctor.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
/**
* 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';
declare const _default: {
name: string;
description: string;
func: (_argv: string[], ctx: Config) => Promise<void>;
};
export default _default;
//# sourceMappingURL=info.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;;;;;;AAoFzD,wBAIE"}

View File

@@ -0,0 +1,108 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _envinfo = _interopRequireDefault(require("../tools/envinfo"));
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _cliPlatformApple() {
const data = require("@react-native-community/cli-platform-apple");
_cliPlatformApple = function () {
return data;
};
return data;
}
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 _yaml() {
const data = require("yaml");
_yaml = 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.
*/
const info = async function getInfo(_argv, ctx) {
try {
var _ctx$project$ios, _ctx$project$android;
_cliTools().logger.info('Fetching system and libraries information...');
const notFound = 'Not found';
const platforms = {
Android: {
hermesEnabled: notFound,
newArchEnabled: notFound
},
iOS: {
hermesEnabled: notFound,
newArchEnabled: notFound
}
};
if (process.platform !== 'win32' && ((_ctx$project$ios = ctx.project.ios) === null || _ctx$project$ios === void 0 ? void 0 : _ctx$project$ios.sourceDir)) {
try {
const podfile = await (0, _fsExtra().readFile)(_path().default.join(ctx.project.ios.sourceDir, '/Podfile.lock'), 'utf8');
platforms.iOS.hermesEnabled = podfile.includes('hermes-engine');
} catch (e) {
platforms.iOS.hermesEnabled = notFound;
}
try {
const isNewArchitecture = await (0, _cliPlatformApple().getArchitecture)(ctx.project.ios.sourceDir);
platforms.iOS.newArchEnabled = isNewArchitecture;
} catch {
platforms.iOS.newArchEnabled = notFound;
}
}
if ((_ctx$project$android = ctx.project.android) === null || _ctx$project$android === void 0 ? void 0 : _ctx$project$android.sourceDir) {
try {
const gradleProperties = await (0, _fsExtra().readFile)(_path().default.join(ctx.project.android.sourceDir, '/gradle.properties'), 'utf8');
platforms.Android.hermesEnabled = gradleProperties.includes('hermesEnabled=true');
platforms.Android.newArchEnabled = gradleProperties.includes('newArchEnabled=true');
} catch {
platforms.Android.hermesEnabled = notFound;
platforms.Android.newArchEnabled = notFound;
}
}
const output = await (0, _envinfo.default)();
_cliTools().logger.log((0, _yaml().stringify)({
...output,
...platforms
}));
} catch (err) {
_cliTools().logger.error(`Unable to print environment info.\n${err}`);
} finally {
await _cliTools().version.logIfUpdateAvailable(ctx.root);
}
};
var _default = {
name: 'info',
description: 'Get relevant version info about OS, toolchain and libraries',
func: info
};
exports.default = _default;
//# sourceMappingURL=info.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
export declare const commands: {
info: {
name: string;
description: string;
func: (_argv: string[], ctx: import("@react-native-community/cli-types").Config) => Promise<void>;
};
doctor: {
func: import("@react-native-community/cli-types").DetachedCommandFunction<{
fix: boolean | void;
contributor: boolean | void;
}>;
detached: boolean;
name: string;
description: string;
options: {
name: string;
description: string;
}[];
};
};
/**
* @todo
* We should not rely on this file from other packages, e.g. CLI. We probably need to
* refactor the init in order to remove that connection.
*/
export { default as versionRanges } from './tools/versionRanges';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;CAAiB,CAAC;AAEvC;;;;GAIG;AACH,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,uBAAuB,CAAC"}

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.commands = void 0;
Object.defineProperty(exports, "versionRanges", {
enumerable: true,
get: function () {
return _versionRanges.default;
}
});
var _doctor = _interopRequireDefault(require("./commands/doctor"));
var _info = _interopRequireDefault(require("./commands/info"));
var _versionRanges = _interopRequireDefault(require("./tools/versionRanges"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const commands = {
info: _info.default,
doctor: _doctor.default
};
/**
* @todo
* We should not rely on this file from other packages, e.g. CLI. We probably need to
* refactor the init in order to remove that connection.
*/
exports.commands = commands;
//# sourceMappingURL=index.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["commands","info","doctor"],"sources":["../src/index.ts"],"sourcesContent":["import doctor from './commands/doctor';\nimport info from './commands/info';\n\nexport const commands = {info, doctor};\n\n/**\n * @todo\n * We should not rely on this file from other packages, e.g. CLI. We probably need to\n * refactor the init in order to remove that connection.\n */\nexport {default as versionRanges} from './tools/versionRanges';\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AASA;AAA+D;AAPxD,MAAMA,QAAQ,GAAG;EAACC,IAAI,EAAJA,aAAI;EAAEC,MAAM,EAANA;AAAM,CAAC;;AAEtC;AACA;AACA;AACA;AACA;AAJA"}

View File

@@ -0,0 +1,11 @@
import { Loader } from '../types';
type InstallArgs = {
pkg: string;
label?: string;
loader: Loader;
onSuccess?: () => void;
onFail?: () => void;
};
declare function brewInstall({ pkg, label, loader, onSuccess, onFail, }: InstallArgs): Promise<void | import("ora").Ora>;
export { brewInstall };
//# sourceMappingURL=brewInstall.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"brewInstall.d.ts","sourceRoot":"","sources":["../../src/tools/brewInstall.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,iBAAe,WAAW,CAAC,EACzB,GAAG,EACH,KAAK,EACL,MAAM,EACN,SAAS,EACT,MAAM,GACP,EAAE,WAAW,qCAuBb;AAED,OAAO,EAAC,WAAW,EAAC,CAAC"}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.brewInstall = brewInstall;
function _execa() {
const data = _interopRequireDefault(require("execa"));
_execa = function () {
return data;
};
return data;
}
var _common = require("./healthchecks/common");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function brewInstall({
pkg,
label,
loader,
onSuccess,
onFail
}) {
loader.start(label);
try {
await (0, _execa().default)('brew', ['install', pkg]);
if (typeof onSuccess === 'function') {
return onSuccess();
}
return loader.succeed();
} catch (error) {
if (typeof onFail === 'function') {
return onFail();
}
(0, _common.logError)({
healthcheck: label || pkg,
loader,
error: error,
command: `brew install ${pkg}`
});
}
}
//# sourceMappingURL=brewInstall.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["brewInstall","pkg","label","loader","onSuccess","onFail","start","execa","succeed","error","logError","healthcheck","command"],"sources":["../../src/tools/brewInstall.ts"],"sourcesContent":["import execa from 'execa';\nimport {Loader} from '../types';\nimport {logError} from './healthchecks/common';\n\ntype InstallArgs = {\n pkg: string;\n label?: string;\n loader: Loader;\n onSuccess?: () => void;\n onFail?: () => void;\n};\n\nasync function brewInstall({\n pkg,\n label,\n loader,\n onSuccess,\n onFail,\n}: InstallArgs) {\n loader.start(label);\n\n try {\n await execa('brew', ['install', pkg]);\n\n if (typeof onSuccess === 'function') {\n return onSuccess();\n }\n\n return loader.succeed();\n } catch (error) {\n if (typeof onFail === 'function') {\n return onFail();\n }\n\n logError({\n healthcheck: label || pkg,\n loader,\n error: error as any,\n command: `brew install ${pkg}`,\n });\n }\n}\n\nexport {brewInstall};\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAA+C;AAU/C,eAAeA,WAAW,CAAC;EACzBC,GAAG;EACHC,KAAK;EACLC,MAAM;EACNC,SAAS;EACTC;AACW,CAAC,EAAE;EACdF,MAAM,CAACG,KAAK,CAACJ,KAAK,CAAC;EAEnB,IAAI;IACF,MAAM,IAAAK,gBAAK,EAAC,MAAM,EAAE,CAAC,SAAS,EAAEN,GAAG,CAAC,CAAC;IAErC,IAAI,OAAOG,SAAS,KAAK,UAAU,EAAE;MACnC,OAAOA,SAAS,EAAE;IACpB;IAEA,OAAOD,MAAM,CAACK,OAAO,EAAE;EACzB,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,IAAI,OAAOJ,MAAM,KAAK,UAAU,EAAE;MAChC,OAAOA,MAAM,EAAE;IACjB;IAEA,IAAAK,gBAAQ,EAAC;MACPC,WAAW,EAAET,KAAK,IAAID,GAAG;MACzBE,MAAM;MACNM,KAAK,EAAEA,KAAY;MACnBG,OAAO,EAAG,gBAAeX,GAAI;IAC/B,CAAC,CAAC;EACJ;AACF"}

View File

@@ -0,0 +1,13 @@
export declare enum PACKAGE_MANAGERS {
YARN = "YARN",
NPM = "NPM",
BUN = "BUN"
}
declare const isSoftwareNotInstalled: (command: string) => Promise<boolean>;
declare const doesSoftwareNeedToBeFixed: ({ version, versionRange, looseRange, }: {
version: string;
versionRange: string;
looseRange?: boolean | undefined;
}) => boolean;
export { isSoftwareNotInstalled, doesSoftwareNeedToBeFixed };
//# sourceMappingURL=checkInstallation.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"checkInstallation.d.ts","sourceRoot":"","sources":["../../src/tools/checkInstallation.ts"],"names":[],"mappings":"AAGA,oBAAY,gBAAgB;IAC1B,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,QAAA,MAAM,sBAAsB,YAAmB,MAAM,KAAG,QAAQ,OAAO,CAQtE,CAAC;AAEF,QAAA,MAAM,yBAAyB;aAKpB,MAAM;kBACD,MAAM;;MAElB,OAQH,CAAC;AAEF,OAAO,EAAC,sBAAsB,EAAE,yBAAyB,EAAC,CAAC"}

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isSoftwareNotInstalled = exports.doesSoftwareNeedToBeFixed = exports.PACKAGE_MANAGERS = void 0;
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = function () {
return data;
};
return data;
}
function _commandExists() {
const data = _interopRequireDefault(require("command-exists"));
_commandExists = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let PACKAGE_MANAGERS;
exports.PACKAGE_MANAGERS = PACKAGE_MANAGERS;
(function (PACKAGE_MANAGERS) {
PACKAGE_MANAGERS["YARN"] = "YARN";
PACKAGE_MANAGERS["NPM"] = "NPM";
PACKAGE_MANAGERS["BUN"] = "BUN";
})(PACKAGE_MANAGERS || (exports.PACKAGE_MANAGERS = PACKAGE_MANAGERS = {}));
const isSoftwareNotInstalled = async command => {
try {
await (0, _commandExists().default)(command);
return false;
} catch (_ignored) {
return true;
}
};
exports.isSoftwareNotInstalled = isSoftwareNotInstalled;
const doesSoftwareNeedToBeFixed = ({
version,
versionRange,
looseRange = false
}) => {
const coercedVersion = _semver().default.coerce(version, {
loose: looseRange
});
return version === 'Not Found' || coercedVersion === null || !_semver().default.satisfies(coercedVersion, versionRange);
};
exports.doesSoftwareNeedToBeFixed = doesSoftwareNeedToBeFixed;
//# sourceMappingURL=checkInstallation.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["PACKAGE_MANAGERS","isSoftwareNotInstalled","command","commandExists","_ignored","doesSoftwareNeedToBeFixed","version","versionRange","looseRange","coercedVersion","semver","coerce","loose","satisfies"],"sources":["../../src/tools/checkInstallation.ts"],"sourcesContent":["import semver from 'semver';\nimport commandExists from 'command-exists';\n\nexport enum PACKAGE_MANAGERS {\n YARN = 'YARN',\n NPM = 'NPM',\n BUN = 'BUN',\n}\n\nconst isSoftwareNotInstalled = async (command: string): Promise<boolean> => {\n try {\n await commandExists(command);\n\n return false;\n } catch (_ignored) {\n return true;\n }\n};\n\nconst doesSoftwareNeedToBeFixed = ({\n version,\n versionRange,\n looseRange = false,\n}: {\n version: string;\n versionRange: string;\n looseRange?: boolean;\n}): boolean => {\n const coercedVersion = semver.coerce(version, {loose: looseRange});\n\n return (\n version === 'Not Found' ||\n coercedVersion === null ||\n !semver.satisfies(coercedVersion, versionRange)\n );\n};\n\nexport {isSoftwareNotInstalled, doesSoftwareNeedToBeFixed};\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA2C;AAAA,IAE/BA,gBAAgB;AAAA;AAAA,WAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;AAAA,GAAhBA,gBAAgB,gCAAhBA,gBAAgB;AAM5B,MAAMC,sBAAsB,GAAG,MAAOC,OAAe,IAAuB;EAC1E,IAAI;IACF,MAAM,IAAAC,wBAAa,EAACD,OAAO,CAAC;IAE5B,OAAO,KAAK;EACd,CAAC,CAAC,OAAOE,QAAQ,EAAE;IACjB,OAAO,IAAI;EACb;AACF,CAAC;AAAC;AAEF,MAAMC,yBAAyB,GAAG,CAAC;EACjCC,OAAO;EACPC,YAAY;EACZC,UAAU,GAAG;AAKf,CAAC,KAAc;EACb,MAAMC,cAAc,GAAGC,iBAAM,CAACC,MAAM,CAACL,OAAO,EAAE;IAACM,KAAK,EAAEJ;EAAU,CAAC,CAAC;EAElE,OACEF,OAAO,KAAK,WAAW,IACvBG,cAAc,KAAK,IAAI,IACvB,CAACC,iBAAM,CAACG,SAAS,CAACJ,cAAc,EAAEF,YAAY,CAAC;AAEnD,CAAC;AAAC"}

View File

@@ -0,0 +1,4 @@
/// <reference types="node" />
import { unlink } from 'fs';
export declare const deleteFile: typeof unlink.__promisify__;
//# sourceMappingURL=deleteFile.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"deleteFile.d.ts","sourceRoot":"","sources":["../../src/tools/deleteFile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,IAAI,CAAC;AAG1B,eAAO,MAAM,UAAU,6BAAoB,CAAC"}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.deleteFile = void 0;
function _fs() {
const data = require("fs");
_fs = function () {
return data;
};
return data;
}
function _util() {
const data = require("util");
_util = function () {
return data;
};
return data;
}
const deleteFile = (0, _util().promisify)(_fs().unlink);
exports.deleteFile = deleteFile;
//# sourceMappingURL=deleteFile.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["deleteFile","promisify","unlink"],"sources":["../../src/tools/deleteFile.ts"],"sourcesContent":["import {unlink} from 'fs';\nimport {promisify} from 'util';\n\nexport const deleteFile = promisify(unlink);\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,UAAU,GAAG,IAAAC,iBAAS,EAACC,YAAM,CAAC;AAAC"}

View File

@@ -0,0 +1,12 @@
import { Loader } from '../types';
/**
* Downloads `downloadUrl` and unzips the contents to `installPath` while
* updating the message of `loader` at each step.
*/
export declare const downloadAndUnzip: ({ loader, downloadUrl, component, installPath, }: {
loader: Loader;
component: string;
downloadUrl: string;
installPath: string;
}) => Promise<void>;
//# sourceMappingURL=downloadAndUnzip.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"downloadAndUnzip.d.ts","sourceRoot":"","sources":["../../src/tools/downloadAndUnzip.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAIhC;;;GAGG;AACH,eAAO,MAAM,gBAAgB;YAMnB,MAAM;eACH,MAAM;iBACJ,MAAM;iBACN,MAAM;mBAcpB,CAAC"}

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.downloadAndUnzip = void 0;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _unzip = require("./unzip");
var _deleteFile = require("./deleteFile");
/**
* Downloads `downloadUrl` and unzips the contents to `installPath` while
* updating the message of `loader` at each step.
*/
const downloadAndUnzip = async ({
loader,
downloadUrl,
component,
installPath
}) => {
loader.start(`Downloading ${component} from "${downloadUrl}" (this may take a few minutes)`);
const installer = await (0, _cliTools().fetchToTemp)(downloadUrl);
loader.text = `Installing ${component} in "${installPath}"`;
try {
await (0, _unzip.unzip)(installer, installPath);
} finally {
await (0, _deleteFile.deleteFile)(installer);
}
};
exports.downloadAndUnzip = downloadAndUnzip;
//# sourceMappingURL=downloadAndUnzip.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["downloadAndUnzip","loader","downloadUrl","component","installPath","start","installer","fetchToTemp","text","unzip","deleteFile"],"sources":["../../src/tools/downloadAndUnzip.ts"],"sourcesContent":["import {fetchToTemp} from '@react-native-community/cli-tools';\nimport {Loader} from '../types';\nimport {unzip} from './unzip';\nimport {deleteFile} from './deleteFile';\n\n/**\n * Downloads `downloadUrl` and unzips the contents to `installPath` while\n * updating the message of `loader` at each step.\n */\nexport const downloadAndUnzip = async ({\n loader,\n downloadUrl,\n component,\n installPath,\n}: {\n loader: Loader;\n component: string;\n downloadUrl: string;\n installPath: string;\n}) => {\n loader.start(\n `Downloading ${component} from \"${downloadUrl}\" (this may take a few minutes)`,\n );\n\n const installer = await fetchToTemp(downloadUrl);\n\n loader.text = `Installing ${component} in \"${installPath}\"`;\n try {\n await unzip(installer, installPath);\n } finally {\n await deleteFile(installer);\n }\n};\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACO,MAAMA,gBAAgB,GAAG,OAAO;EACrCC,MAAM;EACNC,WAAW;EACXC,SAAS;EACTC;AAMF,CAAC,KAAK;EACJH,MAAM,CAACI,KAAK,CACT,eAAcF,SAAU,UAASD,WAAY,iCAAgC,CAC/E;EAED,MAAMI,SAAS,GAAG,MAAM,IAAAC,uBAAW,EAACL,WAAW,CAAC;EAEhDD,MAAM,CAACO,IAAI,GAAI,cAAaL,SAAU,QAAOC,WAAY,GAAE;EAC3D,IAAI;IACF,MAAM,IAAAK,YAAK,EAACH,SAAS,EAAEF,WAAW,CAAC;EACrC,CAAC,SAAS;IACR,MAAM,IAAAM,sBAAU,EAACJ,SAAS,CAAC;EAC7B;AACF,CAAC;AAAC"}

View File

@@ -0,0 +1,12 @@
import { EnvironmentInfo } from '../types';
/**
* Returns information about the running system.
* If `json === true`, or no options are passed,
* the return type will be an `EnvironmentInfo`.
* If set to `false`, it will be a `string`.
*/
declare function getEnvironmentInfo(): Promise<EnvironmentInfo>;
declare function getEnvironmentInfo(json: true): Promise<EnvironmentInfo>;
declare function getEnvironmentInfo(json: false): Promise<string>;
export default getEnvironmentInfo;
//# sourceMappingURL=envinfo.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"envinfo.d.ts","sourceRoot":"","sources":["../../src/tools/envinfo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAEzC;;;;;GAKG;AACH,iBAAe,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;AAC9D,iBAAe,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AACxE,iBAAe,kBAAkB,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAuChE,eAAe,kBAAkB,CAAC"}

View File

@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _envinfo() {
const data = _interopRequireDefault(require("envinfo"));
_envinfo = function () {
return data;
};
return data;
}
function _os() {
const data = require("os");
_os = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Returns information about the running system.
* If `json === true`, or no options are passed,
* the return type will be an `EnvironmentInfo`.
* If set to `false`, it will be a `string`.
*/
async function getEnvironmentInfo(json = true) {
const options = {
json,
showNotFound: true
};
const packages = ['react', 'react-native', '@react-native-community/cli'];
const outOfTreePlatforms = {
darwin: 'react-native-macos',
win32: 'react-native-windows'
};
const outOfTreePlatformPackage = outOfTreePlatforms[(0, _os().platform)()];
if (outOfTreePlatformPackage) {
packages.push(outOfTreePlatformPackage);
}
const info = await _envinfo().default.run({
System: ['OS', 'CPU', 'Memory', 'Shell'],
Binaries: ['Node', 'Yarn', 'npm', 'Watchman'],
IDEs: ['Xcode', 'Android Studio', 'Visual Studio'],
Managers: ['CocoaPods'],
Languages: ['Java', 'Ruby'],
SDKs: ['iOS SDK', 'Android SDK', 'Windows SDK'],
npmPackages: packages,
npmGlobalPackages: ['*react-native*']
}, options);
if (options.json) {
return JSON.parse(info);
}
return info.trim();
}
var _default = getEnvironmentInfo;
exports.default = _default;
//# sourceMappingURL=envinfo.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getEnvironmentInfo","json","options","showNotFound","packages","outOfTreePlatforms","darwin","win32","outOfTreePlatformPackage","platform","push","info","envinfo","run","System","Binaries","IDEs","Managers","Languages","SDKs","npmPackages","npmGlobalPackages","JSON","parse","trim"],"sources":["../../src/tools/envinfo.ts"],"sourcesContent":["import envinfo from 'envinfo';\nimport {platform} from 'os';\nimport {EnvironmentInfo} from '../types';\n\n/**\n * Returns information about the running system.\n * If `json === true`, or no options are passed,\n * the return type will be an `EnvironmentInfo`.\n * If set to `false`, it will be a `string`.\n */\nasync function getEnvironmentInfo(): Promise<EnvironmentInfo>;\nasync function getEnvironmentInfo(json: true): Promise<EnvironmentInfo>;\nasync function getEnvironmentInfo(json: false): Promise<string>;\nasync function getEnvironmentInfo(\n json = true,\n): Promise<string | EnvironmentInfo> {\n const options = {json, showNotFound: true};\n\n const packages = ['react', 'react-native', '@react-native-community/cli'];\n\n const outOfTreePlatforms: {[key: string]: string} = {\n darwin: 'react-native-macos',\n win32: 'react-native-windows',\n };\n\n const outOfTreePlatformPackage = outOfTreePlatforms[platform()];\n if (outOfTreePlatformPackage) {\n packages.push(outOfTreePlatformPackage);\n }\n\n const info = (await envinfo.run(\n {\n System: ['OS', 'CPU', 'Memory', 'Shell'],\n Binaries: ['Node', 'Yarn', 'npm', 'Watchman'],\n IDEs: ['Xcode', 'Android Studio', 'Visual Studio'],\n Managers: ['CocoaPods'],\n Languages: ['Java', 'Ruby'],\n SDKs: ['iOS SDK', 'Android SDK', 'Windows SDK'],\n npmPackages: packages,\n npmGlobalPackages: ['*react-native*'],\n },\n options,\n )) as string;\n\n if (options.json) {\n return JSON.parse(info);\n }\n\n return info.trim();\n}\n\nexport default getEnvironmentInfo;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4B;AAG5B;AACA;AACA;AACA;AACA;AACA;;AAIA,eAAeA,kBAAkB,CAC/BC,IAAI,GAAG,IAAI,EACwB;EACnC,MAAMC,OAAO,GAAG;IAACD,IAAI;IAAEE,YAAY,EAAE;EAAI,CAAC;EAE1C,MAAMC,QAAQ,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,6BAA6B,CAAC;EAEzE,MAAMC,kBAA2C,GAAG;IAClDC,MAAM,EAAE,oBAAoB;IAC5BC,KAAK,EAAE;EACT,CAAC;EAED,MAAMC,wBAAwB,GAAGH,kBAAkB,CAAC,IAAAI,cAAQ,GAAE,CAAC;EAC/D,IAAID,wBAAwB,EAAE;IAC5BJ,QAAQ,CAACM,IAAI,CAACF,wBAAwB,CAAC;EACzC;EAEA,MAAMG,IAAI,GAAI,MAAMC,kBAAO,CAACC,GAAG,CAC7B;IACEC,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC;IACxCC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC;IAC7CC,IAAI,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;IAClDC,QAAQ,EAAE,CAAC,WAAW,CAAC;IACvBC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IAC3BC,IAAI,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC;IAC/CC,WAAW,EAAEhB,QAAQ;IACrBiB,iBAAiB,EAAE,CAAC,gBAAgB;EACtC,CAAC,EACDnB,OAAO,CACG;EAEZ,IAAIA,OAAO,CAACD,IAAI,EAAE;IAChB,OAAOqB,IAAI,CAACC,KAAK,CAACZ,IAAI,CAAC;EACzB;EAEA,OAAOA,IAAI,CAACa,IAAI,EAAE;AACpB;AAAC,eAEcxB,kBAAkB;AAAA"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=adb.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"adb.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/adb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAUjD,wBA8D0B"}

View File

@@ -0,0 +1,95 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _cliPlatformAndroid() {
const data = require("@react-native-community/cli-platform-android");
_cliPlatformAndroid = function () {
return data;
};
return data;
}
function _child_process() {
const data = 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 _default = {
label: 'Adb',
description: 'Required to verify if the android device is attached correctly',
getDiagnostics: async () => {
const adbPath = (0, _cliPlatformAndroid().getAdbPath)();
const devices = _cliPlatformAndroid().adb.getDevices(adbPath);
if (devices.length > 0) {
const adbArgs = ['reverse', '--list'];
const reverseList = (0, _child_process().execFileSync)(adbPath, adbArgs, {
encoding: 'utf8'
});
if (reverseList.length > 0) {
return {
needsToBeFixed: false
};
} else {
return {
description: 'The reverse proxy for the Android device has not been set.',
needsToBeFixed: true
};
}
} else {
return {
description: 'No devices and/or emulators connected. Please create emulator with Android Studio or connect Android device.',
needsToBeFixed: true
};
}
},
runAutomaticFix: async ({
loader,
logManualInstallation
}) => {
loader.fail();
let hash;
switch (_cliTools().link.getOS()) {
case 'macos':
hash = 'method-1-using-adb-reverse-recommended';
break;
case 'windows':
hash = 'method-1-using-adb-reverse-recommended-1';
break;
case 'linux':
hash = 'method-1-using-adb-reverse-recommended-2';
break;
default:
hash = '';
break;
}
try {
const device = await (0, _cliPlatformAndroid().listAndroidDevices)();
if (device && device.connected) {
(0, _cliPlatformAndroid().tryRunAdbReverse)(process.env.RCT_METRO_PORT || 8081, device.deviceId);
}
return loader.succeed();
} catch (e) {
return logManualInstallation({
healthcheck: 'Adb',
url: _cliTools().link.docs('running-on-device', 'android', {
hash: hash,
guide: 'native'
})
});
}
}
};
exports.default = _default;
//# sourceMappingURL=adb.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","description","getDiagnostics","adbPath","getAdbPath","devices","adb","getDevices","length","adbArgs","reverseList","execFileSync","encoding","needsToBeFixed","runAutomaticFix","loader","logManualInstallation","fail","hash","link","getOS","device","listAndroidDevices","connected","tryRunAdbReverse","process","env","RCT_METRO_PORT","deviceId","succeed","e","healthcheck","url","docs","guide"],"sources":["../../../src/tools/healthchecks/adb.ts"],"sourcesContent":["import {HealthCheckInterface} from '../../types';\nimport {\n adb,\n getAdbPath,\n listAndroidDevices,\n tryRunAdbReverse,\n} from '@react-native-community/cli-platform-android';\nimport {execFileSync} from 'child_process';\nimport {link} from '@react-native-community/cli-tools';\n\nexport default {\n label: 'Adb',\n description: 'Required to verify if the android device is attached correctly',\n getDiagnostics: async () => {\n const adbPath = getAdbPath();\n const devices = adb.getDevices(adbPath);\n\n if (devices.length > 0) {\n const adbArgs = ['reverse', '--list'];\n const reverseList = execFileSync(adbPath, adbArgs, {encoding: 'utf8'});\n if (reverseList.length > 0) {\n return {\n needsToBeFixed: false,\n };\n } else {\n return {\n description:\n 'The reverse proxy for the Android device has not been set.',\n needsToBeFixed: true,\n };\n }\n } else {\n return {\n description:\n 'No devices and/or emulators connected. Please create emulator with Android Studio or connect Android device.',\n needsToBeFixed: true,\n };\n }\n },\n runAutomaticFix: async ({loader, logManualInstallation}) => {\n loader.fail();\n let hash: string;\n switch (link.getOS()) {\n case 'macos':\n hash = 'method-1-using-adb-reverse-recommended';\n break;\n case 'windows':\n hash = 'method-1-using-adb-reverse-recommended-1';\n break;\n case 'linux':\n hash = 'method-1-using-adb-reverse-recommended-2';\n break;\n default:\n hash = '';\n break;\n }\n try {\n const device = await listAndroidDevices();\n if (device && device.connected) {\n tryRunAdbReverse(process.env.RCT_METRO_PORT || 8081, device.deviceId);\n }\n return loader.succeed();\n } catch (e) {\n return logManualInstallation({\n healthcheck: 'Adb',\n url: link.docs('running-on-device', 'android', {\n hash: hash,\n guide: 'native',\n }),\n });\n }\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAuD,eAExC;EACbA,KAAK,EAAE,KAAK;EACZC,WAAW,EAAE,gEAAgE;EAC7EC,cAAc,EAAE,YAAY;IAC1B,MAAMC,OAAO,GAAG,IAAAC,gCAAU,GAAE;IAC5B,MAAMC,OAAO,GAAGC,yBAAG,CAACC,UAAU,CAACJ,OAAO,CAAC;IAEvC,IAAIE,OAAO,CAACG,MAAM,GAAG,CAAC,EAAE;MACtB,MAAMC,OAAO,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC;MACrC,MAAMC,WAAW,GAAG,IAAAC,6BAAY,EAACR,OAAO,EAAEM,OAAO,EAAE;QAACG,QAAQ,EAAE;MAAM,CAAC,CAAC;MACtE,IAAIF,WAAW,CAACF,MAAM,GAAG,CAAC,EAAE;QAC1B,OAAO;UACLK,cAAc,EAAE;QAClB,CAAC;MACH,CAAC,MAAM;QACL,OAAO;UACLZ,WAAW,EACT,4DAA4D;UAC9DY,cAAc,EAAE;QAClB,CAAC;MACH;IACF,CAAC,MAAM;MACL,OAAO;QACLZ,WAAW,EACT,8GAA8G;QAChHY,cAAc,EAAE;MAClB,CAAC;IACH;EACF,CAAC;EACDC,eAAe,EAAE,OAAO;IAACC,MAAM;IAAEC;EAAqB,CAAC,KAAK;IAC1DD,MAAM,CAACE,IAAI,EAAE;IACb,IAAIC,IAAY;IAChB,QAAQC,gBAAI,CAACC,KAAK,EAAE;MAClB,KAAK,OAAO;QACVF,IAAI,GAAG,wCAAwC;QAC/C;MACF,KAAK,SAAS;QACZA,IAAI,GAAG,0CAA0C;QACjD;MACF,KAAK,OAAO;QACVA,IAAI,GAAG,0CAA0C;QACjD;MACF;QACEA,IAAI,GAAG,EAAE;QACT;IAAM;IAEV,IAAI;MACF,MAAMG,MAAM,GAAG,MAAM,IAAAC,wCAAkB,GAAE;MACzC,IAAID,MAAM,IAAIA,MAAM,CAACE,SAAS,EAAE;QAC9B,IAAAC,sCAAgB,EAACC,OAAO,CAACC,GAAG,CAACC,cAAc,IAAI,IAAI,EAAEN,MAAM,CAACO,QAAQ,CAAC;MACvE;MACA,OAAOb,MAAM,CAACc,OAAO,EAAE;IACzB,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,OAAOd,qBAAqB,CAAC;QAC3Be,WAAW,EAAE,KAAK;QAClBC,GAAG,EAAEb,gBAAI,CAACc,IAAI,CAAC,mBAAmB,EAAE,SAAS,EAAE;UAC7Cf,IAAI,EAAEA,IAAI;UACVgB,KAAK,EAAE;QACT,CAAC;MACH,CAAC,CAAC;IACJ;EACF;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=androidHomeEnvVariable.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"androidHomeEnvVariable.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/androidHomeEnvVariable.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAqBjD,wBAoB0B"}

View File

@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// List of answers on how to set `ANDROID_HOME` for each platform
const URLS = {
darwin: 'https://stackoverflow.com/a/28296325/4252781',
win32: 'https://stackoverflow.com/a/54888107/4252781',
linux: 'https://stackoverflow.com/a/39228100/4252781'
};
const label = 'ANDROID_HOME';
const description = 'Environment variable that points to your Android SDK installation';
// Force the options for the platform to avoid providing a link
// for `ANDROID_HOME` for every platform NodeJS supports
const platform = process.platform;
const message = `Read more about how to set the ${label} at ${_chalk().default.dim(URLS[platform])}`;
var _default = {
label,
description,
getDiagnostics: async () => ({
needsToBeFixed: !process.env.ANDROID_HOME
}),
runAutomaticFix: async ({
loader,
logManualInstallation
}) => {
// Variable could have been added if installing Android Studio so double checking
if (process.env.ANDROID_HOME) {
loader.succeed();
return;
}
loader.fail();
logManualInstallation({
message
});
}
};
exports.default = _default;
//# sourceMappingURL=androidHomeEnvVariable.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["URLS","darwin","win32","linux","label","description","platform","process","message","chalk","dim","getDiagnostics","needsToBeFixed","env","ANDROID_HOME","runAutomaticFix","loader","logManualInstallation","succeed","fail"],"sources":["../../../src/tools/healthchecks/androidHomeEnvVariable.ts"],"sourcesContent":["import chalk from 'chalk';\nimport {HealthCheckInterface} from '../../types';\n\n// List of answers on how to set `ANDROID_HOME` for each platform\nconst URLS = {\n darwin: 'https://stackoverflow.com/a/28296325/4252781',\n win32: 'https://stackoverflow.com/a/54888107/4252781',\n linux: 'https://stackoverflow.com/a/39228100/4252781',\n};\n\nconst label = 'ANDROID_HOME';\nconst description =\n 'Environment variable that points to your Android SDK installation';\n\n// Force the options for the platform to avoid providing a link\n// for `ANDROID_HOME` for every platform NodeJS supports\nconst platform = process.platform as 'darwin' | 'win32' | 'linux';\n\nconst message = `Read more about how to set the ${label} at ${chalk.dim(\n URLS[platform],\n)}`;\n\nexport default {\n label,\n description,\n getDiagnostics: async () => ({\n needsToBeFixed: !process.env.ANDROID_HOME,\n }),\n runAutomaticFix: async ({loader, logManualInstallation}) => {\n // Variable could have been added if installing Android Studio so double checking\n if (process.env.ANDROID_HOME) {\n loader.succeed();\n\n return;\n }\n\n loader.fail();\n\n logManualInstallation({\n message,\n });\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0B;AAG1B;AACA,MAAMA,IAAI,GAAG;EACXC,MAAM,EAAE,8CAA8C;EACtDC,KAAK,EAAE,8CAA8C;EACrDC,KAAK,EAAE;AACT,CAAC;AAED,MAAMC,KAAK,GAAG,cAAc;AAC5B,MAAMC,WAAW,GACf,mEAAmE;;AAErE;AACA;AACA,MAAMC,QAAQ,GAAGC,OAAO,CAACD,QAAwC;AAEjE,MAAME,OAAO,GAAI,kCAAiCJ,KAAM,OAAMK,gBAAK,CAACC,GAAG,CACrEV,IAAI,CAACM,QAAQ,CAAC,CACd,EAAC;AAAC,eAEW;EACbF,KAAK;EACLC,WAAW;EACXM,cAAc,EAAE,aAAa;IAC3BC,cAAc,EAAE,CAACL,OAAO,CAACM,GAAG,CAACC;EAC/B,CAAC,CAAC;EACFC,eAAe,EAAE,OAAO;IAACC,MAAM;IAAEC;EAAqB,CAAC,KAAK;IAC1D;IACA,IAAIV,OAAO,CAACM,GAAG,CAACC,YAAY,EAAE;MAC5BE,MAAM,CAACE,OAAO,EAAE;MAEhB;IACF;IAEAF,MAAM,CAACG,IAAI,EAAE;IAEbF,qBAAqB,CAAC;MACpBT;IACF,CAAC,CAAC;EACJ;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=androidNDK.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"androidNDK.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/androidNDK.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAElE,wBAqC0B"}

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
var _checkInstallation = require("../checkInstallation");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
label: 'Android NDK',
description: 'Required for building React Native from the source',
getDiagnostics: async ({
SDKs
}) => {
const androidSdk = SDKs['Android SDK'];
const version = androidSdk === 'Not Found' ? androidSdk : androidSdk['Android NDK'];
return {
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
version,
versionRange: _versionRanges.default.ANDROID_NDK
}),
version,
versionRange: _versionRanges.default.ANDROID_NDK
};
},
runAutomaticFix: async ({
loader,
logManualInstallation,
environmentInfo
}) => {
const androidSdk = environmentInfo.SDKs['Android SDK'];
const isNDKInstalled = androidSdk !== 'Not Found' && androidSdk['Android NDK'] !== 'Not Found';
loader.fail();
if (isNDKInstalled) {
return logManualInstallation({
message: `Read more about how to update Android NDK at ${_chalk().default.dim('https://developer.android.com/ndk/downloads')}`
});
}
return logManualInstallation({
healthcheck: 'Android NDK',
url: 'https://developer.android.com/ndk/downloads'
});
}
};
exports.default = _default;
//# sourceMappingURL=androidNDK.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","description","getDiagnostics","SDKs","androidSdk","version","needsToBeFixed","doesSoftwareNeedToBeFixed","versionRange","versionRanges","ANDROID_NDK","runAutomaticFix","loader","logManualInstallation","environmentInfo","isNDKInstalled","fail","message","chalk","dim","healthcheck","url"],"sources":["../../../src/tools/healthchecks/androidNDK.ts"],"sourcesContent":["import chalk from 'chalk';\nimport versionRanges from '../versionRanges';\nimport {doesSoftwareNeedToBeFixed} from '../checkInstallation';\nimport {EnvironmentInfo, HealthCheckInterface} from '../../types';\n\nexport default {\n label: 'Android NDK',\n description: 'Required for building React Native from the source',\n getDiagnostics: async ({SDKs}: EnvironmentInfo) => {\n const androidSdk = SDKs['Android SDK'];\n const version =\n androidSdk === 'Not Found' ? androidSdk : androidSdk['Android NDK'];\n\n return {\n needsToBeFixed: doesSoftwareNeedToBeFixed({\n version,\n versionRange: versionRanges.ANDROID_NDK,\n }),\n version,\n versionRange: versionRanges.ANDROID_NDK,\n };\n },\n runAutomaticFix: async ({loader, logManualInstallation, environmentInfo}) => {\n const androidSdk = environmentInfo.SDKs['Android SDK'];\n const isNDKInstalled =\n androidSdk !== 'Not Found' && androidSdk['Android NDK'] !== 'Not Found';\n\n loader.fail();\n\n if (isNDKInstalled) {\n return logManualInstallation({\n message: `Read more about how to update Android NDK at ${chalk.dim(\n 'https://developer.android.com/ndk/downloads',\n )}`,\n });\n }\n\n return logManualInstallation({\n healthcheck: 'Android NDK',\n url: 'https://developer.android.com/ndk/downloads',\n });\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AAA+D;AAAA,eAGhD;EACbA,KAAK,EAAE,aAAa;EACpBC,WAAW,EAAE,oDAAoD;EACjEC,cAAc,EAAE,OAAO;IAACC;EAAqB,CAAC,KAAK;IACjD,MAAMC,UAAU,GAAGD,IAAI,CAAC,aAAa,CAAC;IACtC,MAAME,OAAO,GACXD,UAAU,KAAK,WAAW,GAAGA,UAAU,GAAGA,UAAU,CAAC,aAAa,CAAC;IAErE,OAAO;MACLE,cAAc,EAAE,IAAAC,4CAAyB,EAAC;QACxCF,OAAO;QACPG,YAAY,EAAEC,sBAAa,CAACC;MAC9B,CAAC,CAAC;MACFL,OAAO;MACPG,YAAY,EAAEC,sBAAa,CAACC;IAC9B,CAAC;EACH,CAAC;EACDC,eAAe,EAAE,OAAO;IAACC,MAAM;IAAEC,qBAAqB;IAAEC;EAAe,CAAC,KAAK;IAC3E,MAAMV,UAAU,GAAGU,eAAe,CAACX,IAAI,CAAC,aAAa,CAAC;IACtD,MAAMY,cAAc,GAClBX,UAAU,KAAK,WAAW,IAAIA,UAAU,CAAC,aAAa,CAAC,KAAK,WAAW;IAEzEQ,MAAM,CAACI,IAAI,EAAE;IAEb,IAAID,cAAc,EAAE;MAClB,OAAOF,qBAAqB,CAAC;QAC3BI,OAAO,EAAG,gDAA+CC,gBAAK,CAACC,GAAG,CAChE,6CAA6C,CAC7C;MACJ,CAAC,CAAC;IACJ;IAEA,OAAON,qBAAqB,CAAC;MAC3BO,WAAW,EAAE,aAAa;MAC1BC,GAAG,EAAE;IACP,CAAC,CAAC;EACJ;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=androidSDK.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"androidSDK.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/androidSDK.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkB,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AA+DlE,wBA2H0B"}

View File

@@ -0,0 +1,166 @@
"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 _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = 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;
}
var _downloadAndUnzip = require("../downloadAndUnzip");
var _androidWinHelpers = require("../windows/androidWinHelpers");
var _environmentVariables = require("../windows/environmentVariables");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const getBuildToolsVersion = (projectRoot = '') => {
try {
// doctor is a detached command, so we may not be in a RN project.
projectRoot = projectRoot || (0, _cliTools().findProjectRoot)();
} catch {
_cliTools().logger.log(); // for extra space
_cliTools().logger.warn("We couldn't find a package.json in this directory. Android SDK checks may fail. Doctor works best in a React Native project root.");
}
const gradleBuildFilePath = _path().default.join(projectRoot, 'android/build.gradle');
const buildToolsVersionEntry = 'buildToolsVersion';
if (!_fs().default.existsSync(gradleBuildFilePath)) {
return 'Not Found';
}
// Read the content of the `build.gradle` file
const gradleBuildFile = _fs().default.readFileSync(gradleBuildFilePath, 'utf-8');
const buildToolsVersionIndex = gradleBuildFile.indexOf(buildToolsVersionEntry);
const buildToolsVersion = (gradleBuildFile
// Get only the portion of the declaration of `buildToolsVersion`
.substring(buildToolsVersionIndex).split('\n')[0]
// Get only the the value of `buildToolsVersion`
.match(/\d|\../g) || []).join('');
return buildToolsVersion || 'Not Found';
};
const installMessage = `Read more about how to update Android SDK at ${_chalk().default.dim('https://developer.android.com/studio')}`;
const isSDKInstalled = environmentInfo => {
const version = environmentInfo.SDKs['Android SDK'];
return version !== 'Not Found';
};
var _default = {
label: 'Android SDK',
description: 'Required for building and installing your app on Android',
getDiagnostics: async ({
SDKs
}, config) => {
const requiredVersion = getBuildToolsVersion(config === null || config === void 0 ? void 0 : config.root);
const buildTools = typeof SDKs['Android SDK'] === 'string' ? SDKs['Android SDK'] : SDKs['Android SDK']['Build Tools'];
const isAndroidSDKInstalled = Array.isArray(buildTools);
const isRequiredVersionInstalled = isAndroidSDKInstalled ? buildTools.includes(requiredVersion) : false;
return {
versions: isAndroidSDKInstalled ? buildTools : SDKs['Android SDK'],
versionRange: requiredVersion,
needsToBeFixed: !isRequiredVersionInstalled
};
},
win32AutomaticFix: async ({
loader
}) => {
// Need a GitHub action to update automatically. See #1180
const cliToolsUrl = 'https://dl.google.com/android/repository/commandlinetools-win-8512546_latest.zip';
const systemImage = 'system-images;android-31;google_apis;x86_64';
// Installing 29 as well so Android Studio does not complain on first boot
const componentsToInstall = ['platform-tools', 'build-tools;31.0.0', 'platforms;android-31',
// Is 28 still needed?
'build-tools;28.0.3', 'platforms;android-28', 'emulator', systemImage, '--licenses' // Accept any pending licenses at the end
];
const androidSDKRoot = (0, _androidWinHelpers.getAndroidSdkRootInstallation)();
if (androidSDKRoot === '') {
loader.fail('There was an error finding the Android SDK root');
return;
}
await (0, _downloadAndUnzip.downloadAndUnzip)({
loader,
downloadUrl: cliToolsUrl,
component: 'Android Command Line Tools',
installPath: androidSDKRoot
});
for (const component of componentsToInstall) {
loader.text = `Installing "${component}" (this may take a few minutes)`;
try {
await (0, _androidWinHelpers.installComponent)(component, androidSDKRoot);
} catch (e) {
// Is there a way to persist a line in loader and continue the execution?
}
}
loader.text = 'Updating environment variables';
// Required for the emulator to work from the CLI
await (0, _environmentVariables.setEnvironment)('ANDROID_SDK_ROOT', androidSDKRoot);
await (0, _environmentVariables.setEnvironment)('ANDROID_HOME', androidSDKRoot);
await (0, _environmentVariables.updateEnvironment)('PATH', _path().default.join(androidSDKRoot, 'tools'));
await (0, _environmentVariables.updateEnvironment)('PATH', _path().default.join(androidSDKRoot, 'platform-tools'));
loader.text = 'Configuring Hypervisor for faster emulation, this might prompt UAC';
const {
hypervisor,
installed
} = await (0, _androidWinHelpers.getBestHypervisor)(androidSDKRoot);
if (!installed) {
if (hypervisor === 'none') {
loader.warn('Android SDK configured but virtualization could not be enabled.');
return;
}
if (hypervisor === 'AMDH') {
await (0, _androidWinHelpers.enableAMDH)(androidSDKRoot);
} else if (hypervisor === 'HAXM') {
await (0, _androidWinHelpers.enableHAXM)(androidSDKRoot);
} else if (hypervisor === 'WHPX') {
await (0, _androidWinHelpers.enableWHPX)();
}
}
loader.text = 'Creating AVD';
await (0, _androidWinHelpers.createAVD)(androidSDKRoot, 'pixel_9.0', 'pixel', systemImage);
loader.succeed('Android SDK configured. You might need to restart your PC for all changes to take effect.');
},
runAutomaticFix: async ({
loader,
logManualInstallation,
environmentInfo
}) => {
loader.fail();
if (isSDKInstalled(environmentInfo)) {
return logManualInstallation({
message: installMessage
});
}
return logManualInstallation({
healthcheck: 'Android SDK',
url: _cliTools().link.docs('environment-setup', 'android', {
hash: 'android-sdk',
guide: 'native'
})
});
}
};
exports.default = _default;
//# sourceMappingURL=androidSDK.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=androidStudio.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"androidStudio.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/androidStudio.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAOjD,wBAyE0B"}

View File

@@ -0,0 +1,91 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _downloadAndUnzip = require("../downloadAndUnzip");
var _executeWinCommand = require("../windows/executeWinCommand");
var _androidWinHelpers = require("../windows/androidWinHelpers");
var _createShortcut = require("../windows/create-shortcut");
var _default = {
label: 'Android Studio',
description: 'Required for building and installing your app on Android',
getDiagnostics: async ({
IDEs
}) => {
const needsToBeFixed = IDEs['Android Studio'] === 'Not Found';
const missing = {
needsToBeFixed,
version: IDEs['Android Studio']
};
// On Windows `doctor` installs Android Studio locally in a well-known place
if (needsToBeFixed && process.platform === 'win32') {
const androidStudioPath = (0, _path().join)((0, _androidWinHelpers.getUserAndroidPath)(), 'android-studio', 'bin', 'studio.exe').replace(/\\/g, '\\\\');
const {
stdout
} = await (0, _executeWinCommand.executeCommand)(`wmic datafile where name="${androidStudioPath}" get Version`);
const version = stdout.replace(/(\r\n|\n|\r)/gm, '').trim();
if (version === '') {
return missing;
}
return {
needsToBeFixed: false,
version
};
}
return missing;
},
win32AutomaticFix: async ({
loader
}) => {
// Need a GitHub action to update automatically. See #1180
const androidStudioUrl = 'https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2022.3.1.18/android-studio-2022.3.1.18-windows.zip';
const installPath = (0, _androidWinHelpers.getUserAndroidPath)();
await (0, _downloadAndUnzip.downloadAndUnzip)({
loader,
downloadUrl: androidStudioUrl,
component: 'Android Studio',
installPath: installPath
});
const prefix = process.arch === 'x64' ? '64' : '';
const binFolder = (0, _path().join)(installPath, 'android-studio', 'bin');
await (0, _createShortcut.createShortcut)({
path: (0, _path().join)(binFolder, `studio${prefix}.exe`),
name: 'Android Studio',
ico: (0, _path().join)(binFolder, 'studio.ico')
});
loader.succeed(`Android Studio installed successfully in "${installPath}".`);
},
runAutomaticFix: async ({
loader,
logManualInstallation
}) => {
loader.fail();
return logManualInstallation({
healthcheck: 'Android Studio',
url: _cliTools().link.docs('environment-setup', 'android', {
hash: 'android-studio',
guide: 'native'
})
});
}
};
exports.default = _default;
//# sourceMappingURL=androidStudio.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","description","getDiagnostics","IDEs","needsToBeFixed","missing","version","process","platform","androidStudioPath","join","getUserAndroidPath","replace","stdout","executeCommand","trim","win32AutomaticFix","loader","androidStudioUrl","installPath","downloadAndUnzip","downloadUrl","component","prefix","arch","binFolder","createShortcut","path","name","ico","succeed","runAutomaticFix","logManualInstallation","fail","healthcheck","url","link","docs","hash","guide"],"sources":["../../../src/tools/healthchecks/androidStudio.ts"],"sourcesContent":["import {join} from 'path';\n\nimport {link} from '@react-native-community/cli-tools';\n\nimport {HealthCheckInterface} from '../../types';\n\nimport {downloadAndUnzip} from '../downloadAndUnzip';\nimport {executeCommand} from '../windows/executeWinCommand';\nimport {getUserAndroidPath} from '../windows/androidWinHelpers';\nimport {createShortcut} from '../windows/create-shortcut';\n\nexport default {\n label: 'Android Studio',\n description: 'Required for building and installing your app on Android',\n getDiagnostics: async ({IDEs}) => {\n const needsToBeFixed = IDEs['Android Studio'] === 'Not Found';\n\n const missing = {\n needsToBeFixed,\n version: IDEs['Android Studio'],\n };\n\n // On Windows `doctor` installs Android Studio locally in a well-known place\n if (needsToBeFixed && process.platform === 'win32') {\n const androidStudioPath = join(\n getUserAndroidPath(),\n 'android-studio',\n 'bin',\n 'studio.exe',\n ).replace(/\\\\/g, '\\\\\\\\');\n const {stdout} = await executeCommand(\n `wmic datafile where name=\"${androidStudioPath}\" get Version`,\n );\n const version = stdout.replace(/(\\r\\n|\\n|\\r)/gm, '').trim();\n\n if (version === '') {\n return missing;\n }\n\n return {\n needsToBeFixed: false,\n version,\n };\n }\n\n return missing;\n },\n win32AutomaticFix: async ({loader}) => {\n // Need a GitHub action to update automatically. See #1180\n const androidStudioUrl =\n 'https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2022.3.1.18/android-studio-2022.3.1.18-windows.zip';\n\n const installPath = getUserAndroidPath();\n await downloadAndUnzip({\n loader,\n downloadUrl: androidStudioUrl,\n component: 'Android Studio',\n installPath: installPath,\n });\n\n const prefix = process.arch === 'x64' ? '64' : '';\n const binFolder = join(installPath, 'android-studio', 'bin');\n\n await createShortcut({\n path: join(binFolder, `studio${prefix}.exe`),\n name: 'Android Studio',\n ico: join(binFolder, 'studio.ico'),\n });\n\n loader.succeed(\n `Android Studio installed successfully in \"${installPath}\".`,\n );\n },\n runAutomaticFix: async ({loader, logManualInstallation}) => {\n loader.fail();\n\n return logManualInstallation({\n healthcheck: 'Android Studio',\n url: link.docs('environment-setup', 'android', {\n hash: 'android-studio',\n guide: 'native',\n }),\n });\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;AACA;AACA;AACA;AAA0D,eAE3C;EACbA,KAAK,EAAE,gBAAgB;EACvBC,WAAW,EAAE,0DAA0D;EACvEC,cAAc,EAAE,OAAO;IAACC;EAAI,CAAC,KAAK;IAChC,MAAMC,cAAc,GAAGD,IAAI,CAAC,gBAAgB,CAAC,KAAK,WAAW;IAE7D,MAAME,OAAO,GAAG;MACdD,cAAc;MACdE,OAAO,EAAEH,IAAI,CAAC,gBAAgB;IAChC,CAAC;;IAED;IACA,IAAIC,cAAc,IAAIG,OAAO,CAACC,QAAQ,KAAK,OAAO,EAAE;MAClD,MAAMC,iBAAiB,GAAG,IAAAC,YAAI,EAC5B,IAAAC,qCAAkB,GAAE,EACpB,gBAAgB,EAChB,KAAK,EACL,YAAY,CACb,CAACC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;MACxB,MAAM;QAACC;MAAM,CAAC,GAAG,MAAM,IAAAC,iCAAc,EAClC,6BAA4BL,iBAAkB,eAAc,CAC9D;MACD,MAAMH,OAAO,GAAGO,MAAM,CAACD,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAACG,IAAI,EAAE;MAE3D,IAAIT,OAAO,KAAK,EAAE,EAAE;QAClB,OAAOD,OAAO;MAChB;MAEA,OAAO;QACLD,cAAc,EAAE,KAAK;QACrBE;MACF,CAAC;IACH;IAEA,OAAOD,OAAO;EAChB,CAAC;EACDW,iBAAiB,EAAE,OAAO;IAACC;EAAM,CAAC,KAAK;IACrC;IACA,MAAMC,gBAAgB,GACpB,+GAA+G;IAEjH,MAAMC,WAAW,GAAG,IAAAR,qCAAkB,GAAE;IACxC,MAAM,IAAAS,kCAAgB,EAAC;MACrBH,MAAM;MACNI,WAAW,EAAEH,gBAAgB;MAC7BI,SAAS,EAAE,gBAAgB;MAC3BH,WAAW,EAAEA;IACf,CAAC,CAAC;IAEF,MAAMI,MAAM,GAAGhB,OAAO,CAACiB,IAAI,KAAK,KAAK,GAAG,IAAI,GAAG,EAAE;IACjD,MAAMC,SAAS,GAAG,IAAAf,YAAI,EAACS,WAAW,EAAE,gBAAgB,EAAE,KAAK,CAAC;IAE5D,MAAM,IAAAO,8BAAc,EAAC;MACnBC,IAAI,EAAE,IAAAjB,YAAI,EAACe,SAAS,EAAG,SAAQF,MAAO,MAAK,CAAC;MAC5CK,IAAI,EAAE,gBAAgB;MACtBC,GAAG,EAAE,IAAAnB,YAAI,EAACe,SAAS,EAAE,YAAY;IACnC,CAAC,CAAC;IAEFR,MAAM,CAACa,OAAO,CACX,6CAA4CX,WAAY,IAAG,CAC7D;EACH,CAAC;EACDY,eAAe,EAAE,OAAO;IAACd,MAAM;IAAEe;EAAqB,CAAC,KAAK;IAC1Df,MAAM,CAACgB,IAAI,EAAE;IAEb,OAAOD,qBAAqB,CAAC;MAC3BE,WAAW,EAAE,gBAAgB;MAC7BC,GAAG,EAAEC,gBAAI,CAACC,IAAI,CAAC,mBAAmB,EAAE,SAAS,EAAE;QAC7CC,IAAI,EAAE,gBAAgB;QACtBC,KAAK,EAAE;MACT,CAAC;IACH,CAAC,CAAC;EACJ;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=cocoaPods.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"cocoaPods.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/cocoaPods.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAKjD,wBA4C0B"}

View File

@@ -0,0 +1,71 @@
"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;
}
var _checkInstallation = require("../checkInstallation");
var _common = require("./common");
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const label = 'CocoaPods';
var _default = {
label,
description: 'Required for installing iOS dependencies',
getDiagnostics: async ({
Managers
}) => ({
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
version: Managers.CocoaPods.version,
versionRange: _versionRanges.default.COCOAPODS
}),
version: Managers.CocoaPods.version,
versionRange: _versionRanges.default.COCOAPODS
}),
runAutomaticFix: async ({
loader
}) => {
loader.stop();
const installMethodCapitalized = 'Gem';
const loaderInstallationMessage = `${label} (installing with ${installMethodCapitalized})`;
const loaderSucceedMessage = `${label} (installed with ${installMethodCapitalized})`;
loader.start(loaderInstallationMessage);
const options = ['install', 'cocoapods', '--no-document'];
try {
// First attempt to install `cocoapods`
await (0, _execa().default)('gem', options);
return loader.succeed(loaderSucceedMessage);
} catch (_error) {
// If that doesn't work then try with sudo
try {
await (0, _cliTools().runSudo)(`gem ${options.join(' ')}`);
return loader.succeed(loaderSucceedMessage);
} catch (error) {
(0, _common.logError)({
healthcheck: label,
loader,
error: error,
command: 'sudo gem install cocoapods'
});
}
}
return;
}
};
exports.default = _default;
//# sourceMappingURL=cocoaPods.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","description","getDiagnostics","Managers","needsToBeFixed","doesSoftwareNeedToBeFixed","version","CocoaPods","versionRange","versionRanges","COCOAPODS","runAutomaticFix","loader","stop","installMethodCapitalized","loaderInstallationMessage","loaderSucceedMessage","start","options","execa","succeed","_error","runSudo","join","error","logError","healthcheck","command"],"sources":["../../../src/tools/healthchecks/cocoaPods.ts"],"sourcesContent":["import execa from 'execa';\nimport {runSudo} from '@react-native-community/cli-tools';\nimport {doesSoftwareNeedToBeFixed} from '../checkInstallation';\nimport {logError} from './common';\nimport {HealthCheckInterface} from '../../types';\nimport versionRanges from '../versionRanges';\n\nconst label = 'CocoaPods';\n\nexport default {\n label,\n description: 'Required for installing iOS dependencies',\n getDiagnostics: async ({Managers}) => ({\n needsToBeFixed: doesSoftwareNeedToBeFixed({\n version: Managers.CocoaPods.version,\n versionRange: versionRanges.COCOAPODS,\n }),\n version: Managers.CocoaPods.version,\n versionRange: versionRanges.COCOAPODS,\n }),\n runAutomaticFix: async ({loader}) => {\n loader.stop();\n\n const installMethodCapitalized = 'Gem';\n const loaderInstallationMessage = `${label} (installing with ${installMethodCapitalized})`;\n const loaderSucceedMessage = `${label} (installed with ${installMethodCapitalized})`;\n\n loader.start(loaderInstallationMessage);\n\n const options = ['install', 'cocoapods', '--no-document'];\n\n try {\n // First attempt to install `cocoapods`\n await execa('gem', options);\n\n return loader.succeed(loaderSucceedMessage);\n } catch (_error) {\n // If that doesn't work then try with sudo\n try {\n await runSudo(`gem ${options.join(' ')}`);\n\n return loader.succeed(loaderSucceedMessage);\n } catch (error) {\n logError({\n healthcheck: label,\n loader,\n error: error as any,\n command: 'sudo gem install cocoapods',\n });\n }\n }\n return;\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AAEA;AAA6C;AAE7C,MAAMA,KAAK,GAAG,WAAW;AAAC,eAEX;EACbA,KAAK;EACLC,WAAW,EAAE,0CAA0C;EACvDC,cAAc,EAAE,OAAO;IAACC;EAAQ,CAAC,MAAM;IACrCC,cAAc,EAAE,IAAAC,4CAAyB,EAAC;MACxCC,OAAO,EAAEH,QAAQ,CAACI,SAAS,CAACD,OAAO;MACnCE,YAAY,EAAEC,sBAAa,CAACC;IAC9B,CAAC,CAAC;IACFJ,OAAO,EAAEH,QAAQ,CAACI,SAAS,CAACD,OAAO;IACnCE,YAAY,EAAEC,sBAAa,CAACC;EAC9B,CAAC,CAAC;EACFC,eAAe,EAAE,OAAO;IAACC;EAAM,CAAC,KAAK;IACnCA,MAAM,CAACC,IAAI,EAAE;IAEb,MAAMC,wBAAwB,GAAG,KAAK;IACtC,MAAMC,yBAAyB,GAAI,GAAEf,KAAM,qBAAoBc,wBAAyB,GAAE;IAC1F,MAAME,oBAAoB,GAAI,GAAEhB,KAAM,oBAAmBc,wBAAyB,GAAE;IAEpFF,MAAM,CAACK,KAAK,CAACF,yBAAyB,CAAC;IAEvC,MAAMG,OAAO,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,eAAe,CAAC;IAEzD,IAAI;MACF;MACA,MAAM,IAAAC,gBAAK,EAAC,KAAK,EAAED,OAAO,CAAC;MAE3B,OAAON,MAAM,CAACQ,OAAO,CAACJ,oBAAoB,CAAC;IAC7C,CAAC,CAAC,OAAOK,MAAM,EAAE;MACf;MACA,IAAI;QACF,MAAM,IAAAC,mBAAO,EAAE,OAAMJ,OAAO,CAACK,IAAI,CAAC,GAAG,CAAE,EAAC,CAAC;QAEzC,OAAOX,MAAM,CAACQ,OAAO,CAACJ,oBAAoB,CAAC;MAC7C,CAAC,CAAC,OAAOQ,KAAK,EAAE;QACd,IAAAC,gBAAQ,EAAC;UACPC,WAAW,EAAE1B,KAAK;UAClBY,MAAM;UACNY,KAAK,EAAEA,KAAY;UACnBG,OAAO,EAAE;QACX,CAAC,CAAC;MACJ;IACF;IACA;EACF;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,31 @@
import { Loader } from '../../types';
declare const logMessage: (message?: string) => void;
declare const logManualInstallation: ({ healthcheck, url, command, message, }: {
healthcheck?: string | undefined;
url?: string | undefined;
command?: string | undefined;
message?: string | undefined;
}) => void;
declare const logError: ({ healthcheck, loader, error, message, command, }: {
healthcheck: string;
loader?: import("ora").Ora | undefined;
error: Error;
message?: string | undefined;
command: string;
}) => void;
declare function removeMessage(message: string): void;
/**
* Inline a series of Ruby statements:
*
* In:
* puts "a"
* puts "b"
*
* Out:
* puts "a"; puts "b";
*/
declare function inline(strings: TemplateStringsArray, ...values: {
toString(): string;
}[]): string;
export { logMessage, logManualInstallation, logError, removeMessage, inline };
//# sourceMappingURL=common.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/common.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAGnC,QAAA,MAAM,UAAU,aAAc,MAAM,SAYnC,CAAC;AAIF,QAAA,MAAM,qBAAqB;;;;;UA8B1B,CAAC;AAEF,QAAA,MAAM,QAAQ;iBAOC,MAAM;;WAEZ,KAAK;;aAEH,MAAM;UAuBhB,CAAC;AAWF,iBAAS,aAAa,CAAC,OAAO,EAAE,MAAM,QAGrC;AAED;;;;;;;;;GASG;AACH,iBAAS,MAAM,CACb,OAAO,EAAE,oBAAoB,EAC7B,GAAG,MAAM,EAAE;IAAC,QAAQ,IAAI,MAAM,CAAA;CAAC,EAAE,UAUlC;AAED,OAAO,EAAC,UAAU,EAAE,qBAAqB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAC,CAAC"}

View File

@@ -0,0 +1,123 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.inline = inline;
exports.logMessage = exports.logManualInstallation = exports.logError = void 0;
exports.removeMessage = removeMessage;
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _readline() {
const data = _interopRequireDefault(require("readline"));
_readline = function () {
return data;
};
return data;
}
function _wcwidth() {
const data = _interopRequireDefault(require("wcwidth"));
_wcwidth = function () {
return data;
};
return data;
}
function _stripAnsi() {
const data = _interopRequireDefault(require("strip-ansi"));
_stripAnsi = 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 }; }
// Space is necessary to keep correct ordering on screen
const logMessage = message => {
const indentation = ' ';
if (typeof message !== 'string') {
_cliTools().logger.log();
return;
}
const messageByLine = message.split('\n');
return _cliTools().logger.log(`${indentation}${messageByLine.join(`\n${indentation}`)}`);
};
exports.logMessage = logMessage;
const addBlankLine = () => logMessage();
const logManualInstallation = ({
healthcheck,
url,
command,
message
}) => {
if (message) {
return logMessage(message);
}
if (url) {
logMessage(`Read more about how to download ${healthcheck} at ${_chalk().default.dim.underline(url)}`);
return;
}
if (command) {
logMessage(`Please install ${healthcheck} by running ${_chalk().default.bold(command)}`);
}
};
exports.logManualInstallation = logManualInstallation;
const logError = ({
healthcheck,
loader,
error,
message,
command
}) => {
if (loader) {
loader.fail();
}
addBlankLine();
logMessage(_chalk().default.dim(error.message));
if (message) {
logMessage(message);
addBlankLine();
return;
}
logMessage(`The error above occured while trying to install ${healthcheck}. Please try again manually: ${_chalk().default.bold(command)}`);
addBlankLine();
};
// Calculate the size of a message on terminal based on rows
exports.logError = logError;
function calculateMessageSize(message) {
return Math.max(1, Math.ceil((0, _wcwidth().default)((0, _stripAnsi().default)(message)) / (process.stdout.columns || 80)));
}
// Clear the message from the terminal
function removeMessage(message) {
_readline().default.moveCursor(process.stdout, 0, -calculateMessageSize(message));
_readline().default.clearScreenDown(process.stdout);
}
/**
* Inline a series of Ruby statements:
*
* In:
* puts "a"
* puts "b"
*
* Out:
* puts "a"; puts "b";
*/
function inline(strings, ...values) {
const zipped = strings.map((str, i) => `${str}${values[i] ?? ''}`).join('');
return zipped.trim().split('\n').filter(line => !/^\W*$/.test(line)).map(line => line.trim()).join('; ');
}
//# sourceMappingURL=common.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=gradle.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"gradle.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/gradle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AASjD,wBAwC0B"}

View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _promises() {
const data = _interopRequireDefault(require("fs/promises"));
_promises = 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;
}
var _common = require("./common");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const label = 'Gradlew';
const description = 'Build tool required for Android builds';
const platform = process.platform;
var _default = {
label,
description,
getDiagnostics: async (_, config) => {
var _config$project$andro;
const projectRoot = (0, _cliTools().findProjectRoot)();
const filename = platform === 'win32' ? 'gradlew.bat' : 'gradlew';
const androidFolderPath = (config === null || config === void 0 ? void 0 : (_config$project$andro = config.project.android) === null || _config$project$andro === void 0 ? void 0 : _config$project$andro.sourceDir) ?? `${projectRoot}/android`;
const gradleWrapperFile = _path().default.join(androidFolderPath, filename);
const executableMode = _promises().default.constants.X_OK;
try {
await _promises().default.access(gradleWrapperFile, executableMode);
return {
needsToBeFixed: false
};
} catch {
return {
needsToBeFixed: true
};
}
},
runAutomaticFix: async ({
loader,
config
}) => {
try {
var _config$project$andro2;
const projectRoot = (config === null || config === void 0 ? void 0 : config.root) ?? (0, _cliTools().findProjectRoot)();
const filename = platform === 'win32' ? 'gradlew.bat' : 'gradlew';
const androidFolderPath = (config === null || config === void 0 ? void 0 : (_config$project$andro2 = config.project.android) === null || _config$project$andro2 === void 0 ? void 0 : _config$project$andro2.sourceDir) ?? `${projectRoot}/android`;
const gradleWrapperFile = _path().default.join(androidFolderPath, filename);
const PERMISSIONS = 0o755;
await _promises().default.chmod(gradleWrapperFile, PERMISSIONS);
} catch (error) {
(0, _common.logError)({
healthcheck: label,
loader,
error: error,
command: 'chmod +x gradlew'
});
}
}
};
exports.default = _default;
//# sourceMappingURL=gradle.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","description","platform","process","getDiagnostics","_","config","projectRoot","findProjectRoot","filename","androidFolderPath","project","android","sourceDir","gradleWrapperFile","path","join","executableMode","fs","constants","X_OK","access","needsToBeFixed","runAutomaticFix","loader","root","PERMISSIONS","chmod","error","logError","healthcheck","command"],"sources":["../../../src/tools/healthchecks/gradle.ts"],"sourcesContent":["import fs from 'fs/promises';\nimport path from 'path';\n\nimport {HealthCheckInterface} from '../../types';\nimport {findProjectRoot} from '@react-native-community/cli-tools';\nimport {logError} from './common';\n\nconst label = 'Gradlew';\nconst description = 'Build tool required for Android builds';\n\nconst platform = process.platform as 'darwin' | 'win32' | 'linux';\n\nexport default {\n label,\n description,\n getDiagnostics: async (_, config) => {\n const projectRoot = findProjectRoot();\n const filename = platform === 'win32' ? 'gradlew.bat' : 'gradlew';\n const androidFolderPath =\n config?.project.android?.sourceDir ?? `${projectRoot}/android`;\n\n const gradleWrapperFile = path.join(androidFolderPath, filename);\n\n const executableMode = fs.constants.X_OK;\n\n try {\n await fs.access(gradleWrapperFile, executableMode);\n return {needsToBeFixed: false};\n } catch {\n return {needsToBeFixed: true};\n }\n },\n runAutomaticFix: async ({loader, config}) => {\n try {\n const projectRoot = config?.root ?? findProjectRoot();\n const filename = platform === 'win32' ? 'gradlew.bat' : 'gradlew';\n const androidFolderPath =\n config?.project.android?.sourceDir ?? `${projectRoot}/android`;\n\n const gradleWrapperFile = path.join(androidFolderPath, filename);\n const PERMISSIONS = 0o755;\n\n await fs.chmod(gradleWrapperFile, PERMISSIONS);\n } catch (error) {\n logError({\n healthcheck: label,\n loader,\n error: error as Error,\n command: 'chmod +x gradlew',\n });\n }\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAAkC;AAElC,MAAMA,KAAK,GAAG,SAAS;AACvB,MAAMC,WAAW,GAAG,wCAAwC;AAE5D,MAAMC,QAAQ,GAAGC,OAAO,CAACD,QAAwC;AAAC,eAEnD;EACbF,KAAK;EACLC,WAAW;EACXG,cAAc,EAAE,OAAOC,CAAC,EAAEC,MAAM,KAAK;IAAA;IACnC,MAAMC,WAAW,GAAG,IAAAC,2BAAe,GAAE;IACrC,MAAMC,QAAQ,GAAGP,QAAQ,KAAK,OAAO,GAAG,aAAa,GAAG,SAAS;IACjE,MAAMQ,iBAAiB,GACrB,CAAAJ,MAAM,aAANA,MAAM,gDAANA,MAAM,CAAEK,OAAO,CAACC,OAAO,0DAAvB,sBAAyBC,SAAS,KAAK,GAAEN,WAAY,UAAS;IAEhE,MAAMO,iBAAiB,GAAGC,eAAI,CAACC,IAAI,CAACN,iBAAiB,EAAED,QAAQ,CAAC;IAEhE,MAAMQ,cAAc,GAAGC,mBAAE,CAACC,SAAS,CAACC,IAAI;IAExC,IAAI;MACF,MAAMF,mBAAE,CAACG,MAAM,CAACP,iBAAiB,EAAEG,cAAc,CAAC;MAClD,OAAO;QAACK,cAAc,EAAE;MAAK,CAAC;IAChC,CAAC,CAAC,MAAM;MACN,OAAO;QAACA,cAAc,EAAE;MAAI,CAAC;IAC/B;EACF,CAAC;EACDC,eAAe,EAAE,OAAO;IAACC,MAAM;IAAElB;EAAM,CAAC,KAAK;IAC3C,IAAI;MAAA;MACF,MAAMC,WAAW,GAAG,CAAAD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEmB,IAAI,KAAI,IAAAjB,2BAAe,GAAE;MACrD,MAAMC,QAAQ,GAAGP,QAAQ,KAAK,OAAO,GAAG,aAAa,GAAG,SAAS;MACjE,MAAMQ,iBAAiB,GACrB,CAAAJ,MAAM,aAANA,MAAM,iDAANA,MAAM,CAAEK,OAAO,CAACC,OAAO,2DAAvB,uBAAyBC,SAAS,KAAK,GAAEN,WAAY,UAAS;MAEhE,MAAMO,iBAAiB,GAAGC,eAAI,CAACC,IAAI,CAACN,iBAAiB,EAAED,QAAQ,CAAC;MAChE,MAAMiB,WAAW,GAAG,KAAK;MAEzB,MAAMR,mBAAE,CAACS,KAAK,CAACb,iBAAiB,EAAEY,WAAW,CAAC;IAChD,CAAC,CAAC,OAAOE,KAAK,EAAE;MACd,IAAAC,gBAAQ,EAAC;QACPC,WAAW,EAAE9B,KAAK;QAClBwB,MAAM;QACNI,KAAK,EAAEA,KAAc;QACrBG,OAAO,EAAE;MACX,CAAC,CAAC;IACJ;EACF;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,12 @@
import { Healthchecks } from '../../types';
export declare const HEALTHCHECK_TYPES: {
ERROR: string;
WARNING: string;
};
type Options = {
fix: boolean | void;
contributor: boolean | void;
};
export declare const getHealthchecks: ({ contributor }: Options) => Healthchecks;
export {};
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,YAAY,EAAsB,MAAM,aAAa,CAAC;AAQ9D,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,eAAe,oBAAmB,OAAO,KAAG,YAsExD,CAAC"}

View File

@@ -0,0 +1,105 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getHealthchecks = exports.HEALTHCHECK_TYPES = void 0;
var _nodeJS = _interopRequireDefault(require("./nodeJS"));
var _packageManagers = require("./packageManagers");
var _adb = _interopRequireDefault(require("./adb"));
var _jdk = _interopRequireDefault(require("./jdk"));
var _watchman = _interopRequireDefault(require("./watchman"));
var _ruby = _interopRequireDefault(require("./ruby"));
var _androidHomeEnvVariable = _interopRequireDefault(require("./androidHomeEnvVariable"));
var _androidStudio = _interopRequireDefault(require("./androidStudio"));
var _androidSDK = _interopRequireDefault(require("./androidSDK"));
var _androidNDK = _interopRequireDefault(require("./androidNDK"));
var _xcode = _interopRequireDefault(require("./xcode"));
var _cocoaPods = _interopRequireDefault(require("./cocoaPods"));
var _iosDeploy = _interopRequireDefault(require("./iosDeploy"));
function _cliConfig() {
const data = _interopRequireDefault(require("@react-native-community/cli-config"));
_cliConfig = function () {
return data;
};
return data;
}
var _xcodeEnv = _interopRequireDefault(require("./xcodeEnv"));
var _packager = _interopRequireDefault(require("./packager"));
var _gradle = _interopRequireDefault(require("./gradle"));
function _deepmerge() {
const data = _interopRequireDefault(require("deepmerge"));
_deepmerge = 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 }; }
const HEALTHCHECK_TYPES = {
ERROR: 'ERROR',
WARNING: 'WARNING'
};
exports.HEALTHCHECK_TYPES = HEALTHCHECK_TYPES;
const getHealthchecks = ({
contributor
}) => {
let additionalChecks = [];
let projectSpecificHealthchecks = {};
let config;
// Doctor can run in a detached mode, where there isn't a config so this can fail
try {
config = (0, _cliConfig().default)();
additionalChecks = config.healthChecks;
if (config.reactNativePath) {
projectSpecificHealthchecks = {
common: {
label: 'Common',
healthchecks: [_packager.default]
},
android: {
label: 'Android',
healthchecks: [_androidSDK.default]
},
...(process.platform === 'darwin' && {
ios: {
label: 'iOS',
healthchecks: [_xcodeEnv.default]
}
})
};
}
} catch {}
if (!config) {
_cliTools().logger.log();
_cliTools().logger.info('Detected that command has been run outside of React Native project, running basic healthchecks.');
}
const defaultHealthchecks = {
common: {
label: 'Common',
healthchecks: [_nodeJS.default, _packageManagers.yarn, _packageManagers.npm, ...(process.platform === 'darwin' ? [_watchman.default] : [])]
},
android: {
label: 'Android',
healthchecks: [_adb.default, _jdk.default, _androidStudio.default, _androidHomeEnvVariable.default, _gradle.default, ...(contributor ? [_androidNDK.default] : [])]
},
...(process.platform === 'darwin' ? {
ios: {
label: 'iOS',
healthchecks: [_xcode.default, _ruby.default, _cocoaPods.default, _iosDeploy.default]
}
} : {}),
...additionalChecks
};
return (0, _deepmerge().default)(defaultHealthchecks, projectSpecificHealthchecks);
};
exports.getHealthchecks = getHealthchecks;
//# sourceMappingURL=index.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["HEALTHCHECK_TYPES","ERROR","WARNING","getHealthchecks","contributor","additionalChecks","projectSpecificHealthchecks","config","loadConfig","healthChecks","reactNativePath","common","label","healthchecks","packager","android","androidSDK","process","platform","ios","xcodeEnv","logger","log","info","defaultHealthchecks","nodeJS","yarn","npm","watchman","adb","jdk","androidStudio","androidHomeEnvVariable","gradle","androidNDK","xcode","ruby","cocoaPods","iosDeploy","deepmerge"],"sources":["../../../src/tools/healthchecks/index.ts"],"sourcesContent":["import nodeJS from './nodeJS';\nimport {yarn, npm} from './packageManagers';\nimport adb from './adb';\nimport jdk from './jdk';\nimport watchman from './watchman';\nimport ruby from './ruby';\nimport androidHomeEnvVariable from './androidHomeEnvVariable';\nimport androidStudio from './androidStudio';\nimport androidSDK from './androidSDK';\nimport androidNDK from './androidNDK';\nimport xcode from './xcode';\nimport cocoaPods from './cocoaPods';\nimport iosDeploy from './iosDeploy';\nimport {Healthchecks, HealthCheckCategory} from '../../types';\nimport loadConfig from '@react-native-community/cli-config';\nimport xcodeEnv from './xcodeEnv';\nimport packager from './packager';\nimport gradle from './gradle';\nimport deepmerge from 'deepmerge';\nimport {logger} from '@react-native-community/cli-tools';\n\nexport const HEALTHCHECK_TYPES = {\n ERROR: 'ERROR',\n WARNING: 'WARNING',\n};\n\ntype Options = {\n fix: boolean | void;\n contributor: boolean | void;\n};\n\nexport const getHealthchecks = ({contributor}: Options): Healthchecks => {\n let additionalChecks: HealthCheckCategory[] = [];\n let projectSpecificHealthchecks = {};\n let config;\n\n // Doctor can run in a detached mode, where there isn't a config so this can fail\n try {\n config = loadConfig();\n additionalChecks = config.healthChecks;\n\n if (config.reactNativePath) {\n projectSpecificHealthchecks = {\n common: {\n label: 'Common',\n healthchecks: [packager],\n },\n android: {\n label: 'Android',\n healthchecks: [androidSDK],\n },\n ...(process.platform === 'darwin' && {\n ios: {\n label: 'iOS',\n healthchecks: [xcodeEnv],\n },\n }),\n };\n }\n } catch {}\n\n if (!config) {\n logger.log();\n logger.info(\n 'Detected that command has been run outside of React Native project, running basic healthchecks.',\n );\n }\n\n const defaultHealthchecks = {\n common: {\n label: 'Common',\n healthchecks: [\n nodeJS,\n yarn,\n npm,\n ...(process.platform === 'darwin' ? [watchman] : []),\n ],\n },\n android: {\n label: 'Android',\n healthchecks: [\n adb,\n jdk,\n androidStudio,\n androidHomeEnvVariable,\n gradle,\n ...(contributor ? [androidNDK] : []),\n ],\n },\n ...(process.platform === 'darwin'\n ? {\n ios: {\n label: 'iOS',\n healthchecks: [xcode, ruby, cocoaPods, iosDeploy],\n },\n }\n : {}),\n ...additionalChecks,\n };\n\n return deepmerge(defaultHealthchecks, projectSpecificHealthchecks);\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AACA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAyD;AAElD,MAAMA,iBAAiB,GAAG;EAC/BC,KAAK,EAAE,OAAO;EACdC,OAAO,EAAE;AACX,CAAC;AAAC;AAOK,MAAMC,eAAe,GAAG,CAAC;EAACC;AAAoB,CAAC,KAAmB;EACvE,IAAIC,gBAAuC,GAAG,EAAE;EAChD,IAAIC,2BAA2B,GAAG,CAAC,CAAC;EACpC,IAAIC,MAAM;;EAEV;EACA,IAAI;IACFA,MAAM,GAAG,IAAAC,oBAAU,GAAE;IACrBH,gBAAgB,GAAGE,MAAM,CAACE,YAAY;IAEtC,IAAIF,MAAM,CAACG,eAAe,EAAE;MAC1BJ,2BAA2B,GAAG;QAC5BK,MAAM,EAAE;UACNC,KAAK,EAAE,QAAQ;UACfC,YAAY,EAAE,CAACC,iBAAQ;QACzB,CAAC;QACDC,OAAO,EAAE;UACPH,KAAK,EAAE,SAAS;UAChBC,YAAY,EAAE,CAACG,mBAAU;QAC3B,CAAC;QACD,IAAIC,OAAO,CAACC,QAAQ,KAAK,QAAQ,IAAI;UACnCC,GAAG,EAAE;YACHP,KAAK,EAAE,KAAK;YACZC,YAAY,EAAE,CAACO,iBAAQ;UACzB;QACF,CAAC;MACH,CAAC;IACH;EACF,CAAC,CAAC,MAAM,CAAC;EAET,IAAI,CAACb,MAAM,EAAE;IACXc,kBAAM,CAACC,GAAG,EAAE;IACZD,kBAAM,CAACE,IAAI,CACT,iGAAiG,CAClG;EACH;EAEA,MAAMC,mBAAmB,GAAG;IAC1Bb,MAAM,EAAE;MACNC,KAAK,EAAE,QAAQ;MACfC,YAAY,EAAE,CACZY,eAAM,EACNC,qBAAI,EACJC,oBAAG,EACH,IAAIV,OAAO,CAACC,QAAQ,KAAK,QAAQ,GAAG,CAACU,iBAAQ,CAAC,GAAG,EAAE,CAAC;IAExD,CAAC;IACDb,OAAO,EAAE;MACPH,KAAK,EAAE,SAAS;MAChBC,YAAY,EAAE,CACZgB,YAAG,EACHC,YAAG,EACHC,sBAAa,EACbC,+BAAsB,EACtBC,eAAM,EACN,IAAI7B,WAAW,GAAG,CAAC8B,mBAAU,CAAC,GAAG,EAAE,CAAC;IAExC,CAAC;IACD,IAAIjB,OAAO,CAACC,QAAQ,KAAK,QAAQ,GAC7B;MACEC,GAAG,EAAE;QACHP,KAAK,EAAE,KAAK;QACZC,YAAY,EAAE,CAACsB,cAAK,EAAEC,aAAI,EAAEC,kBAAS,EAAEC,kBAAS;MAClD;IACF,CAAC,GACD,CAAC,CAAC,CAAC;IACP,GAAGjC;EACL,CAAC;EAED,OAAO,IAAAkC,oBAAS,EAACf,mBAAmB,EAAElB,2BAA2B,CAAC;AACpE,CAAC;AAAC"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=iosDeploy.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"iosDeploy.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/iosDeploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAMjD,wBA2B0B"}

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _checkInstallation = require("../checkInstallation");
var _brewInstall = require("../brewInstall");
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const packageName = 'ios-deploy';
var _default = {
label: packageName,
isRequired: false,
description: 'Required for installing your app on a physical device with the CLI',
getDiagnostics: async () => ({
needsToBeFixed: await (0, _checkInstallation.isSoftwareNotInstalled)(packageName)
}),
runAutomaticFix: async ({
loader,
logManualInstallation
}) => {
await (0, _brewInstall.brewInstall)({
pkg: packageName,
label: packageName,
loader,
onSuccess: () => {
loader.succeed(`Successfully installed ${_chalk().default.bold(packageName)} with Homebrew`);
},
onFail: () => {
loader.fail();
logManualInstallation({
healthcheck: packageName,
url: 'https://github.com/ios-control/ios-deploy#installation'
});
}
});
}
};
exports.default = _default;
//# sourceMappingURL=iosDeploy.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["packageName","label","isRequired","description","getDiagnostics","needsToBeFixed","isSoftwareNotInstalled","runAutomaticFix","loader","logManualInstallation","brewInstall","pkg","onSuccess","succeed","chalk","bold","onFail","fail","healthcheck","url"],"sources":["../../../src/tools/healthchecks/iosDeploy.ts"],"sourcesContent":["import {isSoftwareNotInstalled} from '../checkInstallation';\nimport {HealthCheckInterface} from '../../types';\nimport {brewInstall} from '../brewInstall';\nimport chalk from 'chalk';\n\nconst packageName = 'ios-deploy';\n\nexport default {\n label: packageName,\n isRequired: false,\n description:\n 'Required for installing your app on a physical device with the CLI',\n getDiagnostics: async () => ({\n needsToBeFixed: await isSoftwareNotInstalled(packageName),\n }),\n runAutomaticFix: async ({loader, logManualInstallation}) => {\n await brewInstall({\n pkg: packageName,\n label: packageName,\n loader,\n onSuccess: () => {\n loader.succeed(\n `Successfully installed ${chalk.bold(packageName)} with Homebrew`,\n );\n },\n onFail: () => {\n loader.fail();\n logManualInstallation({\n healthcheck: packageName,\n url: 'https://github.com/ios-control/ios-deploy#installation',\n });\n },\n });\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;AAEA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0B;AAE1B,MAAMA,WAAW,GAAG,YAAY;AAAC,eAElB;EACbC,KAAK,EAAED,WAAW;EAClBE,UAAU,EAAE,KAAK;EACjBC,WAAW,EACT,oEAAoE;EACtEC,cAAc,EAAE,aAAa;IAC3BC,cAAc,EAAE,MAAM,IAAAC,yCAAsB,EAACN,WAAW;EAC1D,CAAC,CAAC;EACFO,eAAe,EAAE,OAAO;IAACC,MAAM;IAAEC;EAAqB,CAAC,KAAK;IAC1D,MAAM,IAAAC,wBAAW,EAAC;MAChBC,GAAG,EAAEX,WAAW;MAChBC,KAAK,EAAED,WAAW;MAClBQ,MAAM;MACNI,SAAS,EAAE,MAAM;QACfJ,MAAM,CAACK,OAAO,CACX,0BAAyBC,gBAAK,CAACC,IAAI,CAACf,WAAW,CAAE,gBAAe,CAClE;MACH,CAAC;MACDgB,MAAM,EAAE,MAAM;QACZR,MAAM,CAACS,IAAI,EAAE;QACbR,qBAAqB,CAAC;UACpBS,WAAW,EAAElB,WAAW;UACxBmB,GAAG,EAAE;QACP,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;EACJ;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=jdk.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"jdk.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/jdk.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAOjD,wBAwD0B"}

View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
var _checkInstallation = require("../checkInstallation");
var _downloadAndUnzip = require("../downloadAndUnzip");
var _environmentVariables = require("../windows/environmentVariables");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
label: 'JDK',
description: 'Required to compile Java code',
getDiagnostics: async ({
Languages
}) => ({
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
version: typeof Languages.Java === 'string' ? Languages.Java : Languages.Java.version,
versionRange: _versionRanges.default.JAVA
}),
version: typeof Languages.Java === 'string' ? Languages.Java : Languages.Java.version,
versionRange: _versionRanges.default.JAVA
}),
win32AutomaticFix: async ({
loader
}) => {
try {
// Installing JDK 11 because later versions seem to cause issues with gradle at the moment
const installerUrl = 'https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_windows-x64_bin.zip';
const installPath = process.env.LOCALAPPDATA || ''; // The zip is in a folder `jdk-11.02` so it can be unzipped directly there
await (0, _downloadAndUnzip.downloadAndUnzip)({
loader,
downloadUrl: installerUrl,
component: 'JDK',
installPath
});
loader.text = 'Updating environment variables';
const jdkPath = (0, _path().join)(installPath, 'jdk-11.0.2');
await (0, _environmentVariables.setEnvironment)('JAVA_HOME', jdkPath);
await (0, _environmentVariables.updateEnvironment)('PATH', (0, _path().join)(jdkPath, 'bin'));
loader.succeed('JDK installed successfully. Please restart your shell to see the changes');
} catch (e) {
loader.fail(e);
}
},
runAutomaticFix: async ({
logManualInstallation,
loader
}) => {
loader.fail();
logManualInstallation({
healthcheck: 'JDK',
url: _cliTools().link.docs('environment-setup', 'android', {
hash: 'jdk-studio',
guide: 'native'
})
});
}
};
exports.default = _default;
//# sourceMappingURL=jdk.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","description","getDiagnostics","Languages","needsToBeFixed","doesSoftwareNeedToBeFixed","version","Java","versionRange","versionRanges","JAVA","win32AutomaticFix","loader","installerUrl","installPath","process","env","LOCALAPPDATA","downloadAndUnzip","downloadUrl","component","text","jdkPath","join","setEnvironment","updateEnvironment","succeed","e","fail","runAutomaticFix","logManualInstallation","healthcheck","url","link","docs","hash","guide"],"sources":["../../../src/tools/healthchecks/jdk.ts"],"sourcesContent":["import {join} from 'path';\n\nimport {link} from '@react-native-community/cli-tools';\n\nimport versionRanges from '../versionRanges';\nimport {doesSoftwareNeedToBeFixed} from '../checkInstallation';\nimport {HealthCheckInterface} from '../../types';\nimport {downloadAndUnzip} from '../downloadAndUnzip';\nimport {\n setEnvironment,\n updateEnvironment,\n} from '../windows/environmentVariables';\n\nexport default {\n label: 'JDK',\n description: 'Required to compile Java code',\n getDiagnostics: async ({Languages}) => ({\n needsToBeFixed: doesSoftwareNeedToBeFixed({\n version:\n typeof Languages.Java === 'string'\n ? Languages.Java\n : Languages.Java.version,\n versionRange: versionRanges.JAVA,\n }),\n\n version:\n typeof Languages.Java === 'string'\n ? Languages.Java\n : Languages.Java.version,\n versionRange: versionRanges.JAVA,\n }),\n win32AutomaticFix: async ({loader}) => {\n try {\n // Installing JDK 11 because later versions seem to cause issues with gradle at the moment\n const installerUrl =\n 'https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_windows-x64_bin.zip';\n const installPath = process.env.LOCALAPPDATA || ''; // The zip is in a folder `jdk-11.02` so it can be unzipped directly there\n\n await downloadAndUnzip({\n loader,\n downloadUrl: installerUrl,\n component: 'JDK',\n installPath,\n });\n\n loader.text = 'Updating environment variables';\n\n const jdkPath = join(installPath, 'jdk-11.0.2');\n\n await setEnvironment('JAVA_HOME', jdkPath);\n await updateEnvironment('PATH', join(jdkPath, 'bin'));\n\n loader.succeed(\n 'JDK installed successfully. Please restart your shell to see the changes',\n );\n } catch (e) {\n loader.fail(e as any);\n }\n },\n runAutomaticFix: async ({logManualInstallation, loader}) => {\n loader.fail();\n logManualInstallation({\n healthcheck: 'JDK',\n url: link.docs('environment-setup', 'android', {\n hash: 'jdk-studio',\n guide: 'native',\n }),\n });\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AAEA;AACA;AAGyC;AAAA,eAE1B;EACbA,KAAK,EAAE,KAAK;EACZC,WAAW,EAAE,+BAA+B;EAC5CC,cAAc,EAAE,OAAO;IAACC;EAAS,CAAC,MAAM;IACtCC,cAAc,EAAE,IAAAC,4CAAyB,EAAC;MACxCC,OAAO,EACL,OAAOH,SAAS,CAACI,IAAI,KAAK,QAAQ,GAC9BJ,SAAS,CAACI,IAAI,GACdJ,SAAS,CAACI,IAAI,CAACD,OAAO;MAC5BE,YAAY,EAAEC,sBAAa,CAACC;IAC9B,CAAC,CAAC;IAEFJ,OAAO,EACL,OAAOH,SAAS,CAACI,IAAI,KAAK,QAAQ,GAC9BJ,SAAS,CAACI,IAAI,GACdJ,SAAS,CAACI,IAAI,CAACD,OAAO;IAC5BE,YAAY,EAAEC,sBAAa,CAACC;EAC9B,CAAC,CAAC;EACFC,iBAAiB,EAAE,OAAO;IAACC;EAAM,CAAC,KAAK;IACrC,IAAI;MACF;MACA,MAAMC,YAAY,GAChB,kFAAkF;MACpF,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,YAAY,IAAI,EAAE,CAAC,CAAC;;MAEpD,MAAM,IAAAC,kCAAgB,EAAC;QACrBN,MAAM;QACNO,WAAW,EAAEN,YAAY;QACzBO,SAAS,EAAE,KAAK;QAChBN;MACF,CAAC,CAAC;MAEFF,MAAM,CAACS,IAAI,GAAG,gCAAgC;MAE9C,MAAMC,OAAO,GAAG,IAAAC,YAAI,EAACT,WAAW,EAAE,YAAY,CAAC;MAE/C,MAAM,IAAAU,oCAAc,EAAC,WAAW,EAAEF,OAAO,CAAC;MAC1C,MAAM,IAAAG,uCAAiB,EAAC,MAAM,EAAE,IAAAF,YAAI,EAACD,OAAO,EAAE,KAAK,CAAC,CAAC;MAErDV,MAAM,CAACc,OAAO,CACZ,0EAA0E,CAC3E;IACH,CAAC,CAAC,OAAOC,CAAC,EAAE;MACVf,MAAM,CAACgB,IAAI,CAACD,CAAC,CAAQ;IACvB;EACF,CAAC;EACDE,eAAe,EAAE,OAAO;IAACC,qBAAqB;IAAElB;EAAM,CAAC,KAAK;IAC1DA,MAAM,CAACgB,IAAI,EAAE;IACbE,qBAAqB,CAAC;MACpBC,WAAW,EAAE,KAAK;MAClBC,GAAG,EAAEC,gBAAI,CAACC,IAAI,CAAC,mBAAmB,EAAE,SAAS,EAAE;QAC7CC,IAAI,EAAE,YAAY;QAClBC,KAAK,EAAE;MACT,CAAC;IACH,CAAC,CAAC;EACJ;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=nodeJS.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"nodeJS.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/nodeJS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAEjD,wBAmB0B"}

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
var _checkInstallation = require("../checkInstallation");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
label: 'Node.js',
description: 'Required to execute JavaScript code',
getDiagnostics: async ({
Binaries
}) => ({
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
version: Binaries.Node.version,
versionRange: _versionRanges.default.NODE_JS
}),
version: Binaries.Node.version,
versionRange: _versionRanges.default.NODE_JS
}),
runAutomaticFix: async ({
loader,
logManualInstallation
}) => {
loader.fail();
logManualInstallation({
healthcheck: 'Node.js',
url: 'https://nodejs.org/en/download/'
});
}
};
exports.default = _default;
//# sourceMappingURL=nodeJS.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","description","getDiagnostics","Binaries","needsToBeFixed","doesSoftwareNeedToBeFixed","version","Node","versionRange","versionRanges","NODE_JS","runAutomaticFix","loader","logManualInstallation","fail","healthcheck","url"],"sources":["../../../src/tools/healthchecks/nodeJS.ts"],"sourcesContent":["import versionRanges from '../versionRanges';\nimport {doesSoftwareNeedToBeFixed} from '../checkInstallation';\nimport {HealthCheckInterface} from '../../types';\n\nexport default {\n label: 'Node.js',\n description: 'Required to execute JavaScript code',\n getDiagnostics: async ({Binaries}) => ({\n needsToBeFixed: doesSoftwareNeedToBeFixed({\n version: Binaries.Node.version,\n versionRange: versionRanges.NODE_JS,\n }),\n version: Binaries.Node.version,\n versionRange: versionRanges.NODE_JS,\n }),\n runAutomaticFix: async ({loader, logManualInstallation}) => {\n loader.fail();\n\n logManualInstallation({\n healthcheck: 'Node.js',\n url: 'https://nodejs.org/en/download/',\n });\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;AACA;AAA+D;AAAA,eAGhD;EACbA,KAAK,EAAE,SAAS;EAChBC,WAAW,EAAE,qCAAqC;EAClDC,cAAc,EAAE,OAAO;IAACC;EAAQ,CAAC,MAAM;IACrCC,cAAc,EAAE,IAAAC,4CAAyB,EAAC;MACxCC,OAAO,EAAEH,QAAQ,CAACI,IAAI,CAACD,OAAO;MAC9BE,YAAY,EAAEC,sBAAa,CAACC;IAC9B,CAAC,CAAC;IACFJ,OAAO,EAAEH,QAAQ,CAACI,IAAI,CAACD,OAAO;IAC9BE,YAAY,EAAEC,sBAAa,CAACC;EAC9B,CAAC,CAAC;EACFC,eAAe,EAAE,OAAO;IAACC,MAAM;IAAEC;EAAqB,CAAC,KAAK;IAC1DD,MAAM,CAACE,IAAI,EAAE;IAEbD,qBAAqB,CAAC;MACpBE,WAAW,EAAE,SAAS;MACtBC,GAAG,EAAE;IACP,CAAC,CAAC;EACJ;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,7 @@
import { PACKAGE_MANAGERS } from '../checkInstallation';
import { HealthCheckInterface } from '../../types';
declare const packageManager: PACKAGE_MANAGERS | undefined;
declare const yarn: HealthCheckInterface;
declare const npm: HealthCheckInterface;
export { packageManager, yarn, npm };
//# sourceMappingURL=packageManagers.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"packageManagers.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/packageManagers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAEjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AAEjD,QAAA,MAAM,cAAc,8BAUhB,CAAC;AAEL,QAAA,MAAM,IAAI,EAAE,oBAsBX,CAAC;AAEF,QAAA,MAAM,GAAG,EAAE,oBAsBV,CAAC;AAEF,OAAO,EAAC,cAAc,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC"}

View File

@@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.yarn = exports.packageManager = exports.npm = void 0;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
var _checkInstallation = require("../checkInstallation");
var _install = require("../install");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const packageManager = (() => {
if (_fs().default.existsSync('yarn.lock')) {
return _checkInstallation.PACKAGE_MANAGERS.YARN;
}
if (_fs().default.existsSync('package-lock.json')) {
return _checkInstallation.PACKAGE_MANAGERS.NPM;
}
return undefined;
})();
exports.packageManager = packageManager;
const yarn = {
label: 'yarn',
description: 'Required to install NPM dependencies',
getDiagnostics: async ({
Binaries
}) => ({
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
version: Binaries.Yarn.version,
versionRange: _versionRanges.default.YARN
}),
version: Binaries.Yarn.version,
versionRange: _versionRanges.default.YARN
}),
// Only show `yarn` if there's a `yarn.lock` file in the current directory
// or if we can't identify that the user uses yarn or npm
visible: packageManager === _checkInstallation.PACKAGE_MANAGERS.YARN || packageManager === undefined,
runAutomaticFix: async ({
loader
}) => await (0, _install.install)({
pkg: 'yarn',
label: 'yarn',
url: 'https://yarnpkg.com/docs/install',
loader
})
};
exports.yarn = yarn;
const npm = {
label: 'npm',
description: 'Required to install NPM dependencies',
getDiagnostics: async ({
Binaries
}) => ({
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
version: Binaries.npm.version,
versionRange: _versionRanges.default.NPM
}),
version: Binaries.npm.version,
versionRange: _versionRanges.default.NPM
}),
// Only show `yarn` if there's a `package-lock.json` file in the current directory
// or if we can't identify that the user uses yarn or npm
visible: packageManager === _checkInstallation.PACKAGE_MANAGERS.NPM || packageManager === undefined,
runAutomaticFix: async ({
loader
}) => await (0, _install.install)({
pkg: 'node',
label: 'node',
url: 'https://nodejs.org/',
loader
})
};
exports.npm = npm;
//# sourceMappingURL=packageManagers.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["packageManager","fs","existsSync","PACKAGE_MANAGERS","YARN","NPM","undefined","yarn","label","description","getDiagnostics","Binaries","needsToBeFixed","doesSoftwareNeedToBeFixed","version","Yarn","versionRange","versionRanges","visible","runAutomaticFix","loader","install","pkg","url","npm"],"sources":["../../../src/tools/healthchecks/packageManagers.ts"],"sourcesContent":["import fs from 'fs';\nimport versionRanges from '../versionRanges';\nimport {\n PACKAGE_MANAGERS,\n doesSoftwareNeedToBeFixed,\n} from '../checkInstallation';\nimport {install} from '../install';\nimport {HealthCheckInterface} from '../../types';\n\nconst packageManager = (() => {\n if (fs.existsSync('yarn.lock')) {\n return PACKAGE_MANAGERS.YARN;\n }\n\n if (fs.existsSync('package-lock.json')) {\n return PACKAGE_MANAGERS.NPM;\n }\n\n return undefined;\n})();\n\nconst yarn: HealthCheckInterface = {\n label: 'yarn',\n description: 'Required to install NPM dependencies',\n getDiagnostics: async ({Binaries}) => ({\n needsToBeFixed: doesSoftwareNeedToBeFixed({\n version: Binaries.Yarn.version,\n versionRange: versionRanges.YARN,\n }),\n version: Binaries.Yarn.version,\n versionRange: versionRanges.YARN,\n }),\n // Only show `yarn` if there's a `yarn.lock` file in the current directory\n // or if we can't identify that the user uses yarn or npm\n visible:\n packageManager === PACKAGE_MANAGERS.YARN || packageManager === undefined,\n runAutomaticFix: async ({loader}) =>\n await install({\n pkg: 'yarn',\n label: 'yarn',\n url: 'https://yarnpkg.com/docs/install',\n loader,\n }),\n};\n\nconst npm: HealthCheckInterface = {\n label: 'npm',\n description: 'Required to install NPM dependencies',\n getDiagnostics: async ({Binaries}) => ({\n needsToBeFixed: doesSoftwareNeedToBeFixed({\n version: Binaries.npm.version,\n versionRange: versionRanges.NPM,\n }),\n version: Binaries.npm.version,\n versionRange: versionRanges.NPM,\n }),\n // Only show `yarn` if there's a `package-lock.json` file in the current directory\n // or if we can't identify that the user uses yarn or npm\n visible:\n packageManager === PACKAGE_MANAGERS.NPM || packageManager === undefined,\n runAutomaticFix: async ({loader}) =>\n await install({\n pkg: 'node',\n label: 'node',\n url: 'https://nodejs.org/',\n loader,\n }),\n};\n\nexport {packageManager, yarn, npm};\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AAIA;AAAmC;AAGnC,MAAMA,cAAc,GAAG,CAAC,MAAM;EAC5B,IAAIC,aAAE,CAACC,UAAU,CAAC,WAAW,CAAC,EAAE;IAC9B,OAAOC,mCAAgB,CAACC,IAAI;EAC9B;EAEA,IAAIH,aAAE,CAACC,UAAU,CAAC,mBAAmB,CAAC,EAAE;IACtC,OAAOC,mCAAgB,CAACE,GAAG;EAC7B;EAEA,OAAOC,SAAS;AAClB,CAAC,GAAG;AAAC;AAEL,MAAMC,IAA0B,GAAG;EACjCC,KAAK,EAAE,MAAM;EACbC,WAAW,EAAE,sCAAsC;EACnDC,cAAc,EAAE,OAAO;IAACC;EAAQ,CAAC,MAAM;IACrCC,cAAc,EAAE,IAAAC,4CAAyB,EAAC;MACxCC,OAAO,EAAEH,QAAQ,CAACI,IAAI,CAACD,OAAO;MAC9BE,YAAY,EAAEC,sBAAa,CAACb;IAC9B,CAAC,CAAC;IACFU,OAAO,EAAEH,QAAQ,CAACI,IAAI,CAACD,OAAO;IAC9BE,YAAY,EAAEC,sBAAa,CAACb;EAC9B,CAAC,CAAC;EACF;EACA;EACAc,OAAO,EACLlB,cAAc,KAAKG,mCAAgB,CAACC,IAAI,IAAIJ,cAAc,KAAKM,SAAS;EAC1Ea,eAAe,EAAE,OAAO;IAACC;EAAM,CAAC,KAC9B,MAAM,IAAAC,gBAAO,EAAC;IACZC,GAAG,EAAE,MAAM;IACXd,KAAK,EAAE,MAAM;IACbe,GAAG,EAAE,kCAAkC;IACvCH;EACF,CAAC;AACL,CAAC;AAAC;AAEF,MAAMI,GAAyB,GAAG;EAChChB,KAAK,EAAE,KAAK;EACZC,WAAW,EAAE,sCAAsC;EACnDC,cAAc,EAAE,OAAO;IAACC;EAAQ,CAAC,MAAM;IACrCC,cAAc,EAAE,IAAAC,4CAAyB,EAAC;MACxCC,OAAO,EAAEH,QAAQ,CAACa,GAAG,CAACV,OAAO;MAC7BE,YAAY,EAAEC,sBAAa,CAACZ;IAC9B,CAAC,CAAC;IACFS,OAAO,EAAEH,QAAQ,CAACa,GAAG,CAACV,OAAO;IAC7BE,YAAY,EAAEC,sBAAa,CAACZ;EAC9B,CAAC,CAAC;EACF;EACA;EACAa,OAAO,EACLlB,cAAc,KAAKG,mCAAgB,CAACE,GAAG,IAAIL,cAAc,KAAKM,SAAS;EACzEa,eAAe,EAAE,OAAO;IAACC;EAAM,CAAC,KAC9B,MAAM,IAAAC,gBAAO,EAAC;IACZC,GAAG,EAAE,MAAM;IACXd,KAAK,EAAE,MAAM;IACbe,GAAG,EAAE,qBAAqB;IAC1BH;EACF,CAAC;AACL,CAAC;AAAC"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=packager.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"packager.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/packager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAKjD,wBA4C0B"}

View File

@@ -0,0 +1,71 @@
"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 _common = require("./common");
function _execa() {
const data = _interopRequireDefault(require("execa"));
_execa = 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 }; }
var _default = {
label: 'Metro',
isRequired: false,
description: 'Required for bundling the JavaScript code',
getDiagnostics: async () => {
const status = await (0, _cliTools().isPackagerRunning)();
const needsToBeFixed = status === 'not_running';
if (needsToBeFixed) {
return {
description: 'Metro Bundler is not running',
needsToBeFixed
};
}
return {
needsToBeFixed
};
},
runAutomaticFix: async ({
loader,
config
}) => {
loader.fail();
try {
const terminal = (0, _cliTools().getDefaultUserTerminal)();
const port = Number(process.env.RCT_METRO_PORT) || 8081;
if (terminal && config) {
await (0, _execa().default)('node', [_path().default.join(config.reactNativePath, 'cli.js'), 'start', '--port', port.toString(), '--terminal', terminal]);
return loader.succeed();
}
return (0, _common.logManualInstallation)({
message: 'Could not start the bundler. Please run "npx react-native start" command manually.'
});
} catch (error) {
return (0, _common.logManualInstallation)({
message: 'Could not start the bundler. Please run "npx react-native start" command manually.'
});
}
}
};
exports.default = _default;
//# sourceMappingURL=packager.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","isRequired","description","getDiagnostics","status","isPackagerRunning","needsToBeFixed","runAutomaticFix","loader","config","fail","terminal","getDefaultUserTerminal","port","Number","process","env","RCT_METRO_PORT","execa","path","join","reactNativePath","toString","succeed","logManualInstallation","message","error"],"sources":["../../../src/tools/healthchecks/packager.ts"],"sourcesContent":["import {\n getDefaultUserTerminal,\n isPackagerRunning,\n} from '@react-native-community/cli-tools';\nimport {HealthCheckInterface} from '../../types';\nimport {logManualInstallation} from './common';\nimport execa from 'execa';\nimport path from 'path';\n\nexport default {\n label: 'Metro',\n isRequired: false,\n description: 'Required for bundling the JavaScript code',\n getDiagnostics: async () => {\n const status = await isPackagerRunning();\n const needsToBeFixed = status === 'not_running';\n if (needsToBeFixed) {\n return {\n description: 'Metro Bundler is not running',\n needsToBeFixed,\n };\n }\n return {\n needsToBeFixed,\n };\n },\n runAutomaticFix: async ({loader, config}) => {\n loader.fail();\n try {\n const terminal = getDefaultUserTerminal();\n const port = Number(process.env.RCT_METRO_PORT) || 8081;\n if (terminal && config) {\n await execa('node', [\n path.join(config.reactNativePath, 'cli.js'),\n 'start',\n '--port',\n port.toString(),\n '--terminal',\n terminal,\n ]);\n return loader.succeed();\n }\n return logManualInstallation({\n message:\n 'Could not start the bundler. Please run \"npx react-native start\" command manually.',\n });\n } catch (error) {\n return logManualInstallation({\n message:\n 'Could not start the bundler. Please run \"npx react-native start\" command manually.',\n });\n }\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwB;AAAA,eAET;EACbA,KAAK,EAAE,OAAO;EACdC,UAAU,EAAE,KAAK;EACjBC,WAAW,EAAE,2CAA2C;EACxDC,cAAc,EAAE,YAAY;IAC1B,MAAMC,MAAM,GAAG,MAAM,IAAAC,6BAAiB,GAAE;IACxC,MAAMC,cAAc,GAAGF,MAAM,KAAK,aAAa;IAC/C,IAAIE,cAAc,EAAE;MAClB,OAAO;QACLJ,WAAW,EAAE,8BAA8B;QAC3CI;MACF,CAAC;IACH;IACA,OAAO;MACLA;IACF,CAAC;EACH,CAAC;EACDC,eAAe,EAAE,OAAO;IAACC,MAAM;IAAEC;EAAM,CAAC,KAAK;IAC3CD,MAAM,CAACE,IAAI,EAAE;IACb,IAAI;MACF,MAAMC,QAAQ,GAAG,IAAAC,kCAAsB,GAAE;MACzC,MAAMC,IAAI,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,cAAc,CAAC,IAAI,IAAI;MACvD,IAAIN,QAAQ,IAAIF,MAAM,EAAE;QACtB,MAAM,IAAAS,gBAAK,EAAC,MAAM,EAAE,CAClBC,eAAI,CAACC,IAAI,CAACX,MAAM,CAACY,eAAe,EAAE,QAAQ,CAAC,EAC3C,OAAO,EACP,QAAQ,EACRR,IAAI,CAACS,QAAQ,EAAE,EACf,YAAY,EACZX,QAAQ,CACT,CAAC;QACF,OAAOH,MAAM,CAACe,OAAO,EAAE;MACzB;MACA,OAAO,IAAAC,6BAAqB,EAAC;QAC3BC,OAAO,EACL;MACJ,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,OAAO,IAAAF,6BAAqB,EAAC;QAC3BC,OAAO,EACL;MACJ,CAAC,CAAC;IACJ;EACF;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,11 @@
import { HealthCheckInterface } from '../../types';
export declare const output: {
readonly OK: "Ok";
readonly NO_GEMFILE: "No Gemfile";
readonly NO_RUBY: "No Ruby";
readonly BUNDLE_INVALID_RUBY: "Bundle invalid Ruby";
readonly UNKNOWN: "Unknown";
};
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=ruby.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ruby.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/ruby.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AAIjD,eAAO,MAAM,MAAM;;;;;;CAMT,CAAC;;AA0FX,wBA2E0B"}

View File

@@ -0,0 +1,202 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.output = exports.default = void 0;
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 _versionRanges = _interopRequireDefault(require("../versionRanges"));
var _checkInstallation = require("../checkInstallation");
var _common = require("./common");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Exposed for testing only
const output = {
OK: 'Ok',
NO_GEMFILE: 'No Gemfile',
NO_RUBY: 'No Ruby',
BUNDLE_INVALID_RUBY: 'Bundle invalid Ruby',
UNKNOWN: 'Unknown'
};
// The Change:
// -----------
//
// React Native 0.72 primarily defines the compatible version of Ruby in the
// project's Gemfile [1]. It does this because it allows for ranges instead of
// pinning to a version of Ruby.
//
// In previous versions the .ruby-version file defined the compatible version,
// and it was derived in the Gemfile [2]:
//
// > ruby File.read(File.join(__dir__, '.ruby-version')).strip
//
// Why all of the changes with Ruby?
// ---------------------------------
//
// React Native has had to weigh up a couple of concerns:
//
// - Cocoapods: we don't control the minimum supported version, although that
// was defined almost a decade ago [3]. Practically system Ruby on macOS works
// for our users.
//
// - Apple may drop support for scripting language runtimes in future version of
// macOS [4]. Ruby 2.7 is effectively EOL, which means many supporting tools and
// developer environments _may_ not support it going forward, and 3.0 is becoming
// the default in, for example, places like our CI. Some users may be unable to
// install Ruby 2.7 on their devices as a matter of policy.
//
// - Our Codegen is extensively built in Ruby 2.7.
//
// - A common pain-point for users (old and new) setting up their environment is
// configuring a Ruby version manager or managing multiple Ruby versions on their
// device. This occurs so frequently that we've removed the step from our docs [6]
//
// After users suggested bumping Ruby to 3.1.3 [5], a discussion concluded that
// allowing a range of version of Ruby (>= 2.6.10) was the best way forward. This
// balanced the need to make the platform easier to start with, but unblocked more
// sophisticated users.
//
// [1] https://github.com/facebook/react-native/pull/36281
// [2] https://github.com/facebook/react-native/blob/v0.71.3/Gemfile#L4
// [3] https://github.com/CocoaPods/guides.cocoapods.org/commit/30881800ac2bd431d9c5d7ee74404b13e7f43888
// [4] https://developer.apple.com/documentation/macos-release-notes/macos-catalina-10_15-release-notes#Scripting-Language-Runtimes
// [5] https://github.com/facebook/react-native/pull/36074
// [6] https://github.com/facebook/react-native-website/commit/8db97602347a8623f21e3e516245d04bdf6f1a29
exports.output = output;
async function checkRubyGemfileRequirement(projectRoot) {
const evaluateGemfile = (0, _common.inline)`
require "Bundler"
gemfile = Bundler::Definition.build("Gemfile", nil, {})
version = gemfile.ruby_version.engine_versions.join(", ")
begin
gemfile.validate_runtime!
rescue Bundler::GemfileNotFound
puts "${output.NO_GEMFILE}"
exit 1
rescue Bundler::RubyVersionMismatch
puts "${output.BUNDLE_INVALID_RUBY}"
STDERR.puts version
exit 2
rescue => e
STDERR e.message
exit 3
else
puts "${output.OK}"
STDERR.puts version
end`;
try {
await (0, _execa().default)('ruby', ['-e', evaluateGemfile], {
cwd: projectRoot
});
return [output.OK];
} catch (e) {
switch (e.code) {
case 'ENOENT':
return [output.NO_RUBY];
case 1:
return [output.NO_GEMFILE];
case 2:
return [output.BUNDLE_INVALID_RUBY, e.stderr];
default:
return [output.UNKNOWN, e.message];
}
}
}
var _default = {
label: 'Ruby',
isRequired: false,
description: 'Required for installing iOS dependencies',
getDiagnostics: async ({
Languages
}) => {
let projectRoot;
try {
projectRoot = (0, _cliTools().findProjectRoot)();
} catch (e) {
_cliTools().logger.debug(e.message);
}
const fallbackResult = {
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
version: Languages.Ruby.version,
versionRange: _versionRanges.default.RUBY
}),
version: Languages.Ruby.version,
versionRange: _versionRanges.default.RUBY,
description: ''
};
// No guidance from the project, so we make the best guess
if (!projectRoot) {
return fallbackResult;
}
// Gemfile
let [code, versionOrError] = await checkRubyGemfileRequirement(projectRoot);
switch (code) {
case output.OK:
{
return {
needsToBeFixed: false,
version: Languages.Ruby.version,
versionRange: versionOrError
};
}
case output.BUNDLE_INVALID_RUBY:
return {
needsToBeFixed: true,
version: Languages.Ruby.version,
versionRange: versionOrError
};
case output.NO_RUBY:
return {
needsToBeFixed: true,
description: 'Cannot find a working copy of Ruby.'
};
case output.NO_GEMFILE:
fallbackResult.description = `Could not find the project ${_chalk().default.bold('Gemfile')} in your project folder (${_chalk().default.dim(projectRoot)}), guessed using my built-in version.`;
break;
default:
if (versionOrError) {
_cliTools().logger.warn(versionOrError);
}
break;
}
return fallbackResult;
},
runAutomaticFix: async ({
loader,
logManualInstallation
}) => {
loader.fail();
logManualInstallation({
healthcheck: 'Ruby',
url: _cliTools().link.docs('environment-setup', 'ios', {
hash: 'ruby',
guide: 'native'
})
});
}
};
exports.default = _default;
//# sourceMappingURL=ruby.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=watchman.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"watchman.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/watchman.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAIjD,wBAe0B"}

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _install = require("../install");
const label = 'Watchman';
var _default = {
label,
isRequired: false,
description: 'Used for watching changes in the filesystem when in development mode',
getDiagnostics: async ({
Binaries
}) => ({
needsToBeFixed: Boolean(Binaries.Watchman.version) === false
}),
runAutomaticFix: async ({
loader
}) => await (0, _install.install)({
pkg: 'watchman',
label,
url: 'https://facebook.github.io/watchman/docs/install.html',
loader
})
};
exports.default = _default;
//# sourceMappingURL=watchman.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","isRequired","description","getDiagnostics","Binaries","needsToBeFixed","Boolean","Watchman","version","runAutomaticFix","loader","install","pkg","url"],"sources":["../../../src/tools/healthchecks/watchman.ts"],"sourcesContent":["import {install} from '../install';\nimport {HealthCheckInterface} from '../../types';\n\nconst label = 'Watchman';\n\nexport default {\n label,\n isRequired: false,\n description:\n 'Used for watching changes in the filesystem when in development mode',\n getDiagnostics: async ({Binaries}) => ({\n needsToBeFixed: Boolean(Binaries.Watchman.version) === false,\n }),\n runAutomaticFix: async ({loader}) =>\n await install({\n pkg: 'watchman',\n label,\n url: 'https://facebook.github.io/watchman/docs/install.html',\n loader,\n }),\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;AAGA,MAAMA,KAAK,GAAG,UAAU;AAAC,eAEV;EACbA,KAAK;EACLC,UAAU,EAAE,KAAK;EACjBC,WAAW,EACT,sEAAsE;EACxEC,cAAc,EAAE,OAAO;IAACC;EAAQ,CAAC,MAAM;IACrCC,cAAc,EAAEC,OAAO,CAACF,QAAQ,CAACG,QAAQ,CAACC,OAAO,CAAC,KAAK;EACzD,CAAC,CAAC;EACFC,eAAe,EAAE,OAAO;IAACC;EAAM,CAAC,KAC9B,MAAM,IAAAC,gBAAO,EAAC;IACZC,GAAG,EAAE,UAAU;IACfZ,KAAK;IACLa,GAAG,EAAE,uDAAuD;IAC5DH;EACF,CAAC;AACL,CAAC;AAAA"}

View File

@@ -0,0 +1,4 @@
import { HealthCheckInterface } from '../../types';
declare const _default: HealthCheckInterface;
export default _default;
//# sourceMappingURL=xcode.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../../src/tools/healthchecks/xcode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;AAEjD,wBAuB0B"}

View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
var _checkInstallation = require("../checkInstallation");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
label: 'Xcode',
description: 'Required for building and installing your app on iOS',
getDiagnostics: async ({
IDEs
}) => {
const version = IDEs.Xcode.version.split('/')[0];
return {
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
version,
versionRange: _versionRanges.default.XCODE
}),
version,
versionRange: _versionRanges.default.XCODE
};
},
runAutomaticFix: async ({
loader,
logManualInstallation
}) => {
loader.fail();
logManualInstallation({
healthcheck: 'Xcode',
url: 'https://developer.apple.com/xcode/'
});
}
};
exports.default = _default;
//# sourceMappingURL=xcode.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["label","description","getDiagnostics","IDEs","version","Xcode","split","needsToBeFixed","doesSoftwareNeedToBeFixed","versionRange","versionRanges","XCODE","runAutomaticFix","loader","logManualInstallation","fail","healthcheck","url"],"sources":["../../../src/tools/healthchecks/xcode.ts"],"sourcesContent":["import versionRanges from '../versionRanges';\nimport {doesSoftwareNeedToBeFixed} from '../checkInstallation';\nimport {HealthCheckInterface} from '../../types';\n\nexport default {\n label: 'Xcode',\n description: 'Required for building and installing your app on iOS',\n getDiagnostics: async ({IDEs}) => {\n const version = IDEs.Xcode.version.split('/')[0];\n\n return {\n needsToBeFixed: doesSoftwareNeedToBeFixed({\n version,\n versionRange: versionRanges.XCODE,\n }),\n version,\n versionRange: versionRanges.XCODE,\n };\n },\n runAutomaticFix: async ({loader, logManualInstallation}) => {\n loader.fail();\n\n logManualInstallation({\n healthcheck: 'Xcode',\n url: 'https://developer.apple.com/xcode/',\n });\n },\n} as HealthCheckInterface;\n"],"mappings":";;;;;;AAAA;AACA;AAA+D;AAAA,eAGhD;EACbA,KAAK,EAAE,OAAO;EACdC,WAAW,EAAE,sDAAsD;EACnEC,cAAc,EAAE,OAAO;IAACC;EAAI,CAAC,KAAK;IAChC,MAAMC,OAAO,GAAGD,IAAI,CAACE,KAAK,CAACD,OAAO,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEhD,OAAO;MACLC,cAAc,EAAE,IAAAC,4CAAyB,EAAC;QACxCJ,OAAO;QACPK,YAAY,EAAEC,sBAAa,CAACC;MAC9B,CAAC,CAAC;MACFP,OAAO;MACPK,YAAY,EAAEC,sBAAa,CAACC;IAC9B,CAAC;EACH,CAAC;EACDC,eAAe,EAAE,OAAO;IAACC,MAAM;IAAEC;EAAqB,CAAC,KAAK;IAC1DD,MAAM,CAACE,IAAI,EAAE;IAEbD,qBAAqB,CAAC;MACpBE,WAAW,EAAE,OAAO;MACpBC,GAAG,EAAE;IACP,CAAC,CAAC;EACJ;AACF,CAAC;AAAA"}

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