Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly use "keywords" property in package.json?

Tags:

node.js

npm

Is it good to list as many as possible keywords for a package (hundred?) or this is a bad approach?

How to list keywords properly?

like image 804
GProst Avatar asked Mar 21 '17 16:03

GProst


People also ask

What is the use of keywords in package json?

The keywords property inside a package. json file is, as you may have guessed, a collection of keywords about a module. Keywords can help identify a package, related modules and software, and concepts.

Can I add custom properties to package json?

Yes, you're allowed to add custom entries to package. json .


1 Answers

Is it good to list as many as possible keywords for a package (hundred?) or this is a bad approach?

You should only use keywords that are relevant to your module and that you would expect people to use while searching for a module like yours.

So if you have a module that uses twitter and has a promise-based api then you may use keywords like "twitter" and "promise" but you shouldn't use irrelevant keywords just to spam the search results.

I cannot think of any legitimate reason to need that many keywords.

How to list keywords properly?

This is an example from my own module, caught - which, as you can see, uses 4 keywords:

{   "name": "caught",   "version": "0.1.1",   "description": "Avoids UnhandledPromiseRejectionWarning and PromiseRejectionHandledWarning",   "main": "index.js",   "types": "index.d.ts",   "scripts": {     "test": "bash test.sh"   },   "repository": {     "type": "git",     "url": "git+https://github.com/rsp/node-caught.git"   },   "keywords": [     "promise",     "async",     "UnhandledPromiseRejectionWarning",     "PromiseRejectionHandledWarning"   ],   "author": "Rafał Pocztarski <[email protected]> (https://pocztarski.com/)",   "license": "MIT",   "bugs": {     "url": "https://github.com/rsp/node-caught/issues"   },   "homepage": "https://github.com/rsp/node-caught#readme" } 

See:

  • https://github.com/rsp/node-caught/blob/master/package.json#L14-L19
like image 128
rsp Avatar answered Sep 27 '22 23:09

rsp