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 🙏

© 2024 – Pkg Stats / Ryan Hefner

poplr

v1.0.1

Published

A flexible and fun directory tree generator

Downloads

131

Readme

🌳 Poplr

A flexible and fun directory tree generator for the command line.

Installation

npm install -g poplr

Quick Start

# Generate a tree with default settings
poplr

# Or directly use the tree command
poplr tree

Features

  • 📁 Clean, customizable directory tree visualization
  • 🎨 Multiple output formats (Console, Markdown, Text, JSON, HTML)
  • 🔍 Smart sorting (directories first, by name, size, or type)
  • 🎯 File and directory filtering
  • ⚙️ Configurable through .poplrrc files
  • 🖼️ Optional file type icons
  • 📊 Optional directory statistics
  • 🎭 Fancy or simple characters for tree structure

Usage

Interactive Mode

Simply run poplr and choose from the menu:

  • Quick tree (default settings)
  • Custom tree (with export options)
  • About poplr

Command Line Options

# Basic tree generation
poplr tree

# Show file sizes
poplr tree -s

# Show full paths
poplr tree -p

# Set maximum depth
poplr tree -d 2

# Show root directory
poplr tree -r

# Change sort order
poplr tree --sort type

# Show directory statistics
poplr tree --stats

# Export as markdown
poplr tree -f markdown

Available options:

  • -f, --format <type> - Output format (ascii, markdown, txt, json, html)
  • -d, --max-depth <number> - Maximum depth to traverse
  • -s, --show-size - Show file sizes
  • -p, --full-path - Show full paths
  • -r, --show-root - Show root directory
  • --stats - Show directory summary
  • --sort <type> - Sort by (name, type, size, extension)
# Export examples
poplr tree -f markdown > tree.md
poplr tree -f html > tree.html
poplr tree -f json > tree.json
poplr tree -f txt > tree.txt

Configuration

You can create a global or local configuration file:

# Create local config
poplr init

# Create global config
poplr init -g

# View current configuration
poplr config

Configuration File (.poplrrc)

{
    "display": {
        "fancy": true,
        "useIcons": false,
        "useColors": true,
        "showSize": false,
        "showStats": false,
        "showRoot": false,
        "fullPath": false
    },
    "sorting": {
        "enabled": true,
        "default": "directory-first"
    },
    "filtering": {
        "maxDepth": null,
        "exclude": ["node_modules", ".git", ".DS_Store"],
        "include": ["README.md"]
    },
    "export": {
        "defaultFormat": "ascii",
        "outputDir": "./",
        "timestamp": false
    }
}

Output Formats

Console (Default)

├── src/
│   ├── index.js
│   └── utils/
│       └── helper.js
└── package.json

Text File (.txt)

The same as console output but saved to a text file:

├── src/
│   ├── index.js
│   └── utils/
│       └── helper.js
└── package.json

Markdown (.md)

## Directory Structure

* src/
  * index.js
  * utils/
    * helper.js
* package.json

HTML

Generates a styled HTML page with the tree structure:

<!DOCTYPE html>
<html>
<head>
    <title>Directory Tree</title>
</head>
<body>
    <pre>
    ├── src/
    │   ├── index.js
    │   └── utils/
    │       └── helper.js
    └── package.json
    </pre>
</body>
</html>

JSON

{
  "generated": "2024-11-05T20:19:05.327Z",
  "config": {
    "format": "json",
    "showSize": true,
    ...
  },
  "tree": "..."
}

Sorting Options

  • name - Alphabetical order
  • directory-first (default) - Directories at top, then files
  • type - Group by file type
  • size - Largest files first
  • extension - Group by file extension

Examples

# Generate a simple tree
poplr tree

# Export as markdown with file sizes
poplr tree -f markdown -s

# Show only 2 levels deep with stats
poplr tree -d 2 --stats

# Custom tree with interactive options
poplr
# Then select "Custom tree" from the menu

Configuration Precedence

  1. Command line arguments (highest priority)
  2. Local .poplrrc (in current directory)
  3. Global .poplrrc (in home directory)
  4. Default settings (lowest priority)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Author

Rick Knowlton | tiny.