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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dprint-cli

v0.4.1

Published

JavaScript implementation of dprint CLI for formatter

Readme

dprint-cli

A JavaScript implementation of the dprint CLI for code formatting. This tool provides the core functionality of dprint, allowing you to format source code files using dprint's plugin system.

Usage

# install with your package manager
bun add -D dprint-cli @dprint/{typescript,json}
npm install -D dprint-cli @dprint/{typescript,json}

# or run directly
bunx dprint-cli
npx dprint-cli

Features

  • Multiple Language Support: Format TypeScript, JavaScript, JSON, and Markdown files
  • Plugin System: Load formatters from npm packages
  • Configuration: Uses dprint.json for configuration with include/exclude patterns
  • Three Main Commands:
    • init - Initialize a new configuration file
    • fmt - Format files and write changes
    • check - Check if files are formatted correctly
  • Rust dprint Compatibility: Exit codes and behavior match the official Rust dprint CLI

Installation

First, install the dependencies:

npm install

Make the CLI executable:

chmod +x bin/dprint

Optionally, link it globally:

npm link

Usage

Initialize Configuration

Create a new dprint.json configuration file in the current directory:

node bin/dprint init

Format Files

Format all files according to the configuration:

node bin/dprint fmt

Format specific files or patterns:

node bin/dprint fmt src/**/*.ts
node bin/dprint fmt -- src/**/*.ts test/**/*.js

Check Formatting

Check if files are formatted correctly without modifying them:

node bin/dprint check

Check specific files:

node bin/dprint check src/**/*.ts

Configuration

The dprint.json file configures which files to format and how. Example:

{
  "$schema": "https://dprint.dev/schemas/v0.json",
  "projectType": "openSource",
  "incremental": true,
  "includes": ["**/*.{ts,tsx,js,jsx,json,md}"],
  "excludes": [
    "**/node_modules",
    "**/*-lock.json",
    "**/dist",
    "**/build",
    "**/coverage"
  ],
  "plugins": [
    "@dprint/typescript",
    "@dprint/json",
    "@dprint/markdown"
  ],
  "typescript": {},
  "json": {},
  "markdown": {}
}

Plugin Configuration

Plugins are loaded from your node_modules directory. Make sure to install the required plugins:

npm install @dprint/typescript @dprint/json @dprint/markdown

The plugins in dprint.json should match npm package names installed in your project.

How It Works

  1. Configuration Discovery: Searches for dprint.json starting from the current directory and walking up the directory tree
  2. Plugin Loading: Dynamically imports formatter plugins from npm packages
  3. File Discovery: Uses glob patterns to find files matching include patterns while excluding specified patterns
  4. Formatting: Loads WASM formatters and applies them to matching files

Example Workflow

# 1. Initialize project
node bin/dprint init

# 2. Install formatter plugins
npm install @dprint/typescript @dprint/json @dprint/markdown

# 3. Format your code
node bin/dprint fmt

# 4. Check formatting in CI
node bin/dprint check

CLI Options

USAGE:
    dprint <SUBCOMMAND> [OPTIONS] [--] [file patterns]...

SUBCOMMANDS:
    init     Initializes a configuration file in the current directory
    fmt      Formats the source files and writes the result to the file system
    check    Checks for any files that haven't been formatted
    help     Shows this help message

OPTIONS:
    --       Treat all following arguments as file patterns

Testing

bun test

License

MIT