debt-collector
Version:
a nodejs tool to identify, track and mesure technical debt
35 lines (34 loc) • 1.69 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { TaskList, Task } from 'ink-task-list';
import { Text } from 'ink';
import zod from 'zod';
import { option } from 'pastel';
import spinners from 'cli-spinners';
import { LogViewer } from '../components/DevLogger/LogViewer.js';
import { useWalkState } from '../components/walk/useWalkState.js';
import { ConfigErrors } from '../components/shared/ConfigErrors.js';
export const options = zod.object({
config: zod
.string()
.optional()
.describe(option({
description: 'an alternative path to the configuration file',
alias: 'c',
})),
// include: zod.string().optional().describe(option({ description: 'a glob pattern to override the include configuration', alias: 'g'})),
openReport: zod
.boolean()
.optional()
.describe(option({ description: 'open the report in the browser', alias: 'o' })),
});
export const alias = 'w';
const Walk = ({ options }) => {
const { config, openReport } = options;
const { logs, tasks, isHistoryDirty, isConfigValid, configErrors } = useWalkState({
config,
// include
openReport,
});
return (_jsxs(_Fragment, { children: [_jsx(TaskList, { children: tasks.map((task) => (_jsx(Task, { state: task.state, label: task.label, status: task.status, spinner: spinners.dots }, task.label))) }), isHistoryDirty && (_jsx(Text, { color: "red", children: "Your have uncommited changes, please commit or stash them" })), _jsx(ConfigErrors, { isConfigValid: isConfigValid, configErrors: configErrors }), _jsx(LogViewer, { logs: logs })] }));
};
export default Walk;