UNPKG

eslint-remote-tester

Version:
25 lines (24 loc) 915 B
import React from 'react'; import { Static, Text } from 'ink'; import ProgressLogger from '../../progress-logger/index.js'; import { useExitAfterRender } from '../hooks/index.js'; const START_MESSAGE = { content: 'Full log:', color: 'yellow', }; const NO_ERRORS_MESSAGE = { content: 'No errors', color: 'green', }; /** * Final log of the scan * - Displayed only on CLI mode after scan has completed * - This is what users end up seeing after application exits. * Everything else is cleared from the screen. */ export default function FinalLog() { useExitAfterRender(); const logMessages = ProgressLogger.getMessages(); const messages = logMessages.length > 0 ? logMessages : [NO_ERRORS_MESSAGE]; return (React.createElement(Static, { items: [START_MESSAGE, ...messages] }, ({ color, content }, index) => (React.createElement(Text, { key: index, color: color }, content)))); }