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

@ -18,6 +18,7 @@ import { collectMigrations } from '../collect-migrations.js';
import { migrationRunner } from '../migration-runner.js';
import { arrayMapAsync } from '../array-map-async.js';
import { type GetMigrationsFunction } from '../get-migrations.js';
import { getStandardReporter } from '../reporters/get.js';
type ExtraFlags = {
cwd: string;
@ -27,8 +28,6 @@ type ExtraFlags = {
type RemovableMigrationMetadata = MigrationMetadata & { originalStatus?: 'done' | 'failed' };
const lazyDefaultReporter = async () => import('../reporters/default.js');
export default async function removeCommand(
{
directory,
@ -55,7 +54,7 @@ export default async function removeCommand(
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(