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

autodocs

v0.10.3

Published

Automates publishing documentation, for use continuous integration and continuous deployment

Downloads

92

Readme

autodocs

Automates publishing API docs for NodeJs projects, useful for continuous integration.

NPM

Build Status Coverage Status

Installation

Install this tool as a devDependency in your NodeJs project, and add a autodocs script to your project's package.json.

This tool is agnostic to how you use to generate documentation - it simply executes npm run generatedocs. Similarly, this tool is agnostic to how you choose to test your generated documentation - it simply executes npm run testdocs.

For example, if you are using this project to publish documentation generated by yuidocjs, you would run:

npm install --save-dev autodocs yuidocjs

... and then add the following the scripts section of package.json:

"scripts": {
  "generatedocs": "node ./node_modules/yuidocjs/lib/cli .",
  "testdocs": "node ./got-or-not.js .",
  "autodocs": "node ./node_modules/autodocs"
}

An easy way to test whether you have generated the files that you expect is to use got-or-not.

Usage

Configure your CI environment to run the autodocs script after the project has successfully built. For example, if using Travis, add this to your .travis.yml

after_success:
- npm run autodocs

Remember that autodocs is responsible for running generatedocs when it determines that it should. There is no need to include generatedocs or testdocs in your CI script - only autodocs, and that will run generatedocs and testdocs when appropriate.

API

autodocs generates its own documentation.

The API that autodocs exposes is designed to be fully operable by means of environment variables. This is the case because that is what continuous integrations environments, which is where autodocs should be getting invoked from most of the time, use.

The API documentation for autodocs documents the full set of options available. The list below is merely a subset - just the most important ones.

In addition to this, publishing also needs a few environment variables to be set:

  • GH_TOKEN
    • Use an encrypted Github access token
  • GH_USER
    • Optional, set to override
    • Default: Inferred from TRAVIS_REPO_SLUG set by Travis
    • Github user name
  • GH_REPO
    • Optional, set to override
    • Default: Inferred from TRAVIS_REPO_SLUG set by Travis
    • Github repository name
  • DOCUMENT_JOB_INDEX
    • Optional, set to override
    • default: 1
    • Documentation will be generated only on one of the jobs for each build, use this to specify which one.
  • DOCUMENT_GENERATED_FOLDER:
    • default: documentation
    • to specify folder where documentation is generated
    • this represents the location of the input for autodocs, and it expects the files needed to be published to be here after running the generatedocs script
  • FLAG_PUBLISH_IN_ROOT
    • default: false
    • whether to publish in the root folder
    • by default, documents will be published in /api/MAJOR_VERSION.MINOR_VERSION
    • if using this module to publish something like a blog, instead of versioned software documentation, you should set this flag to true
  • FLAG_COPY_ASSETS
    • default: false
    • whether there are any assets to copy
    • set to true only if intending to use DOCUMENT_ASSETS
  • DOCUMENT_ASSETS
    • default: ``
    • list of files and folders (bash style) to copy into the root of the gh-pages branch
    • these files will be copied to the root, not the DOCUMENT_PUBLISH_FOLDER

Your Git repository can have many different branches being pushed, but you only have one published documentation, so for DOCUMENT_BRANCH, select the branch for which documentation should be published. It makes the most sense to select the branch from which releases are cut. If you are using either Git Flow or the standard Github branching strategies, it makes the most sense to leave this as master.

Published Result

If your project has built successfully on CI, and you have not overridden the default values for publish folder, visit http://GH_USER.github.io/GH_REPO/api/VERSION.

For example: bguiz.github.io/plugin-registry/api/0.6

The value of VERSION includes the major and minor versions only, because semver (semantic versioning) principles state that if there are any API changes, the major or minor version numbers should be bumped; and conversely, that when a patch version number is bumped, it implies that there have not been any API changes.

This is done so as to be able to provide references for multiple versions of your projects at the same time, which can be handy for users who are unable to upgrade, and also for users determining what has changed from the version they are currently using to the one they wish to switch to.

This is just the default behaviour, and can be configured to do something else via environment variables. See the API documentation for the details.

Contributing

This repository uses the git flow branching strategy. If you wish to contribute, please branch from the develop branch - pull requests will only be requested if they request merging into the develop branch.

When contributing see also the items described in the roadmap.

Author

Maintained by Brendan Graetz

bguiz.com

Licence

GPL-3.0