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

dir3

v1.0.2-c

Published

Generate directory tree files with customizable ignore patterns

Downloads

25

Readme

Dir3 - Directory Tree Generator

A command-line utility to generate directory tree files with customizable ignore patterns.

Installation

You can run this utility directly with npx without installation:

npx dir3

Or install it globally:

npm install -g dir3

Usage

Navigate to any directory and run:

dir3

This will:

  1. Check for a .dir3.ignore file in the current directory
  2. If not found, prompt you to create one with default patterns or custom patterns
  3. Generate a directory-tree.txt file with the directory structure

Use case example

add dir3 to your package.json scripts to generate a directory tree after building your project for new team members (or your future self) to see the project structure at a glance:

"build": "tsc && dir3"

First Run

On the first run in a directory, you'll be prompted:

.dir3.ignore not found. Create with default ignore patterns? (Y/n)
  • Yes (default): Creates .dir3.ignore with common ignore patterns
  • No: Allows you to specify custom ignore patterns

Default Ignore Patterns

The default .dir3.ignore includes common directories and files that are typically excluded:

  • node_modules - Node.js dependencies
  • .git - Git repository data
  • dist, build, out - Build outputs
  • __pycache__, .pytest_cache - Python cache
  • venv, .venv - Python virtual environments
  • .idea, .vscode - IDE configuration
  • *.log - Log files
  • .DS_Store - macOS system files
  • coverage - Test coverage reports
  • And many more...

Ignore File Format

The .dir3.ignore file supports:

  • Exact names: node_modules
  • Wildcards: *.log, temp*
  • Comments: Lines starting with #
  • Empty lines: Ignored

Example .dir3.ignore:

# Dependencies
node_modules
vendor

# Build outputs  
dist
build
*.min.js

# Logs
*.log
logs/

# OS files
.DS_Store
Thumbs.db

Output

The generated directory-tree.txt contains:

  • Generation timestamp
  • Root directory path
  • Ignore file location
  • Tree structure with folders (📁) and files (📄)

Example output:

Directory Tree - Generated with dir3 on 2025-01-15T10:30:00.000Z
Root: /Users/example/my-project
Ignore file: .dir3.ignore
────────────────────────────────────────────────────────────────────────────────

📁 .
├── 📁 src
│   ├── 📄 index.ts
│   └── 📄 test.ts
│   └── 📁 components
│       ├── 📄 Header.js
│       └── 📄 Footer.js
├── 📄 .dir3.ignore
├── 📄 package.json
├── 📄 README.MD
└── 📄 tsconfig.json

Run tests

npm test

Or run directly after building

npm run build
node dist/test.js

Features

  • Interactive setup: Prompts for ignore file creation on first run
  • Optimized performance: Efficient directory traversal with depth limits
  • Smart filtering: Supports glob-like patterns in ignore files
  • Error handling: Gracefully handles permission issues and broken symlinks
  • Sorted output: Directories first, then files, all alphabetically sorted
  • Visual indicators: Clear folder and file icons in output

Requirements

  • Node.js 14.0.0 or higher

License

MIT

Repository

GitHub - dir3