The place where all things npm will one day be documented
Download node at nodejs.org and install it, if you haven't already.
To run the app locally:
npm install
npm start
Now you have a server running at at localhost:5000
The prepublish
task is run automatically after npm install
. This
triggers npm run build
, which does the following:
- Copies npm documentation from
./node_modules/npm/doc
to./content
- Walks the content directory collecting markdown files.
- Reads the contents of each markdown file.
- Parses HTML Frontmatter from the markdown files
- Converts markdown to HTML
- Writes content.json with Base64-encoded markdown contents AND HTML contents
- Writes views/partials/nav.hbs
The copied and generated files are ignored for two reasons:
- Keeps the git history uncluttered.
- Prevents humans from accidentally editing auto-generated files
Read all about it on the html-frontmatter README.
If a file has a title
property in its frontmatter, it will be used for
the <title>
of the rendered HTML page. If title
is absent from the
frontmatter, the filename (without the .md extension) is used.
The content.json file is served publicly at /content.json
with CORS support, allowing browsers on other domains to fetch all the npm
documentation and accompanying metadata with a single HTTP call.
export NODE_ENV=production