joeytwiddle
joeytwiddle

Reputation: 31265

Get or search a list of executables in npm

I am planning to write a command-line tool and release it on npm.

I have a few ideas for what to name the command, and I would like to check if any of the names are already used by other (popular) npm packages.

Is there any way to search the list of executables that can be installed through npm?

Or can I get an entire list of all of them (preferably also linking back to the package they come with)?

(For example, if I was thinking of naming my executable html-beautify, how could I discover that a tool with that name already exists? Surprisingly it exists in this package.)

Upvotes: 1

Views: 426

Answers (2)

joeytwiddle
joeytwiddle

Reputation: 31265

Thanks to Simon's introduction to the nice-registry repositories, I adapted one of those projects to compile a list of CLI names (which map back to the packages which provide them).

https://github.com/joeytwiddle/all-the-clis.0

(It is not yet published to the npm registry, because I am trying to get it adopted into Zeke's nice-registry ecosystem. But right now you can clone the git repo to use it directly.)

If you are wondering if there are executables called jsonpath and html-beautify you can check like this:

$ git clone https://github.com/joeytwiddle/all-the-clis.0
...

$ node

// The null here is recommended to avoid flooding your console

> clis = require('./all-the-clis.0'), null

> clis.jsonpath
[ 'JSONPathCLI' ]

> clis['html-beautify']
[
  '@bmewburn/js-beautify'
  'beautify-less',
  'js-beautify',
  'js-beautify-ejsx',
  'js-beautify-nahid',
  'js-beautify2',
  'js-prettify',
  'sublime-beautify']

If the database is out-of-date, you can rebuild it:

$ npm build

but note that this may take up to 3 hours to finish!

Upvotes: 1

Simon Crane
Simon Crane

Reputation: 2182

There is an npm package that does what you want

https://www.npmjs.com/package/all-the-package-names

Upvotes: 2

Related Questions