@@ -15,6 +15,7 @@ import {Healthchecks, HealthCheckCategory} from '../../types';
1515import loadConfig from '@react-native-community/cli-config' ;
1616import xcodeEnv from './xcodeEnv' ;
1717import packager from './packager' ;
18+ import deepmerge from 'deepmerge' ;
1819
1920export const HEALTHCHECK_TYPES = {
2021 ERROR : 'ERROR' ,
@@ -29,20 +30,40 @@ type Options = {
2930export const getHealthchecks = ( { contributor} : Options ) : Healthchecks => {
3031 let additionalChecks : HealthCheckCategory [ ] = [ ] ;
3132
33+ let projectSpecificHealthchecks = { } ;
34+
3235 // Doctor can run in a detached mode, where there isn't a config so this can fail
3336 try {
3437 let config = loadConfig ( ) ;
3538 additionalChecks = config . healthChecks ;
39+
40+ if ( config ) {
41+ projectSpecificHealthchecks = {
42+ common : {
43+ label : 'Common' ,
44+ healthchecks : [ packager ] ,
45+ } ,
46+ android : {
47+ label : 'Android' ,
48+ healthchecks : [ androidSDK ] ,
49+ } ,
50+ ...( process . platform === 'darwin' && {
51+ ios : {
52+ label : 'iOS' ,
53+ healthchecks : [ xcodeEnv ] ,
54+ } ,
55+ } ) ,
56+ } ;
57+ }
3658 } catch { }
3759
38- return {
60+ const defaultHealthchecks = {
3961 common : {
4062 label : 'Common' ,
4163 healthchecks : [
4264 nodeJS ,
4365 yarn ,
4466 npm ,
45- packager ,
4667 ...( process . platform === 'darwin' ? [ watchman ] : [ ] ) ,
4768 ] ,
4869 } ,
@@ -52,7 +73,6 @@ export const getHealthchecks = ({contributor}: Options): Healthchecks => {
5273 adb ,
5374 jdk ,
5475 androidStudio ,
55- androidSDK ,
5676 androidHomeEnvVariable ,
5777 ...( contributor ? [ androidNDK ] : [ ] ) ,
5878 ] ,
@@ -61,10 +81,12 @@ export const getHealthchecks = ({contributor}: Options): Healthchecks => {
6181 ? {
6282 ios : {
6383 label : 'iOS' ,
64- healthchecks : [ xcode , ruby , cocoaPods , iosDeploy , xcodeEnv ] ,
84+ healthchecks : [ xcode , ruby , cocoaPods , iosDeploy ] ,
6585 } ,
6686 }
6787 : { } ) ,
6888 ...additionalChecks ,
6989 } ;
90+
91+ return deepmerge ( defaultHealthchecks , projectSpecificHealthchecks ) ;
7092} ;
0 commit comments