Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// @flow
import chalk from 'chalk';
import Ora from 'ora';
// $FlowFixMe - converted to TS
import {Ora} from 'ora';
import {logManualInstallation} from './common';
import type {HealthCheckInterface} from '../types';
import {HealthCheckInterface} from '../types';

// List of answers on how to set `ANDROID_HOME` for each platform
const URLS = {
Expand All @@ -14,20 +12,24 @@ const URLS = {

const label = 'ANDROID_HOME';

// Force the options for the platform to avoid providing a link
// for `ANDROID_HOME` for every platform NodeJS supports
const platform = process.platform as 'darwin' | 'win32' | 'linux';

const message = `Read more about how to set the ${label} at ${chalk.dim(
URLS[process.platform],
URLS[platform],
)}.`;

export default ({
export default {
label,
getDiagnostics: async () => ({
needsToBeFixed: !process.env.ANDROID_HOME && message,
}),
runAutomaticFix: async ({loader}: {loader: typeof Ora}) => {
runAutomaticFix: async ({loader}: {loader: Ora}) => {
loader.info();

logManualInstallation({
message,
});
},
}: HealthCheckInterface);
} as HealthCheckInterface;
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// @flow
import chalk from 'chalk';
import Ora from 'ora';
// $FlowFixMe - converted to TS
import {Ora} from 'ora';
import {logManualInstallation} from './common';
// $FlowFixMe - converted to TS
import versionRanges from '../versionRanges';
// $FlowFixMe - converted to TS
import {doesSoftwareNeedToBeFixed} from '../checkInstallation';
import type {EnvironmentInfo, HealthCheckInterface} from '../types';
import {EnvironmentInfo, HealthCheckInterface} from '../types';

export default ({
export default {
label: 'Android NDK',
getDiagnostics: async ({SDKs}: EnvironmentInfo) => ({
needsToBeFixed: doesSoftwareNeedToBeFixed({
Expand All @@ -21,8 +17,8 @@ export default ({
loader,
environmentInfo,
}: {
loader: typeof Ora,
environmentInfo: EnvironmentInfo,
loader: Ora;
environmentInfo: EnvironmentInfo;
}) => {
const version = environmentInfo.SDKs['Android SDK']['Android NDK'];
const isNDKInstalled = version !== 'Not Found';
Expand All @@ -42,4 +38,4 @@ export default ({
url: 'https://developer.android.com/ndk/downloads',
});
},
}: HealthCheckInterface);
} as HealthCheckInterface;
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
// @flow
// $FlowFixMe - converted to TS
import {checkSoftwareInstalled} from '../checkInstallation';
// $FlowFixMe - converted to TS
import {installCocoaPods} from '../../../tools/installPods';
import {type HealthCheckInterface} from '../types';
import {HealthCheckInterface} from '../types';

export default ({
export default {
label: 'CocoaPods',
getDiagnostics: async () => ({
needsToBeFixed: await checkSoftwareInstalled('pod'),
}),
runAutomaticFix: async ({loader}) => await installCocoaPods(loader),
}: HealthCheckInterface);
} as HealthCheckInterface;
3 changes: 3 additions & 0 deletions packages/cli/src/commands/doctor/healthchecks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
import nodeJS from './nodeJS';
import {yarn, npm} from './packageManagers';
import watchman from './watchman';
// $FlowFixMe - converted to TS
import androidHomeEnvVariable from './androidHomeEnvVariable';
import androidSDK from './androidSDK';
// $FlowFixMe - converted to TS
import androidNDK from './androidNDK';
import xcode from './xcode';
// $FlowFixMe - converted to TS
import cocoaPods from './cocoaPods';
import iosDeploy from './iosDeploy';

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/doctor/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ora from 'ora';
import {Ora} from 'ora';

export type EnvironmentInfo = {
System: {
Expand Down Expand Up @@ -72,7 +72,7 @@ export type HealthCheckInterface = {
environmentInfo: EnvironmentInfo,
) => Promise<{version?: string; needsToBeFixed: boolean | string}>;
runAutomaticFix: (args: {
loader: typeof Ora;
loader: Ora;
environmentInfo: EnvironmentInfo;
}) => Promise<void> | void;
};