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

node.jsNpm

node.js Problem Overview


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?

node.js Solutions


Solution 1 - node.js

> 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:

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGProstView Question on Stackoverflow
Solution 1 - node.jsrspView Answer on Stackoverflow