@better-tables/cli
Command-line utilities for Better Tables. Execute commands directly without installation using pnpm dlx, npx, or bunx.
Usage
Open Documentation
pnpm dlx @better-tables/cli docs
npx @better-tables/cli docs
bunx --bun @better-tables/cli docs
pnpm dlx @better-tables/cli docs core
pnpm dlx @better-tables/cli docs ui
pnpm dlx @better-tables/cli docs drizzle
Available Commands
Examples
pnpm dlx @better-tables/cli docs
npx @better-tables/cli docs core
bunx --bun @better-tables/cli docs ui
pnpm dlx @better-tables/cli docs drizzle
pnpm dlx @better-tables/cli init
npx @better-tables/cli init --cwd ./my-project
bunx --bun @better-tables/cli init --skip-shadcn
pnpm dlx @better-tables/cli init -y
Installation (Optional)
If you prefer to install globally:
npm install -g @better-tables/cli
Initialization
The init command helps you set up Better Tables in your project:
- Validates shadcn setup - Checks for
components.json configuration
- Installs missing shadcn components - Automatically installs 21 required UI components
- Copies Better Tables files - Copies table, filter, hook, store, and utility files to your project
- Transforms imports - Updates import paths to match your project's alias configuration
Prerequisites
- Your project must have shadcn/ui initialized (
npx shadcn@latest init)
- Node.js 18+ is required
What Gets Copied
The init command copies the following files to your project:
- Table components:
{components}/table/*
- Filter components:
{components}/filters/*
- Hooks:
{hooks}/* or {components}/hooks/*
- Stores:
{components}/stores/*
- Utilities:
{lib}/utils/*
- Lib files:
{lib}/*
All import paths are automatically transformed to match your components.json alias configuration.
After Initialization
After running init, you'll need to:
-
Install peer dependencies:
npm install @better-tables/core zustand @dnd-kit/core @dnd-kit/sortable
-
Import and use BetterTable:
import { BetterTable } from '@/components/table/table';
Development
bun run build
bun run dev
bun test
bun run lint
Testing Locally
Option 1: Using Bun (Recommended)
cd packages/cli
bun run build
node dist/cli.js docs
node dist/cli.js docs core
node dist/cli.js docs ui
node dist/cli.js docs drizzle
node dist/cli.js init --help
bun src/cli.ts docs
bun src/cli.ts docs core
bun src/cli.ts init --help
Option 2: Using pnpm dlx (Local Package)
cd ../..
bun run build --filter @better-tables/cli
pnpm dlx --filter @better-tables/cli better-tables docs
pnpm dlx --filter @better-tables/cli better-tables docs core
pnpm dlx --filter @better-tables/cli better-tables init --help
Option 3: Link Package Globally
cd packages/cli
bun run build
npm link
pnpm link --global
better-tables docs
better-tables docs core
better-tables init --help
Option 4: Run Tests
cd packages/cli
bun test
bun test --watch
bun test --coverage
Testing the Bin Entry Point
After building, you can test the bin entry point:
cd packages/cli
bun run build
./dist/cli.js docs
./dist/cli.js docs core
./dist/cli.js init --help
./dist/cli.js --version
./dist/cli.js --help
License
MIT