npmlist
Search npm modules' dependencies.
npmlist
is a library providing searching and parsing dependencies, global installs, scripts, profile. It empowers many CLI apps, i.e. npm-fzf
.
Requirements
npmlist
requires Node 8 or above for runtime.
API
Install
$ npm install @hankchanocd/npmlist
Examples
Search npm modules
const { npmSearch } = require("@hankchanocd/npmlist");
let module = ['express'];
npmSearch(module)
.then(i => i.raw())
.then(i => yourFunction)
.catch(err => console.log(err));
// 92 express@4.16.4 express framework sinatra web rest restful router app api
// 91 path-to-regexp@2.4.0 express regexp route routing
List local dependencies
const { npmDependencies } = require("@hankchanocd/npmlist");
const { npmList } = npmDependencies;
npmList()
.raw()
.then(i => yourFunction)
.catch(err => console.log(err));
// @express@1.0.0
// ├── Dependencies
// ├── chalk@2.4.1
List npm module's scripts
const { npmScripts } = require("@hankchanocd/npmlist");
npmScripts()
.raw()
.then(i => yourFunction)
.catch(err => console.log(err));
// @express@1.0.0
// build => babel src/ -d build/ --quiet
// commit => git-cz
npmlist
has a few distinct advantages:
-
npmSearch()
searches for npm modules with npms.io, a better npm search engine thannpm search
with score analysis. -
npmList()
is a replacement for painfully long and slownpm list --depth=0 --local
and othernpm list --@#$%
commands -
npmScripts()
lists npm scripts better thannpm run-script
-
npmRecent()
gives a quick refresher on the recent global installs -
npmGlobal()
finds and prints global modules as fancy asbrew list
, and more than 10x faster thannpm list -g
Read API doc to find out more.
Tests
To perform unit tests and integration tests, simply run npm test
.
Changelog
Contribution
npmlist
started off as a bunch of CLI aliases on top of npm list
and npm info
, but grew larger quickly. It's now very effective at checking a package's dependencies and global installs. This is to say we are not afraid of expanding npmlist
features beyond the current realm.
The roadmap for npmlist
now focuses on serving as a library to provide a quick and concise report on terminal, freeing developers from the burden of constant switching between terminal and browser. See Wiki for npmlist
's code architecture, developments rules, and styles. See here on how to contribute.
Use Cases
npm-fzf
- Fuzzy search npm modules with fzf