Skip to content

Commit

Permalink
feat(cli): ink CLI support
Browse files Browse the repository at this point in the history
- Replace old `log-renderer.ts` with ink
  • Loading branch information
AriPerkkio committed Nov 4, 2020
1 parent 279a1e5 commit a7c2253
Show file tree
Hide file tree
Showing 30 changed files with 1,783 additions and 1,242 deletions.
17 changes: 16 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,23 @@ module.exports = {
node: true,
},
parser: '@typescript-eslint/parser',
plugins: ['node', '@typescript-eslint', 'prettier'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
},
plugins: ['node', 'react', 'react-hooks', '@typescript-eslint', 'prettier'],
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
Expand All @@ -28,6 +42,7 @@ module.exports = {
'no-process-exit': 'off',
'prettier/prettier': 'error',
'node/no-unsupported-features/es-syntax': 'off',
'react/prop-types': ['error', { ignore: ['children'] }], // Already covered by React.FC
},
overrides: [
{
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"trailingComma": "es5",
"singleQuote": true,
"tabWidth": 4,
"printWidth": 80
"printWidth": 80,
"jsxSingleQuote": true
}
2 changes: 1 addition & 1 deletion lib/file-client/results-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ export function writeResults(results: LintMessage[], repository: string): void {
}

export function getResults(): string[] {
return RESULTS;
return RESULTS.length > 0 ? RESULTS : ['No errors'];
}
8 changes: 6 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env node

import engine, { WorkerMessage } from '@engine';
import { renderApplication } from '@ui';
import config from '@config';
import logger from '@progress-logger';
import engine, { WorkerMessage } from '@engine';
import { writeResults, clearResults } from '@file-client';
import logger from '@progress-logger';

/**
* Entrypoint of the application.
Expand All @@ -25,6 +26,9 @@ async function main() {
// Clear possible earlier results / initialize results folder
clearResults();

// Render application to stdout
renderApplication();

// Start x amount of task runners parallel until we are out of repositories to scan
await Promise.all(
Array(config.concurrentTasks)
Expand Down
3 changes: 1 addition & 2 deletions lib/progress-logger/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import './log-renderer';

export { default } from './progress-logger';
export * from './log-templates';
97 changes: 0 additions & 97 deletions lib/progress-logger/log-diff.ts

This file was deleted.

0 comments on commit a7c2253

Please sign in to comment.