|
1 | 1 | import fs from 'node:fs/promises'
|
2 | 2 |
|
3 |
| -import blessed from 'blessed' |
4 | 3 | // @ts-ignore
|
5 |
| -import contrib from 'blessed-contrib' |
| 4 | +import ScreenWidget from 'blessed/lib/widgets/screen' |
| 5 | +// @ts-ignore |
| 6 | +import BarChart from 'blessed-contrib/lib/widget/charts/bar' |
| 7 | +// @ts-ignore |
| 8 | +import GridLayout from 'blessed-contrib/lib/layout/grid' |
| 9 | +// @ts-ignore |
| 10 | +import LineChart from 'blessed-contrib/lib/widget/charts/line' |
6 | 11 | import chalk from 'chalk'
|
7 | 12 | import meow from 'meow'
|
8 | 13 | import ora from 'ora'
|
@@ -137,7 +142,7 @@ function setupCommand(
|
137 | 142 | if (scope === 'repo' && !repo) {
|
138 | 143 | showHelp = true
|
139 | 144 | console.error(
|
140 |
| - `${chalk.bgRed.white('Input error')}: Please provide a repository name when using the repository scope. \n` |
| 145 | + `${chalk.bgRed.white('Input error')}: Please provide a repository name when using the repository scope.` |
141 | 146 | )
|
142 | 147 | }
|
143 | 148 | if (showHelp) {
|
@@ -372,8 +377,8 @@ async function fetchRepoAnalyticsData(
|
372 | 377 | }
|
373 | 378 |
|
374 | 379 | const displayAnalyticsScreen = (data: any) => {
|
375 |
| - const screen = blessed.screen() |
376 |
| - const grid = new contrib.grid({ rows: 5, cols: 4, screen }) |
| 380 | + const screen = new ScreenWidget() |
| 381 | + const grid = new GridLayout({ rows: 5, cols: 4, screen }) |
377 | 382 |
|
378 | 383 | renderLineCharts(
|
379 | 384 | grid,
|
@@ -432,7 +437,7 @@ const displayAnalyticsScreen = (data: any) => {
|
432 | 437 | data['total_low_prevented']
|
433 | 438 | )
|
434 | 439 |
|
435 |
| - const bar = grid.set(4, 0, 1, 2, contrib.bar, { |
| 440 | + const bar = grid.set(4, 0, 1, 2, BarChart, { |
436 | 441 | label: 'Top 5 alert types',
|
437 | 442 | barWidth: 10,
|
438 | 443 | barSpacing: 17,
|
@@ -460,7 +465,7 @@ const renderLineCharts = (
|
460 | 465 | coords: number[],
|
461 | 466 | data: { [key: string]: number }
|
462 | 467 | ) => {
|
463 |
| - const line = grid.set(...coords, contrib.line, { |
| 468 | + const line = grid.set(...coords, LineChart, { |
464 | 469 | style: { line: 'cyan', text: 'cyan', baseline: 'black' },
|
465 | 470 | xLabelPadding: 0,
|
466 | 471 | xPadding: 0,
|
|
0 commit comments