File size: 1,384 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env node
const chalk = require( 'chalk' );
const yargs = require( 'yargs' );
const { runEvaluations } = require( './index.js' );

const main = async () => {
	console.log( chalk.yellow( '-=- Calypso Doctor -=-' ) );
	console.log( 'Checking the health of your system...' );
	console.log(
		chalk.gray(
			"If you don't want to run this tool automatically, set the env var CALYPSO_DOCTOR_SKIP=true"
		)
	);
	const results = await runEvaluations();

	console.log( '' );
	console.log( chalk.yellow( 'Tests' ) );
	results.forEach( ( { title, group, result, ignored, evaluationMessage } ) => {
		if ( ignored ) {
			console.log( `* ${ chalk.gray( '?' ) } ${ group } > ${ title }` );
		} else if ( result ) {
			console.log( `* ${ chalk.green( '✓' ) } ${ group } > ${ title }` );
		} else {
			console.log( `* ${ chalk.red( '✗' ) } ${ group } > ${ title }` );
		}
		if ( evaluationMessage ) {
			console.log( `    ${ evaluationMessage }` );
		}
	} );

	console.log( '' );
	console.log( chalk.yellow( 'Fixes' ) );
	if ( results.some( ( r ) => r.fixMessage ) ) {
		results.forEach( ( { fixMessage } ) => {
			if ( fixMessage ) {
				console.log( `> ${ fixMessage }` );
			}
		} );
	} else {
		console.log( `Nothing to fix, your system is ${ chalk.greenBright( 'ready' ) }!` );
	}

	console.log( '' );
};

main( yargs.usage( 'Usage: $0' ).help( 'h' ).alias( 'h', 'help' ).argv );