npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

manner-docs

v0.1.12

Published

Walk Manner-based api and generate docs from schema files directly. No need for Fancy code comments!

Downloads

14

Readme

Manner-docs

Generate documentation for your Manner API directly from you schema files!

Note: This package is meant to be used in tandem with Manner

Usage - Markdown


If your api is in a folder named v1:

Create a file named docs.js

const docs = require('manner-docs')
const join = require('path').join

/**
 * Generate documentation in MarkDown format
 */

docs(join(__dirname, 'v1'), {output: 'markdown'})

and add the following to your package.json file:

    "scripts": {
        "gendocs": "node docs.js"
    }

and run with the command: npm run gendocs Then watch in awe as your v1 folder now contains a directory called docs with a structure resembling your api, but filled with MarkDown files that contain all the documentation you need for your API!

Usage - Static Website


If your API is in a folder named v1

create a file named docs.js and add the following code:

const docs = require('manner-docs')
const join = require('path').join

/**
 * Generate documentation and export to static website
 */

docs(join(__dirname, 'v1'), {output: 'static', config: {output: join(__dirname, 'v1', 'static_docs'), data: {name: 'My API', description: 'API For My App'}}})

then add this script to your package.json file:

    "scripts": {
        "gendocs": "node docs.js"
    }

then run npm run gendocs and watch as a directory named static_docs appears in your v1 directory!

This directory contains:

  • public directory: where the outputted index.js lives (if you set your configuration as above)
  • data directory: Stores a large JSON file containing all the data relevant to build the static website based on your api
  • static directory: contains the index.ejs file used to generate the static website

Congratulations! You just generated a fully fledged API documentation website with minimal hassel! All the data lives inside index.html so feel free to customize it as you like! Though, I would recommend moving it from the specified output directory, as it will be overwritten if you generate your docs again!

Config Data for Static option

When you choose to export your Manner-docs as a static website, it is recommended that you also include a config object in your options as such:

{output: 'static', config: {output: join(__dirname, 'v1', 'static_docs'), data: {name: 'My API', description: 'API For My App'}}}

Which sets the following:

  • config.output is the directory where you wish to export your static website data to
  • config.data is used to fill in the jumbotron header on the website. This consists of the following:
    • name is the name of your API project/the title for the static website
    • description serves as the subheading for your static website

Serving your Static site

This part is up to you! You can use a custom express server, raw NodeJS, etc. The site is just standard HTML! Serve it how you like.

My humble recommendation is http-server a blazingly fast, simple to use server that you can setup directly in your NPM scripts!

Installation


npm install manner-docs --save-dev

Contributing


If you'd like to contribute, feel free to fork the project and start hacking!