del-cli

Cross-platform command-line tool to delete files and directories with glob support

Tool
npm
v7.0.0
332stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
40/100Fair
Development Activity0
Maintenance20
Community60
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture78
Code Quality82
Innovation55
Learning Curve95

del-cli is a small cross-platform command-line tool for deleting files and directories, built on the del library. It is designed for build scripts and automation where you need a reliable, portable alternative to rm -rf or the rimraf CLI.

It supports glob patterns (even on Windows), a dry-run mode that lists what would be removed without touching anything, and a safer-by-default policy that refuses to delete parent or working directories unless explicitly forced.

What You Get

  • A del/del-cli binary for deleting paths from the command line
  • Glob pattern matching, including negation, that works on Windows too
  • A --dry-run mode to preview deletions safely
  • Safe-by-default guards against deleting parent/working directories
  • A --verbose flag to print absolute paths as items are removed

Common Use Cases

  • Cleaning build/output directories in npm scripts
  • Removing generated artifacts in CI pipelines cross-platform
  • Deleting files by glob pattern without shell-specific behavior
  • Replacing rimraf or rm -rf with a safer, portable command

Under The Hood

Architecture - The tool is a single cli.js entry point that parses arguments with meow and forwards the resolved paths and options to the del library, which performs the actual glob resolution and filesystem deletion. Error output is formatted via presentable-error.

Tech Stack - Node.js CLI (ESM), depending on del for deletion, meow for argument parsing, and presentable-error for friendly errors. Distributed on npm with del and del-cli bin aliases.

Code Quality - The codebase is intentionally tiny — a CLI file plus a test.js suite — following sindresorhus’s conventions with a focused, single-responsibility design and an accompanying test file.

API Design - The command surface is minimal and self-explanatory: pass paths or globs, optionally with --force, --dry-run, or --verbose. The --help output documents everything, and safe defaults (no parent-directory deletion) protect against foot-guns.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search