Skip to content

Commit

Permalink
feat: add ascii-table types (#6164)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericapisani authored Nov 15, 2023
1 parent b6cae92 commit cf00616
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/commands/addons/addons-list.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'asci... Remove this comment to see the full error message
import AsciiTable from 'ascii-table'

import { prepareAddonCommand } from '../../utils/addons/prepare.mjs'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/api/api.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'asci... Remove this comment to see the full error message
import AsciiTable from 'ascii-table'
import { methods } from 'netlify'

Expand Down
2 changes: 1 addition & 1 deletion src/commands/env/env-import.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { readFile } from 'fs/promises'

// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'asci... Remove this comment to see the full error message
import AsciiTable from 'ascii-table'
import { Option } from 'commander'
import dotenv from 'dotenv'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/env/env-list.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import ansiEscapes from 'ansi-escapes'
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'asci... Remove this comment to see the full error message
import AsciiTable from 'ascii-table'
import { isCI } from 'ci-info'
import { Option } from 'commander'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/functions/functions-list.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'asci... Remove this comment to see the full error message
import AsciiTable from 'ascii-table'

import { exit, log, logJson } from '../../utils/command-helpers.mjs'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/recipes/recipes-list.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'asci... Remove this comment to see the full error message
import AsciiTable from 'ascii-table'

import { listRecipes } from './common.mjs'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/addons/render.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'asci... Remove this comment to see the full error message
import AsciiTable from 'ascii-table'

import { chalk } from '../command-helpers.mjs'
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
"allowJs": true
"allowJs": true,
"typeRoots": ["node_modules/@types", "types"]
},
"include": ["src/**/*.mts"],
"exclude": ["node_modules", "src/functions-templates"]
Expand Down
37 changes: 37 additions & 0 deletions types/ascii-table/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
declare module 'ascii-table' {
export default class AsciiTable {
constructor(title?: string);

setTitle(title: string): void;
setHeading(...headings: string[]): void;
addRow(...values: string[]): void;
addRow(row: string[]): void;
addRow(row: Record<string, string>): void;
addRow(row: string[], truncate: boolean): void;
addRow(row: Record<string, string>, truncate: boolean): void;
addRowMatrix(row: Array<unknown>): void;
setAlign(column: number, alignment: 'left' | 'center' | 'right'): void;
setAlign(alignments: ('left' | 'center' | 'right')[]): void;
setJustify(column: number, justify: boolean): void;
setJustify(justify: boolean[]): void;
setChars(chars: Record<string, string>): void;
setStyle(style: 'default' | 'fat' | 'thin' | 'double' | 'round' | 'single'): void;
setBorder(border: boolean): void;
removeBorder(): void;
setTruncate(truncate: boolean): void;
setMaxColWidth(maxWidth: number): void;
setMinColWidth(minWidth: number): void;
setColWidth(column: number, width: number): void;
setColWidths(widths: number[]): void;
setDefaultColWidth(width: number): void;
setDefaultAlignment(alignment: 'left' | 'center' | 'right'): void;
setDefaultJustify(justify: boolean): void;
setDefaultTruncate(truncate: boolean): void;
setDefaultMaxColWidth(maxWidth: number): void;
setDefaultMinColWidth(minWidth: number): void;
setDefaultStyle(style: 'default' | 'fat' | 'thin' | 'double' | 'round' | 'single'): void;
setDefaultBorder(border: boolean): void;
setDefaultChars(chars: Record<string, string>): void;
toString(): string;
}
}

2 comments on commit cf00616

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

  • Dependency count: 1,395
  • Package size: 404 MB

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

  • Dependency count: 1,395
  • Package size: 404 MB

Please sign in to comment.