cli-simple-table is a lightweight utility for generating basic, unstyled ASCII tables in command-line interfaces. Its design prioritizes simplicity and a minimal API, making it suitable for quick console output without extensive configuration. The library allows users to define table headers, add rows, and configure column-specific options such as text alignment and maximum width for truncation. It provides a `toString()` method to render the table for printing. The current stable version is `1.1.1`, released in late 2021, indicating a moderate release cadence. It differentiates itself from more feature-rich table rendering libraries by offering a focused solution for common CLI display needs. The package ships with TypeScript types, ensuring good developer experience for TypeScript projects, and supports both CommonJS and ES Module environments.
npm install cli-simple-tableVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic table creation with headers and rows, including colored text using an external library like `chalk`.
For ESM, use `import SimpleTable from 'cli-simple-table';`. For CommonJS, continue using `const SimpleTable = require('cli-simple-table');`. Ensure your `tsconfig.json` (if applicable) is configured for correct module resolution (`"moduleResolution": "node"` or `"bundler"`).Always import `SimpleTable` as a default export for ESM (`import SimpleTable from 'cli-simple-table';`) and as the main module export for CommonJS (`const SimpleTable = require('cli-simple-table');`).Upgrade to `cli-simple-table@1.1.1` or later to ensure full compatibility and correctness in TypeScript strict mode.
Ensure you are importing and instantiating the module directly: `const SimpleTable = require('cli-simple-table'); new SimpleTable();` or `import SimpleTable from 'cli-simple-table'; new SimpleTable();`.Verify your `package.json`'s `type` field, module resolution settings in bundlers, and ensure the correct entry point (`main` for CJS, `module` for ESM) is being used. If you are in an ESM project, prefer `import SimpleTable from 'cli-simple-table';`.
No dependency data recorded yet.