Skip to content

twolfson/docs.npmjs.com

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The place where all things npm will one day be documented

Development

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 Build Process

The prepublish task is run automatically after npm install. This triggers npm run build, which does the following:

  1. Copies npm documentation from ./node_modules/npm/doc to ./content
  2. Walks the content directory collecting markdown files.
  3. Reads the contents of each markdown file.
  4. Parses HTML Frontmatter from the markdown files
  5. Converts markdown to HTML
  6. Writes content.json with HTML content of each file included.
  7. Writes content.lite.json with the same data minus the file content.

The copied and generated files are ignored for two reasons:

  1. Keeps the git history uncluttered.
  2. Prevents humans from accidentally editing auto-generated files

HTML Frontmatter

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.

Webservice

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.

Deployment

export NODE_ENV=production

About

The place where all the docs will live one day.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors