How to properly use "keywords" property in package.json?
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?
Solution 1:
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