Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions common/changes/@microsoft/rush/terminal-table_2026-04-17.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Replace `cli-table` dependency with `TerminalTable` from `@rushstack/terminal`.",
"type": "patch"
}
],
"packageName": "@microsoft/rush"
}
10 changes: 10 additions & 0 deletions common/changes/@rushstack/terminal/terminal-table_2026-04-17.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/terminal",
"comment": "Add `TerminalTable` class for rendering fixed-column tables in terminal output, with correct handling of ANSI escape sequences when calculating column widths.",
"type": "minor"
}
],
"packageName": "@rushstack/terminal"
}
4 changes: 0 additions & 4 deletions common/config/rush/nonbrowser-approved-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,10 +614,6 @@
"name": "chokidar",
"allowedCategories": [ "libraries" ]
},
{
"name": "cli-table",
"allowedCategories": [ "libraries" ]
},
{
"name": "compression",
"allowedCategories": [ "libraries" ]
Expand Down
25 changes: 5 additions & 20 deletions common/config/subspaces/build-tests-subspace/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "67e1e1974c3a01231385fd6e8e3b892a4f3729dd",
"pnpmShrinkwrapHash": "72fae9b780cca1f45b7c807b24a587a13f1719e6",
"preferredVersionsHash": "550b4cee0bef4e97db6c6aad726df5149d20e7d9",
"packageJsonInjectedDependenciesHash": "157a943794dbd83c14beb27a57db03705eb04aa6"
"packageJsonInjectedDependenciesHash": "258293487508f4a9172933cb6d0c90a02599bd8d"
}
25 changes: 0 additions & 25 deletions common/config/subspaces/default/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/subspaces/default/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "e329020e3621437b0039842e5440d019c5315c14",
"pnpmShrinkwrapHash": "f41b01db5e94d65ef640cb5e6eb9dce1780f93c6",
"preferredVersionsHash": "029c99bd6e65c5e1f25e2848340509811ff9753c"
}
36 changes: 36 additions & 0 deletions common/reviews/api/terminal.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,33 @@ export interface ITerminalStreamWritableOptions {
writableOptions?: WritableOptions;
}

// @public
export interface ITerminalTableChars {
bottom: string;
bottomCenter: string;
bottomLeft: string;
bottomRight: string;
centerCenter: string;
horizontalCenter: string;
left: string;
leftCenter: string;
right: string;
rightCenter: string;
top: string;
topCenter: string;
topLeft: string;
topRight: string;
verticalCenter: string;
}

// @public
export interface ITerminalTableOptions {
borderCharacters?: Partial<ITerminalTableChars>;
borderless?: boolean;
colWidths?: number[];
head?: string[];
}

// @public
export interface ITerminalTransformOptions extends ITerminalWritableOptions {
destination: TerminalWritable;
Expand Down Expand Up @@ -459,6 +486,15 @@ export class TerminalStreamWritable extends Writable {
_write(chunk: string | Buffer | Uint8Array, encoding: string, callback: (error?: Error | null) => void): void;
}

// @public
export class TerminalTable {
constructor(options?: ITerminalTableOptions);
// (undocumented)
getLines(): string[];
push(...rows: string[][]): void;
toString(): string;
}

// @public
export abstract class TerminalTransform extends TerminalWritable {
constructor(options: ITerminalTransformOptions);
Expand Down
2 changes: 0 additions & 2 deletions libraries/rush-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"@rushstack/ts-command-line": "workspace:*",
"@yarnpkg/lockfile": "~1.0.2",
"builtin-modules": "~3.1.0",
"cli-table": "~0.3.1",
"dependency-path": "~9.2.8",
"dotenv": "~16.4.7",
"fast-glob": "~3.3.1",
Expand Down Expand Up @@ -91,7 +90,6 @@
"@rushstack/operation-graph": "workspace:*",
"@rushstack/webpack-deep-imports-plugin": "workspace:*",
"@rushstack/webpack-preserve-dynamic-require-plugin": "workspace:*",
"@types/cli-table": "0.3.0",
"@types/js-yaml": "4.0.9",
"@types/npm-package-arg": "6.1.0",
"@types/object-hash": "~3.0.6",
Expand Down
5 changes: 2 additions & 3 deletions libraries/rush-lib/src/cli/actions/ListAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See LICENSE in the project root for license information.

import { Sort } from '@rushstack/node-core-library';
import { ConsoleTerminalProvider, Terminal } from '@rushstack/terminal';
import { ConsoleTerminalProvider, Terminal, TerminalTable } from '@rushstack/terminal';
import type { CommandLineFlagParameter } from '@rushstack/ts-command-line';

import { BaseRushAction } from './BaseRushAction';
Expand Down Expand Up @@ -220,8 +220,7 @@ export class ListAction extends BaseRushAction {
tableHeader.push('Tags');
}

const { default: CliTable } = await import('cli-table');
const table: import('cli-table') = new CliTable({
const table: TerminalTable = new TerminalTable({
head: tableHeader
});

Expand Down
29 changes: 7 additions & 22 deletions libraries/rush-lib/src/utilities/InteractiveUpgradeUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
// https://github.com/dylang/npm-check/blob/master/lib/out/interactive-update.js
// Extended to use one type of text table

import CliTable from 'cli-table';
import type { Separator } from '@inquirer/checkbox';

import { AnsiEscape, Colorize } from '@rushstack/terminal';
import { AnsiEscape, Colorize, TerminalTable } from '@rushstack/terminal';
import type { INpmCheckPackageSummary } from '@rushstack/npm-check-fork';

export interface IUIGroup {
Expand Down Expand Up @@ -147,34 +146,20 @@ export const upgradeInteractive = async (pkgs: INpmCheckPackageSummary[]): Promi
.map(getChoice)
.filter(Boolean);

const cliTable: CliTable = new CliTable({
chars: {
top: '',
'top-mid': '',
'top-left': '',
'top-right': '',
bottom: '',
'bottom-mid': '',
'bottom-left': '',
'bottom-right': '',
left: '',
'left-mid': '',
mid: '',
'mid-mid': '',
right: '',
'right-mid': '',
middle: ' '
},
const cliTable: TerminalTable = new TerminalTable({
borderless: true,
colWidths: [50, 10, 3, 10, 100]
});

for (const choice of choices) {
if (typeof choice === 'object' && 'name' in choice) {
cliTable.push(choice.name);
// choice.name is string[] at this point (set by label()); it is only replaced
// with a string after the table is rendered below.
cliTable.push(choice.name as string[]);
}
}

const choicesAsATable: string[] = cliTable.toString().split('\n');
const choicesAsATable: string[] = cliTable.getLines();
for (let i: number = 0; i < choices.length; i++) {
const choice: IUpgradeInteractiveDepChoice | Separator | boolean | undefined = choices[i];
if (typeof choice === 'object' && 'name' in choice) {
Expand Down
Loading