feat(cli): add "reporter" option for the "new" command for improved logging

This commit is contained in:
Joakim Carlstein 2023-11-22 13:21:45 +01:00
parent 5e8572b67f
commit da1eee3c75
5 changed files with 132 additions and 54 deletions

View file

@ -48,13 +48,16 @@ export default async function upCommand({
}
const storage = await storagePlugin.initializeStorage();
const reporter = await getOrLoadReporter([lazyDefaultReporter, reporterConfig]);
const reporter = await getOrLoadReporter([reporterConfig ?? lazyDefaultReporter]);
if (!reporter) {
throw new BadOptionError('reporter', 'No reporter found, please specify a reporter using the reporter option');
throw new BadOptionError(
'reporter',
'No reporter found, please specify an existing reporter using the reporter option',
);
}
await reporter.onInit?.({ cwd, dry, directory });
await reporter.onInit?.({ command: 'up', cwd, dry, directory });
const path = await import('node:path');
const fs = await import('node:fs/promises');