npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@better-tables/cli

v0.1.5

Published

Command-line utilities for Better Tables

Readme

@better-tables/cli

Command-line utilities for Better Tables. Execute commands directly without installation using pnpm dlx, npx, or bunx.

Usage

Open Documentation

# Open main documentation
pnpm dlx @better-tables/cli docs
npx @better-tables/cli docs
bunx --bun @better-tables/cli docs

# Open specific package documentation
pnpm dlx @better-tables/cli docs core      # Core package docs
pnpm dlx @better-tables/cli docs ui        # UI package docs
pnpm dlx @better-tables/cli docs drizzle   # Drizzle adapter docs

Available Commands

  • docs [type] - Open documentation in browser

    • type: Optional. One of: main, core, ui, drizzle (default: main)
  • init - Initialize Better Tables in your project

    • --cwd <path>: Working directory (default: current directory)
    • --skip-shadcn: Skip shadcn component installation
    • -y, --yes: Skip confirmation prompts

Examples

# Open main README
pnpm dlx @better-tables/cli docs

# Open core package documentation
npx @better-tables/cli docs core

# Open UI package documentation
bunx --bun @better-tables/cli docs ui

# Open Drizzle adapter documentation
pnpm dlx @better-tables/cli docs drizzle

# Initialize Better Tables in your project
pnpm dlx @better-tables/cli init

# Initialize with custom working directory
npx @better-tables/cli init --cwd ./my-project

# Initialize without shadcn component installation
bunx --bun @better-tables/cli init --skip-shadcn

# Initialize without prompts (non-interactive)
pnpm dlx @better-tables/cli init -y

Installation (Optional)

If you prefer to install globally:

npm install -g @better-tables/cli
# Then use: better-tables docs
# Or: better-tables init

Initialization

The init command helps you set up Better Tables in your project:

  1. Validates shadcn setup - Checks for components.json configuration
  2. Installs missing shadcn components - Automatically installs 21 required UI components
  3. Copies Better Tables files - Copies table, filter, hook, store, and utility files to your project
  4. 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:

  1. Install peer dependencies:

    npm install @better-tables/core zustand @dnd-kit/core @dnd-kit/sortable
  2. Import and use BetterTable:

    import { BetterTable } from '@/components/table/table';

Development

# Build
bun run build

# Watch mode
bun run dev

# Test
bun test

# Lint
bun run lint

Testing Locally

Option 1: Using Bun (Recommended)

# From the CLI package directory
cd packages/cli

# Build the package
bun run build

# Test the CLI directly
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

# Or use bun to run the source directly
bun src/cli.ts docs
bun src/cli.ts docs core
bun src/cli.ts init --help

Option 2: Using pnpm dlx (Local Package)

# From the monorepo root
cd ../..

# Build the CLI package first
bun run build --filter @better-tables/cli

# Test using pnpm dlx (will use local package)
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

# From the CLI package directory
cd packages/cli

# Build first
bun run build

# Link globally (npm)
npm link

# Or use pnpm link
pnpm link --global

# Then use from anywhere
better-tables docs
better-tables docs core
better-tables init --help

Option 4: Run Tests

# From the CLI package directory
cd packages/cli

# Run all tests
bun test

# Run tests in watch mode
bun test --watch

# Run tests with coverage
bun test --coverage

Testing the Bin Entry Point

After building, you can test the bin entry point:

# From the CLI package directory
cd packages/cli
bun run build

# Test the bin entry
./dist/cli.js docs
./dist/cli.js docs core
./dist/cli.js init --help
./dist/cli.js --version
./dist/cli.js --help

License

MIT