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

@dandesdev/scaf

v1.0.2

Published

A cross-platform directory scaffold CLI tool

Downloads

174

Readme

scaf

A CLI tool that prints the scaffold of a project, I made it for myself because I needed powerful and easier ignore patterns in my windows 10 machine. Its node based, so cross-platform, and It can output to a txt or a json file, see examples bellow.

Installation

npm install -g @dandesdev/scaf

You absolutely can use the package manager of your choice, it doesn't need to be npm, but you need node already installed.

Project Structure

The code is organized into focused modules in the lib/ folder:

  • parseArgs.js - Command-line argument parsing
  • help.js - Help message display
  • ignore.js - Gitignore/dockerignore file loading
  • filter.js - File filtering logic
  • sort.js - Sorting and stat retrieval
  • format.js - Output formatting for text and JSON
  • stats.js - Statistics tracking and calculation
  • scan.js - Directory tree building and streaming

The main entry point (bin/scaf.js) orchestrates these modules.

Usage

scaf [options]

Options

| Flag | Short | Description | Default | |------|-------|-------------|---------| | --path | -p | Target directory | Current directory | | --maxdepth | -md | Maximum folder depth | Infinite | | --output | -o | Save to file (.txt or .json) | Print to console | | --ignore | -i | Patterns to ignore | None | | --typed-ignore | -ti | Enable typed ignore mode | Disabled | | --only | -n | Show only matching patterns | All (filtered) | | --dirs-only | -d | Show only directories | Disabled | | --size | - | Show file sizes | Disabled | | --show-hidden | -a | Show hidden files (dotfiles) | Disabled | | --sort | - | Sort by: name, size, date | name | | --stats | - | Show stats: console, include, all | None | | --stats-only | - | Show detailed stats: strict, all | None | | --gitignore | - | Load .gitignore patterns (true/false) | true | | --dockerignore | - | Load .dockerignore patterns (true/false) | true | | --buffered | -b | Use buffered mode for text output | Disabled | | --quiet | -q | Suppress info messages | Disabled | | --help | -h | Show help | - |

Ignore Patterns

Default Mode (-i)

Ignores items by exact name or extension:

scaf -i node_modules .git .env .log
  • node_modules → ignores file or folder named "node_modules"
  • .log → ignores all files ending in .log

Typed Mode (-ti + -i)

Makes patterns type-aware. Use trailing / for folders:

scaf -ti -i bin/ config *. .tmp
  • bin/ → ignores only the folder "bin"
  • config → ignores files named "config" (any extension: config.js, config.json)
  • *. → ignores all files (shows only folders)
  • */ → ignores all folders (shows only root-level files)
  • .tmp → still works as extension match

Examples

Basic tree

scaf

Scan specific directory

scaf -p ./src

Limit depth

scaf -md 2

Save to text file

scaf -o structure.txt

Save to JSON

scaf -o tree.json

Ignore common folders

scaf -i node_modules .git dist

Ignore only the bin folder

scaf -ti -i bin/

Ignore all config files (any extension)

scaf -ti -i config

Show only folders

scaf -ti -i *.

Show only files (ignore all folders)

scaf -ti -i */

Complex ignore

scaf -ti -i node_modules/ *.md .env config

Combine options

scaf -p ./myapp -md 3 -ti -i node_modules/ dist/ *.log -o output.txt

Show only TypeScript files

scaf -n .ts .tsx

Show file sizes sorted by size

scaf --size --sort size

Generate statistics

scaf --stats
scaf --stats all -o report.txt
scaf --stats-only -o stats.json

Include hidden files

scaf -a

Note!

scaf -i -ti src/

will not ignore the folder "src", you must pass all the arguments of the flag "-i" right after it, the correct way would be:

scaf -ti -i src/

Output Format

Text (default)

└── MyApp/
├── src/
│   ├── components/
│   │   └── Button.tsx
│   └── index.ts
└── package.json

JSON

[
  {
    "name": "MyApp",
    "type": "directory",
    "children": [
      {
        "name": "src",
        "type": "directory",
        "children": [
            {
                "name": "components",
                "type": "directory",
                "children": [
                    {
                        "name": "Button.tsx",
                        "type": "file"
                    }
                ]
            }
        ]
      },
      {
        "name": "package.json",
        "type": "file"
      }
    ]
  }
]

### License

MIT