Skip to content

Commit

Permalink
Log detected configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer committed Jan 24, 2024
1 parent 957f1da commit bd5851e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/cli/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
* limitations under the License.
*/

import { readPackageJson } from '../lib/files';
import {
warnAboutMissingPlugins,
warnAboutUnsupportedPlugins,
} from '../lib/options';
import { isArray, isEmpty, mapValues } from 'lodash/fp';

import { getOptions } from '../lib/options';
import * as logger from '../lib/logger';

export function debug(): void {
const packageJson = readPackageJson();
const options = getOptions();

const stringifiedOptions = mapValues(
(value) => (isArray(value) && !isEmpty(value) ? value.join(', ') : value),
options,
);

warnAboutUnsupportedPlugins(packageJson);
warnAboutMissingPlugins(packageJson);
logger.empty();
logger.info('Detected configuration:');
logger.table(stringifiedOptions);
}
4 changes: 4 additions & 0 deletions src/lib/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ export const debug = (arg: LogMessage): void => {
export const empty = (): void => {
console.log('');
};

export const table = (obj: Record<string, unknown>): void => {
console.table(obj);
};

0 comments on commit bd5851e

Please sign in to comment.