From 9d96b68eb388a212114ab552d4716d9bd0837dc6 Mon Sep 17 00:00:00 2001 From: ph0ph0 Date: Fri, 14 Feb 2020 17:17:06 +0000 Subject: [PATCH 1/5] If versionsToShow is not an array, return N/A --- packages/cli/src/commands/doctor/doctor.ts | 82 ++++++++++++---------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/packages/cli/src/commands/doctor/doctor.ts b/packages/cli/src/commands/doctor/doctor.ts index 205e85826..1eae2d766 100644 --- a/packages/cli/src/commands/doctor/doctor.ts +++ b/packages/cli/src/commands/doctor/doctor.ts @@ -23,7 +23,9 @@ const printCategory = ({label, key}: {label: string; key: number}) => { const printVersions = ({version, versions, versionRange}) => { if (versions) { - const versionsToShow = versions.join(', '); + const versionsToShow = Array.isArray(versions) + ? versions.join(', ') + : 'N/A'; logMessage(`- Versions found: ${chalk.red(versionsToShow)}`); logMessage(`- Version supported: ${chalk.green(versionRange)}`); @@ -92,40 +94,42 @@ export default (async (_, __, options) => { healthchecks, }: HealthCheckCategory): Promise => ({ label, - healthchecks: (await Promise.all( - healthchecks.map(async healthcheck => { - if (healthcheck.visible === false) { - return; - } - - const { - needsToBeFixed, - version, - versions, - versionRange, - } = await healthcheck.getDiagnostics(environmentInfo); - - // 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: healthcheck.description, - runAutomaticFix: healthcheck.runAutomaticFix, - isRequired, - type: needsToBeFixed - ? isWarning - ? HEALTHCHECK_TYPES.WARNING - : HEALTHCHECK_TYPES.ERROR - : undefined, - }; - }), - )).filter(healthcheck => healthcheck !== undefined) as HealthCheckResult[], + healthchecks: ( + await Promise.all( + healthchecks.map(async healthcheck => { + if (healthcheck.visible === false) { + return; + } + + const { + needsToBeFixed, + version, + versions, + versionRange, + } = await healthcheck.getDiagnostics(environmentInfo); + + // 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: healthcheck.description, + runAutomaticFix: healthcheck.runAutomaticFix, + isRequired, + type: needsToBeFixed + ? isWarning + ? HEALTHCHECK_TYPES.WARNING + : HEALTHCHECK_TYPES.ERROR + : undefined, + }; + }), + ) + ).filter(healthcheck => healthcheck !== undefined) as HealthCheckResult[], }); // Remove all the categories that don't have any healthcheck with @@ -139,9 +143,11 @@ export default (async (_, __, options) => { const iterateOverCategories = (categories: HealthCheckCategory[]) => Promise.all(categories.map(iterateOverHealthChecks)); - const healthchecksPerCategory = await iterateOverCategories(Object.values( - getHealthchecks(options), - ).filter(category => category !== undefined) as HealthCheckCategory[]); + const healthchecksPerCategory = await iterateOverCategories( + Object.values(getHealthchecks(options)).filter( + category => category !== undefined, + ) as HealthCheckCategory[], + ); loader.stop(); From cac45ba9b7352e3ca9f2b7f00e84cb26de0ca5c0 Mon Sep 17 00:00:00 2001 From: ph0ph0 Date: Fri, 14 Feb 2020 17:17:06 +0000 Subject: [PATCH 2/5] If versionsToShow is not an array, return N/A --- .../doctor/.history/doctor_20200214170855.ts | 229 ++++++++++++++++++ packages/cli/src/commands/doctor/doctor.ts | 82 ++++--- 2 files changed, 273 insertions(+), 38 deletions(-) create mode 100644 packages/cli/src/commands/doctor/.history/doctor_20200214170855.ts diff --git a/packages/cli/src/commands/doctor/.history/doctor_20200214170855.ts b/packages/cli/src/commands/doctor/.history/doctor_20200214170855.ts new file mode 100644 index 000000000..205e85826 --- /dev/null +++ b/packages/cli/src/commands/doctor/.history/doctor_20200214170855.ts @@ -0,0 +1,229 @@ +import chalk from 'chalk'; +import {logger} from '@react-native-community/cli-tools'; +import {getHealthchecks, HEALTHCHECK_TYPES} from './healthchecks'; +import {getLoader} from '../../tools/loader'; +import printFixOptions, {KEYS} from './printFixOptions'; +import runAutomaticFix, {AUTOMATIC_FIX_LEVELS} from './runAutomaticFix'; +import {CommandFunction} from '@react-native-community/cli-types'; +import { + HealthCheckCategory, + HealthCheckCategoryResult, + HealthCheckResult, +} from './types'; +import getEnvironmentInfo from '../../tools/envinfo'; +import {logMessage} from './healthchecks/common'; + +const printCategory = ({label, key}: {label: string; key: number}) => { + if (key > 0) { + logger.log(); + } + + logger.log(chalk.dim(label)); +}; + +const printVersions = ({version, versions, versionRange}) => { + if (versions) { + const versionsToShow = versions.join(', '); + + logMessage(`- Versions found: ${chalk.red(versionsToShow)}`); + logMessage(`- Version supported: ${chalk.green(versionRange)}`); + + return; + } + + const versionsToShow = version && version !== 'Not Found' ? version : 'N/A'; + + logMessage(`- Version found: ${chalk.red(versionsToShow)}`); + logMessage(`- Version supported: ${chalk.green(versionRange)}`); + + return; +}; + +const printIssue = ({ + label, + needsToBeFixed, + version, + versions, + versionRange, + isRequired, + description, +}: HealthCheckResult) => { + const symbol = needsToBeFixed + ? isRequired + ? chalk.red('✖') + : chalk.yellow('●') + : chalk.green('✓'); + + const descriptionToShow = description ? ` - ${description}` : ''; + + logger.log(` ${symbol} ${label}${descriptionToShow}`); + + if (needsToBeFixed && versionRange) { + return printVersions({version, versions, versionRange}); + } +}; + +const printOverallStats = ({ + errors, + warnings, +}: { + errors: number; + warnings: number; +}) => { + logger.log(`\n${chalk.bold('Errors:')} ${errors}`); + logger.log(`${chalk.bold('Warnings:')} ${warnings}`); +}; + +type FlagsT = { + fix: boolean | void; + contributor: boolean | void; +}; + +export default (async (_, __, options) => { + const Loader = getLoader(); + const loader = new Loader(); + + loader.start('Running diagnostics...'); + + const environmentInfo = await getEnvironmentInfo(); + + const iterateOverHealthChecks = async ({ + label, + healthchecks, + }: HealthCheckCategory): Promise => ({ + label, + healthchecks: (await Promise.all( + healthchecks.map(async healthcheck => { + if (healthcheck.visible === false) { + return; + } + + const { + needsToBeFixed, + version, + versions, + versionRange, + } = await healthcheck.getDiagnostics(environmentInfo); + + // 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: healthcheck.description, + runAutomaticFix: healthcheck.runAutomaticFix, + isRequired, + type: needsToBeFixed + ? isWarning + ? HEALTHCHECK_TYPES.WARNING + : HEALTHCHECK_TYPES.ERROR + : undefined, + }; + }), + )).filter(healthcheck => healthcheck !== undefined) as HealthCheckResult[], + }); + + // 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: HealthCheckCategoryResult[]) => + categories.filter(category => + category.healthchecks.some(healthcheck => healthcheck.needsToBeFixed), + ); + + const iterateOverCategories = (categories: HealthCheckCategory[]) => + Promise.all(categories.map(iterateOverHealthChecks)); + + const healthchecksPerCategory = await iterateOverCategories(Object.values( + getHealthchecks(options), + ).filter(category => category !== undefined) as HealthCheckCategory[]); + + loader.stop(); + + const stats = { + errors: 0, + warnings: 0, + }; + + healthchecksPerCategory.forEach((issueCategory, key) => { + printCategory({...issueCategory, key}); + + issueCategory.healthchecks.forEach(healthcheck => { + printIssue(healthcheck); + + if (healthcheck.type === HEALTHCHECK_TYPES.WARNING) { + stats.warnings++; + return; + } + + if (healthcheck.type === HEALTHCHECK_TYPES.ERROR) { + stats.errors++; + return; + } + }); + }); + + printOverallStats(stats); + + if (options.fix) { + return await runAutomaticFix({ + healthchecks: removeFixedCategories(healthchecksPerCategory), + automaticFixLevel: AUTOMATIC_FIX_LEVELS.ALL_ISSUES, + stats, + loader, + environmentInfo, + }); + } + + const removeKeyPressListener = () => { + if (typeof process.stdin.setRawMode === 'function') { + process.stdin.setRawMode(false); + } + process.stdin.removeAllListeners('data'); + }; + + const onKeyPress = async (key: string) => { + if (key === KEYS.EXIT || key === '\u0003') { + removeKeyPressListener(); + + process.exit(0); + return; + } + + if ( + [KEYS.FIX_ALL_ISSUES, KEYS.FIX_ERRORS, KEYS.FIX_WARNINGS].includes(key) + ) { + removeKeyPressListener(); + + try { + const automaticFixLevel = { + [KEYS.FIX_ALL_ISSUES]: AUTOMATIC_FIX_LEVELS.ALL_ISSUES, + [KEYS.FIX_ERRORS]: AUTOMATIC_FIX_LEVELS.ERRORS, + [KEYS.FIX_WARNINGS]: AUTOMATIC_FIX_LEVELS.WARNINGS, + }; + + await runAutomaticFix({ + healthchecks: removeFixedCategories(healthchecksPerCategory), + automaticFixLevel: automaticFixLevel[key], + stats, + loader, + environmentInfo, + }); + + process.exit(0); + } catch (err) { + // TODO: log error + process.exit(1); + } + } + }; + + if (stats.errors || stats.warnings) { + printFixOptions({onKeyPress}); + } +}) as CommandFunction; diff --git a/packages/cli/src/commands/doctor/doctor.ts b/packages/cli/src/commands/doctor/doctor.ts index 205e85826..1eae2d766 100644 --- a/packages/cli/src/commands/doctor/doctor.ts +++ b/packages/cli/src/commands/doctor/doctor.ts @@ -23,7 +23,9 @@ const printCategory = ({label, key}: {label: string; key: number}) => { const printVersions = ({version, versions, versionRange}) => { if (versions) { - const versionsToShow = versions.join(', '); + const versionsToShow = Array.isArray(versions) + ? versions.join(', ') + : 'N/A'; logMessage(`- Versions found: ${chalk.red(versionsToShow)}`); logMessage(`- Version supported: ${chalk.green(versionRange)}`); @@ -92,40 +94,42 @@ export default (async (_, __, options) => { healthchecks, }: HealthCheckCategory): Promise => ({ label, - healthchecks: (await Promise.all( - healthchecks.map(async healthcheck => { - if (healthcheck.visible === false) { - return; - } - - const { - needsToBeFixed, - version, - versions, - versionRange, - } = await healthcheck.getDiagnostics(environmentInfo); - - // 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: healthcheck.description, - runAutomaticFix: healthcheck.runAutomaticFix, - isRequired, - type: needsToBeFixed - ? isWarning - ? HEALTHCHECK_TYPES.WARNING - : HEALTHCHECK_TYPES.ERROR - : undefined, - }; - }), - )).filter(healthcheck => healthcheck !== undefined) as HealthCheckResult[], + healthchecks: ( + await Promise.all( + healthchecks.map(async healthcheck => { + if (healthcheck.visible === false) { + return; + } + + const { + needsToBeFixed, + version, + versions, + versionRange, + } = await healthcheck.getDiagnostics(environmentInfo); + + // 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: healthcheck.description, + runAutomaticFix: healthcheck.runAutomaticFix, + isRequired, + type: needsToBeFixed + ? isWarning + ? HEALTHCHECK_TYPES.WARNING + : HEALTHCHECK_TYPES.ERROR + : undefined, + }; + }), + ) + ).filter(healthcheck => healthcheck !== undefined) as HealthCheckResult[], }); // Remove all the categories that don't have any healthcheck with @@ -139,9 +143,11 @@ export default (async (_, __, options) => { const iterateOverCategories = (categories: HealthCheckCategory[]) => Promise.all(categories.map(iterateOverHealthChecks)); - const healthchecksPerCategory = await iterateOverCategories(Object.values( - getHealthchecks(options), - ).filter(category => category !== undefined) as HealthCheckCategory[]); + const healthchecksPerCategory = await iterateOverCategories( + Object.values(getHealthchecks(options)).filter( + category => category !== undefined, + ) as HealthCheckCategory[], + ); loader.stop(); From 91bd34c33f0b0258c56c0df6aa0d7fe58ad60bb7 Mon Sep 17 00:00:00 2001 From: ph0ph0 Date: Sat, 15 Feb 2020 15:09:15 +0000 Subject: [PATCH 3/5] ran yarn lint --fix --- packages/cli/src/commands/doctor/doctor.ts | 78 ++++++++++------------ 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/packages/cli/src/commands/doctor/doctor.ts b/packages/cli/src/commands/doctor/doctor.ts index 1eae2d766..7c07cda47 100644 --- a/packages/cli/src/commands/doctor/doctor.ts +++ b/packages/cli/src/commands/doctor/doctor.ts @@ -94,42 +94,40 @@ export default (async (_, __, options) => { healthchecks, }: HealthCheckCategory): Promise => ({ label, - healthchecks: ( - await Promise.all( - healthchecks.map(async healthcheck => { - if (healthcheck.visible === false) { - return; - } - - const { - needsToBeFixed, - version, - versions, - versionRange, - } = await healthcheck.getDiagnostics(environmentInfo); - - // 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: healthcheck.description, - runAutomaticFix: healthcheck.runAutomaticFix, - isRequired, - type: needsToBeFixed - ? isWarning - ? HEALTHCHECK_TYPES.WARNING - : HEALTHCHECK_TYPES.ERROR - : undefined, - }; - }), - ) - ).filter(healthcheck => healthcheck !== undefined) as HealthCheckResult[], + healthchecks: (await Promise.all( + healthchecks.map(async healthcheck => { + if (healthcheck.visible === false) { + return; + } + + const { + needsToBeFixed, + version, + versions, + versionRange, + } = await healthcheck.getDiagnostics(environmentInfo); + + // 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: healthcheck.description, + runAutomaticFix: healthcheck.runAutomaticFix, + isRequired, + type: needsToBeFixed + ? isWarning + ? HEALTHCHECK_TYPES.WARNING + : HEALTHCHECK_TYPES.ERROR + : undefined, + }; + }), + )).filter(healthcheck => healthcheck !== undefined) as HealthCheckResult[], }); // Remove all the categories that don't have any healthcheck with @@ -143,11 +141,9 @@ export default (async (_, __, options) => { const iterateOverCategories = (categories: HealthCheckCategory[]) => Promise.all(categories.map(iterateOverHealthChecks)); - const healthchecksPerCategory = await iterateOverCategories( - Object.values(getHealthchecks(options)).filter( - category => category !== undefined, - ) as HealthCheckCategory[], - ); + const healthchecksPerCategory = await iterateOverCategories(Object.values( + getHealthchecks(options), + ).filter(category => category !== undefined) as HealthCheckCategory[]); loader.stop(); From b987714cdd19e01ad8b665bd4124427d406166bc Mon Sep 17 00:00:00 2001 From: ph0ph0 Date: Sun, 16 Feb 2020 15:51:46 +0000 Subject: [PATCH 4/5] updated HealthCheckResult types to account for versions being either an array of strings or a string --- packages/cli/src/commands/doctor/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/commands/doctor/types.ts b/packages/cli/src/commands/doctor/types.ts index 9f070d1ec..c229db52d 100644 --- a/packages/cli/src/commands/doctor/types.ts +++ b/packages/cli/src/commands/doctor/types.ts @@ -102,7 +102,7 @@ export type HealthCheckResult = { label: string; needsToBeFixed: boolean; version?: 'Not Found' | string; - versions?: [string]; + versions?: [string] | string; versionRange?: string; description: string | undefined; runAutomaticFix: RunAutomaticFix; From 9fbf1a9c2f78ac2e3471260fcd2fcfbf8405ee57 Mon Sep 17 00:00:00 2001 From: ph0ph0 Date: Sun, 16 Feb 2020 16:02:39 +0000 Subject: [PATCH 5/5] deleted unneeded history file --- .../doctor/.history/doctor_20200214170855.ts | 229 ------------------ 1 file changed, 229 deletions(-) delete mode 100644 packages/cli/src/commands/doctor/.history/doctor_20200214170855.ts diff --git a/packages/cli/src/commands/doctor/.history/doctor_20200214170855.ts b/packages/cli/src/commands/doctor/.history/doctor_20200214170855.ts deleted file mode 100644 index 205e85826..000000000 --- a/packages/cli/src/commands/doctor/.history/doctor_20200214170855.ts +++ /dev/null @@ -1,229 +0,0 @@ -import chalk from 'chalk'; -import {logger} from '@react-native-community/cli-tools'; -import {getHealthchecks, HEALTHCHECK_TYPES} from './healthchecks'; -import {getLoader} from '../../tools/loader'; -import printFixOptions, {KEYS} from './printFixOptions'; -import runAutomaticFix, {AUTOMATIC_FIX_LEVELS} from './runAutomaticFix'; -import {CommandFunction} from '@react-native-community/cli-types'; -import { - HealthCheckCategory, - HealthCheckCategoryResult, - HealthCheckResult, -} from './types'; -import getEnvironmentInfo from '../../tools/envinfo'; -import {logMessage} from './healthchecks/common'; - -const printCategory = ({label, key}: {label: string; key: number}) => { - if (key > 0) { - logger.log(); - } - - logger.log(chalk.dim(label)); -}; - -const printVersions = ({version, versions, versionRange}) => { - if (versions) { - const versionsToShow = versions.join(', '); - - logMessage(`- Versions found: ${chalk.red(versionsToShow)}`); - logMessage(`- Version supported: ${chalk.green(versionRange)}`); - - return; - } - - const versionsToShow = version && version !== 'Not Found' ? version : 'N/A'; - - logMessage(`- Version found: ${chalk.red(versionsToShow)}`); - logMessage(`- Version supported: ${chalk.green(versionRange)}`); - - return; -}; - -const printIssue = ({ - label, - needsToBeFixed, - version, - versions, - versionRange, - isRequired, - description, -}: HealthCheckResult) => { - const symbol = needsToBeFixed - ? isRequired - ? chalk.red('✖') - : chalk.yellow('●') - : chalk.green('✓'); - - const descriptionToShow = description ? ` - ${description}` : ''; - - logger.log(` ${symbol} ${label}${descriptionToShow}`); - - if (needsToBeFixed && versionRange) { - return printVersions({version, versions, versionRange}); - } -}; - -const printOverallStats = ({ - errors, - warnings, -}: { - errors: number; - warnings: number; -}) => { - logger.log(`\n${chalk.bold('Errors:')} ${errors}`); - logger.log(`${chalk.bold('Warnings:')} ${warnings}`); -}; - -type FlagsT = { - fix: boolean | void; - contributor: boolean | void; -}; - -export default (async (_, __, options) => { - const Loader = getLoader(); - const loader = new Loader(); - - loader.start('Running diagnostics...'); - - const environmentInfo = await getEnvironmentInfo(); - - const iterateOverHealthChecks = async ({ - label, - healthchecks, - }: HealthCheckCategory): Promise => ({ - label, - healthchecks: (await Promise.all( - healthchecks.map(async healthcheck => { - if (healthcheck.visible === false) { - return; - } - - const { - needsToBeFixed, - version, - versions, - versionRange, - } = await healthcheck.getDiagnostics(environmentInfo); - - // 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: healthcheck.description, - runAutomaticFix: healthcheck.runAutomaticFix, - isRequired, - type: needsToBeFixed - ? isWarning - ? HEALTHCHECK_TYPES.WARNING - : HEALTHCHECK_TYPES.ERROR - : undefined, - }; - }), - )).filter(healthcheck => healthcheck !== undefined) as HealthCheckResult[], - }); - - // 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: HealthCheckCategoryResult[]) => - categories.filter(category => - category.healthchecks.some(healthcheck => healthcheck.needsToBeFixed), - ); - - const iterateOverCategories = (categories: HealthCheckCategory[]) => - Promise.all(categories.map(iterateOverHealthChecks)); - - const healthchecksPerCategory = await iterateOverCategories(Object.values( - getHealthchecks(options), - ).filter(category => category !== undefined) as HealthCheckCategory[]); - - loader.stop(); - - const stats = { - errors: 0, - warnings: 0, - }; - - healthchecksPerCategory.forEach((issueCategory, key) => { - printCategory({...issueCategory, key}); - - issueCategory.healthchecks.forEach(healthcheck => { - printIssue(healthcheck); - - if (healthcheck.type === HEALTHCHECK_TYPES.WARNING) { - stats.warnings++; - return; - } - - if (healthcheck.type === HEALTHCHECK_TYPES.ERROR) { - stats.errors++; - return; - } - }); - }); - - printOverallStats(stats); - - if (options.fix) { - return await runAutomaticFix({ - healthchecks: removeFixedCategories(healthchecksPerCategory), - automaticFixLevel: AUTOMATIC_FIX_LEVELS.ALL_ISSUES, - stats, - loader, - environmentInfo, - }); - } - - const removeKeyPressListener = () => { - if (typeof process.stdin.setRawMode === 'function') { - process.stdin.setRawMode(false); - } - process.stdin.removeAllListeners('data'); - }; - - const onKeyPress = async (key: string) => { - if (key === KEYS.EXIT || key === '\u0003') { - removeKeyPressListener(); - - process.exit(0); - return; - } - - if ( - [KEYS.FIX_ALL_ISSUES, KEYS.FIX_ERRORS, KEYS.FIX_WARNINGS].includes(key) - ) { - removeKeyPressListener(); - - try { - const automaticFixLevel = { - [KEYS.FIX_ALL_ISSUES]: AUTOMATIC_FIX_LEVELS.ALL_ISSUES, - [KEYS.FIX_ERRORS]: AUTOMATIC_FIX_LEVELS.ERRORS, - [KEYS.FIX_WARNINGS]: AUTOMATIC_FIX_LEVELS.WARNINGS, - }; - - await runAutomaticFix({ - healthchecks: removeFixedCategories(healthchecksPerCategory), - automaticFixLevel: automaticFixLevel[key], - stats, - loader, - environmentInfo, - }); - - process.exit(0); - } catch (err) { - // TODO: log error - process.exit(1); - } - } - }; - - if (stats.errors || stats.warnings) { - printFixOptions({onKeyPress}); - } -}) as CommandFunction;