Skip to content

Commit

Permalink
feat: replace text-table with markdown-table (#79)
Browse files Browse the repository at this point in the history
Co-authored-by: pooya parsa <pyapar@gmail.com>
  • Loading branch information
ambar and pi0 authored Nov 5, 2021
1 parent 96a5a70 commit 457037a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"chalk": "^4.1.0",
"consola": "^2.15.0",
"figures": "^3.2.0",
"markdown-table": "^2.0.0",
"pretty-time": "^1.1.0",
"std-env": "^3.0.0",
"text-table": "^0.2.0",
"wrap-ansi": "^7.0.0"
},
"devDependencies": {
Expand Down
7 changes: 2 additions & 5 deletions src/utils/cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import chalk from 'chalk'
import Consola from 'consola'

import textTable from 'text-table'
import markdownTable from 'markdown-table'

import { BLOCK_CHAR, BLOCK_CHAR2, BAR_LENGTH } from './consts'

Expand All @@ -28,9 +27,7 @@ export const renderBar = (progress, color) => {
}

export function createTable (data) {
return textTable(data, {
align: data[0].map(() => 'l')
}).replace(/\n/g, '\n\n')
return markdownTable(data)
}

export function ellipsis (str, n) {
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4278,6 +4278,13 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"

markdown-table@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b"
integrity sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==
dependencies:
repeat-string "^1.0.0"

memory-fs@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.5.0.tgz#324c01288b88652966d161db77838720845a8e3c"
Expand Down Expand Up @@ -5176,7 +5183,7 @@ repeat-element@^1.1.2:
resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce"
integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==

repeat-string@^1.6.1:
repeat-string@^1.0.0, repeat-string@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"
integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc=
Expand Down

0 comments on commit 457037a

Please sign in to comment.