Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating NPM packages, how to document them?

I'm in the process of creating a few NPM packages and I'd like to know what are the best practices to write the user documentation for them (as there's very little information, and searching for anything related with npm package documentation inevitably yields to the npm docs themselves).

When you publish a package, where does the registry get the front page document from?

I guess that having a nice README.md file is the first step for anybody that browses the github repo, but I'd like to provide a convenient way to read the compiled JsDoc too.

like image 690
fortran Avatar asked Jul 18 '14 19:07

fortran


People also ask

How do I save a package in npm?

–npm install --save or -S: When the following command is used with npm install this will save all your installed core packages into the dependency section in the package. json file. Core dependencies are those packages without which your application will not give the desired results.

How do I publish an NPM package to an organization?

Publishing a public organization scoped package To publish an organization scoped package as public, use npm publish --access public . On the command line, navigate to the package directory. Run npm publish --access public .

Is publishing NPM package free?

Note: Before you can publish private user-scoped npm packages, you must sign up for a paid npm user account. Additionally, to publish private organization-scoped packages, you must create an npm user account, then create a paid npm organization.


2 Answers

The npm package page for a package gets the data in the table at the top from either package.json fields in your package (name, description, dependencies, etc) or from the npm databases themselves (download graph, last published, stars, dependents, etc). The stuff below that is just the README.md converted from markdown to HTML.

So a good README.md is all most packages do. If you want to build your jsdoc into HTML and publish that somewhere (perhaps just the git repo itself), I would suggest just linking to that prominently in the README and calling it good.

like image 100
Peter Lyons Avatar answered Sep 22 '22 01:09

Peter Lyons


I found an interesting package to make the README.md out from jsdoc:

https://www.npmjs.org/package/jsdoc-to-markdown

like image 21
fortran Avatar answered Sep 24 '22 01:09

fortran