feat(reporters): add built-in "json" reporter and rename "default" to "pretty"

This commit is contained in:
Joakim Carlstein 2024-02-06 09:15:16 +01:00 committed by Joakim Carlstein
parent 4e8ac5294d
commit 18382ce961
11 changed files with 102 additions and 16 deletions

View file

@ -5,8 +5,7 @@ import { exec } from '../exec.js';
import { migrationRunner } from '../migration-runner.js';
import { collectMigrations } from '../collect-migrations.js';
import { version } from '../get-package-info.js';
const lazyDefaultReporter = async () => import('../reporters/default.js');
import { getStandardReporter } from '../reporters/get.js';
type ExtraFlags = {
cwd: string;
@ -29,7 +28,7 @@ export default async function listCommand({
throw BadOptionError.fromOption('storage', 'No storage found, please specify a storage using the storage option');
}
const reporter = await getOrLoadReporter([reporterConfig ?? lazyDefaultReporter]);
const reporter = getStandardReporter(reporterConfig) ?? (await getOrLoadReporter([reporterConfig]));
if (!reporter) {
throw BadOptionError.fromOption(