jsdoc-file

1.1.0 • Public • Published

jsdoc-file

JSDoc plugin to create files inside directory of generated documentation (e.g. .nojekyll etc).

Table of contents

Installation

npm install jsdoc-file --save-dev

This plugin requires the following:

  • JSDoc version >= 3.2.1

Usage

  1. Add plugin into plugins array of a JSDoc configuration file:
{
    ...
    "plugins": [
        ...
        "jsdoc-file"
    ],
    ...
}
  1. Specify files that should be created as value of opts.fileSet field in the JSDoc configuration file:
{
    "opts": {
        ...
        "fileSet": {
            ".nojekyll": "",
            "LICENSE-MIT": "Copyright (c) ..."
        }
    },
    ...
}

You can specify one or several files and provide content for them.
If a file does already exist in documentation directory the file will be overwritten.
It is possible to set file path that includes subdirectories inside documentation directory (necessary subdirectories will be automatically created).
You can skip creation of a file by setting false/null value for the file.
If you set an object or an array as a value for a file the corresponding JSON will be written into the file.
See examples below.

Examples

In the following examples "opts": {...} is omitted for brevity.

Create one empty file:

"fileSet": ".nojekyll"

or

"fileSet":  {
    ".nojekyll": ""
}

or

"fileSet":  {
    ".nojekyll": true
}

Create several files at once:

"fileSet":  {
    ".nojekyll": true,
    "LICENSE": "Some license data here",
    "very/important/file.txt": "very important data",
    "config.json": {
        "a": 2,
        "topics": ["home", "docs"],
        "url": "http://some.server.net"
    }
}

Skip creating some files by setting false/null value for them:

"fileSet":  {
    ".nojekyll": false,
    "a.txt": "content",
    "some/dir/file.md": null
}

Related projects

  • makef - a utility to create files inside specified directory.
  • typedoc-light-theme - TypeDoc theme that adds some useful options (header links, custom style and script, ability to create files etc).

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

Copyright (c) 2020-2021 Denis Sikuler
Licensed under the MIT license.

Package Sidebar

Install

npm i jsdoc-file

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

13.9 kB

Total Files

11

Last publish

Collaborators

  • gamtiq