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

@pavan-kumar-kn/folder_mapper

v1.0.2

Published

Generate beautiful directory tree structures for documentation

Downloads

300

Readme

folder_mapper

A CLI tool to generate beautiful directory tree structures for documentation. Automatically respects .gitignore patterns and supports custom ignore patterns.

Installation

Quick Start

npx @pavan-kumar-kn/folder_mapper <source_dir> <output_dir>
npm install -g @pavan-kumar-kn/folder_mapper

Now you can use folder_mapper from anywhere in your terminal.

Usage

Basic Syntax

folder_mapper <source_path> <output_path> [options]

Arguments

  • <source_path> - Directory to scan (required)
  • <output_path> - Directory where structure.md will be saved (required)

Options

  • -i, --ignore <patterns> - Additional patterns to ignore (comma-separated)
  • -h, --help - Show help information
  • -v, --version - Show version number

Examples

Basic usage (scan current directory)

folder_mapper . ./output

Scan specific directory

folder_mapper ./src ./docs

Add custom ignore patterns

folder_mapper . ./output --ignore "build,temp,cache"

Ignore multiple patterns

folder_mapper ./src ./docs --ignore "*.log,*.tmp,coverage,dist"

Short form with alias

folder_mapper . ./output -i "build,temp"

Output Example

The tool generates a structure.md file with the following format:

project-root
├── src
│   ├── cmd
│   │   └── command.ts
│   ├── core
│   │   ├── printer.ts
│   │   ├── scanner.ts
│   │   └── tree.ts
│   └── handlers
│       └── handler.ts
├── utils
│   ├── helper.ts
│   └── ignore.ts
├── .gitignore
├── index.ts
├── package.json
├── README.md
└── tsconfig.json

Statistics Output

After scanning, the tool displays helpful statistics:

Scan complete!

Stats:
├─ Total files: 42
├─ Total directories: 15
├─ Output path: ./output/structure.md
└─ Time taken: 0.15s

How It Works

  1. Reads .gitignore file from the source directory (if exists)
  2. Merges .gitignore patterns with custom --ignore patterns
  3. Recursively scans the directory structure
  4. Filters out ignored files and directories
  5. Builds a tree structure
  6. Generates structure.md in the output directory

Ignore Patterns

Automatic .gitignore Support

The tool automatically reads and applies patterns from your .gitignore file:

  • node_modules
  • dist
  • build
  • .env
  • coverage
  • etc.

Custom Patterns

Add additional patterns using the --ignore flag:

folder_mapper . ./output --ignore "temp,cache,*.log"

Patterns are merged with .gitignore, so you don't need to repeat existing ignore rules.

Use Cases

  • Generate directory structure for README files
  • Document project architecture
  • Create folder maps for onboarding
  • Visualize codebase structure
  • Export project tree for presentations

Requirements

  • Bun runtime or node runtime (if going with the npm version)

Development

For development setup and docs please refer to the Dev Docs.

🚀 What's Next?

Phase 2 starts 1/1/26! Check out our Complete Roadmap for upcoming features:

  • GitHub Actions integration for auto-updating structure files
  • Multiple output formats (JSON, HTML, plain text)
  • VSCode extension & enhanced npm usage

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

MIT

Author

Pavan Kumar KN

Notice

This project is actively maintained. Please report any issues or suggestions through the GitHub issue tracker.
⭐ If this tool saved you time documenting your project, please consider starring the repo.  
It really helps keep the project alive.