Skip to content

Commit

Permalink
chore(cli): cleanup doctor output (#3096)
Browse files Browse the repository at this point in the history
  • Loading branch information
imhoffd authored Jun 11, 2020
1 parent 615225a commit c2adf4c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cli/src/tasks/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ export async function doctorCore(config: Config) {
let iosVersion = await runCommand(`npm info @capacitor/ios version`);

log(`${chalk.bold.blue('Latest Dependencies:')}\n`);
log(` ${chalk.bold('@capacitor/cli:')}`, cliVersion);
log(` ${chalk.bold('@capacitor/core:')}`, coreVersion);
log(` ${chalk.bold('@capacitor/android:')}`, androidVersion);
log(` ${chalk.bold('@capacitor/electron:')}`, electronVersion);
log(` ${chalk.bold('@capacitor/ios:')}`, iosVersion);
log(` ${chalk.bold('@capacitor/cli:')}`, cliVersion.trim());
log(` ${chalk.bold('@capacitor/core:')}`, coreVersion.trim());
log(` ${chalk.bold('@capacitor/android:')}`, androidVersion.trim());
log(` ${chalk.bold('@capacitor/electron:')}`, electronVersion.trim());
log(` ${chalk.bold('@capacitor/ios:')}`, iosVersion.trim());

log('');
log(`${chalk.bold.blue('Installed Dependencies:')}\n`);

await printInstalledPackages(config);
Expand All @@ -45,10 +46,10 @@ async function printInstalledPackages(config: Config) {
const packageNames = ['@capacitor/cli', '@capacitor/core', '@capacitor/android', '@capacitor/ios'];
await Promise.all(packageNames.map(async packageName => {
const packagePath = resolveNode(config, packageName, 'package.json');
printPackageVersion(packageName, packagePath);
await printPackageVersion(packageName, packagePath);
}));
const packagePath = resolveNodeFrom(config.electron.platformDir, '@capacitor/electron');
printPackageVersion('@capacitor/electron', packagePath ? join(packagePath, 'package.json') : packagePath);
await printPackageVersion('@capacitor/electron', packagePath ? join(packagePath, 'package.json') : packagePath);
}

async function printPackageVersion(packageName: string, packagePath: string | null) {
Expand All @@ -57,7 +58,6 @@ async function printPackageVersion(packageName: string, packagePath: string | nu
version = (await readJSON(packagePath)).version;
}
log(` ${chalk.bold(packageName)}`, version || 'not installed');
log('');
}

export async function doctor(config: Config, platformName: string) {
Expand Down

0 comments on commit c2adf4c

Please sign in to comment.