A well-maintained npm package has a couple of things that make it different from the rest. For instance, it has a detailed readme, a proper license, some keywords, and a detailed author description. Let’s discuss them one by one.
The readme is extremely important since its content is what appears on your package page on npmjs. You need to write all the necessary documentation inside of it like the installation guide or usage guide, etc. So make sure you have everything inside of it that your user might need.
Your npm package should have a proper open-source license. You can add one by using a package called license. For instance, if you are interested in an MIT license, just go ahead and run the following command inside your terminal.
npx license MIT
Now open your package.json file and add a license field there with MIT as its value.
You can also use any other license that you want.
This field is usually empty in your package.json when you do npm init. It is an array that takes the keyword related to your project. Users can look up your package using these keywords. For instance, if you are building a name CLI, you can add your name inside this field.
Last but not least you have an author field inside your package.json file. This field takes a value. You can also give it an object and give your information inside it like this:
"author": { "name": "Ahmad Awais", "url": "https://twitter.com/MrAhmadAwais" },
Now go ahead and publish your package again on npmjs with all of the things that I discussed.
If your package is well maintained and has all the required fields, there is a great chance that the people will use it. Because they will see that the author has made sure that everything is up-to-date and up-to-mark.