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

npm-scripts-tree

v1.4.1

Published

Displays npm scripts hierarchies

Readme

npm version Dependency Status

npm-scripts-tree

npm run without argument displays 2 flat lists:

  1. Official life-cycle scripts : start, test, postinstall
  2. Your custom made scripts : their name followed by their command.

npm-scripts-tree offers an alternative view.

Nested scripts.

It's pretty common to have meta scripts delegating to sub-scripts.

For instance:

"scripts": {
  "build": "npm run build:css && npm run build:js",
  "build:css": "do JS stuff",
  "build:js": "do CSS stuff"
}

npm-scripts-tree detects the relationship between these scripts and displays them in a tree fashion, recursively if needed. See detailed example below.

pre / post scripts

By starting your scripts name by pre or post you declare your own life-cycle hooks. This kind of dependency between scripts is also taken into account in the final output.

serial / parallel

npm-run-all dependencies are also supported!

Install

npm i -g npm-scripts-tree

Usage

Run npm-scripts-tree in the directory containing the package.json you want to inspect.

  • Life-cycle scripts are displayed in cyan
  • Scripts that are not sub-scripts are displayed in bold

Tip: you may want to create a shell alias like alias nst='npm-scripts-tree'.

Options

-a, --alpha List scripts alphabetically -p, --prune Remove life-cycle scripts and explicit sub-scripts (containing a :) from tree top level

Example

Fake package.json located in the test directory.

{
	"scripts": {
		"a": "npm run b && npm run c",
		"preb": "prefoo",
		"b": "foo",
		"c": "npm run d",
		"d": "bar",
		"e": "npm-run-all b d",
		"f": "npm-run-all --serial b d",
		"g": "npm-run-all --serial g:*",
		"g:a": "qux",
		"g:b": "yolo"
	}
}

Output in the terminal (without colors):

10 scripts
├─┬ a — npm run b && npm run c
│ ├─┬ b — foo
│ │ └── preb — prefoo
│ └─┬ c — npm run d
│   └── d — bar
├── preb — prefoo
├─┬ b — foo
│ └── preb — prefoo
├─┬ c — npm run d
│ └── d — bar
├── d — bar
├─┬ e — npm-run-all b d
│ ├─┬ b — foo
│ │ └── preb — prefoo
│ └── d — bar
├─┬ f — npm-run-all --serial b d
│ ├─┬ b — foo
│ │ └── preb — prefoo
│ └── d — bar
├─┬ g — npm-run-all --serial g:*
│ ├── g:a — qux
│ └── g:b — yolo
├── g:a — qux
└── g:b — yolo

After pruning:

7 scripts
├─┬ a — npm run b && npm run c
│ ├─┬ b — foo
│ │ └── preb — prefoo
│ └─┬ c — npm run d
│   └── d — bar
├─┬ b — foo
│ └── preb — prefoo
├─┬ c — npm run d
│ └── d — bar
├── d — bar
├─┬ e — npm-run-all b d
│ ├─┬ b — foo
│ │ └── preb — prefoo
│ └── d — bar
├─┬ f — npm-run-all --serial b d
│ ├─┬ b — foo
│ │ └── preb — prefoo
│ └── d — bar
└─┬ g — npm-run-all --serial g:*
  ├── g:a — qux
  └── g:b — yolo

License

MIT