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

@seneca/doc

v8.0.0

Published

Documentation helper for Seneca plugins.

Downloads

114

Readme

Seneca Doc

Seneca Doc is a plugin for Seneca

Provides generated documentation for Seneca plugins and injects this documentation into the plugin README.md markdown file.

npm version build Coverage Status Known Vulnerabilities DeepScan grade Maintainability

| Voxgig | This open source module is sponsored and supported by Voxgig. | |---|---|

Documentation helper for Seneca plugins.

Install

$ npm install @seneca/doc -D

Add to your package.json:

{
  "scripts": {
    "seneca-doc": "seneca-doc"
  }
}

And run with

$ npm run seneca-doc

Usage

This utility plugin updates the README.md file in a Seneca plugin repository with auto-generated documentation. Special HTML comment markers are used to indicate the insertion point, and all markdown within these markers is replaced.

  • <!--START:action-list--> ... <!--END:action-list-->
    • Inserts a list of action patterns defined by the plugin
  • <!--START:action-desc--> ... <!--END:action-desc-->
    • Inserts more detailed action descriptions (linked to by action-list)

In the top level folder of your project, create a module called plugin-doc.js where plugin is the name of your plugin. This should return an object whose keys are the names of the action functions in your plugin. Each key should define an action description with properties as defined below. For an example, see doc-doc.js which defines the documentation for this plugin.

Alternatively, return the same data structure from your plugin definition under the doc property.

The export doc/generating will be true if documentation is being generated. You can use this handle cases where your plugin has additional dependencies that fail when it is loaded direcly by seneca-doc.

See the unit tests for examples of usage.

NOTE: Plugins must be loaded via seneca.use() for validation to activate (as well as depending on a validation plugin such as as seneca-joi). In particular, when testing, ensure that the plugin under test is loaded with seneca.use('..') (assuming tests are within a test subfolder).

NOTE: must be loaded before seneca-joi so that the rules are available to seneca-joi.

Arguments

The seneca-doc command takes the following command line arguments:

  • -p - fully qualified plugin name (can be used for multiple plugins) that is needed by the plugin definition function. Example:
    seneca-doc -p seneca-entity -p @seneca/graph -p @seneca/owner

Supported documentation properties

The following properties can be optionally attached to the action function of a given message:

  • desc: String describing the action.
  • examples: An object, where the keys are example paramers, and the values are description strings.
  • validate: The validation object supported by seneca-joi.
  • reply: A literal object showing the reply object structure.

See the source of seneca-doc.js itself for a good example of using these.

NOTE: plugin options are not currently supported - that would make a great pull request! :)

The Action Patterns and Action Descriptions sections below are examples of the generated output, run on the seneca-doc plugin itself.

Options

  • test : boolean
  • errors : object
  • init$ : boolean

Action Patterns

Action Descriptions

« sys:doc,describe:pin »

Provide introspection data for actions matching a pin (a sub pattern).

Examples

  • sys:doc,describe:pin,pin:"a:1,b:2"
    • Describe actions matching at least a:1,b:2.

Parameters

  • pin : alternatives " " : The pin sub pattern in string or object format.

Replies With

{
  pin: 'pin parameter',
  actions: [
    '{ Seneca action definition }'
  ]
}

« sys:doc,describe:plugin »

Provide introspection data for a plugin and its actions.

Examples

  • sys:doc,describe:plugin,plugin:entity

    • Describe the seneca-entity plugin.
  • sys:doc,describe:plugin,plugin:entity$foo

    • Describe the seneca-entity plugin instance with tag foo.

Parameters

  • plugin : string " " : The full name of the plugin (if tagged, use the form name$tag).

Replies With

{
  plugin: 'plugin parameter',
  actions: [
    '{ Seneca action definition }'
  ]
}