jsdoc-file

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


Keywords
jsdoc, plugin, create, file, directory, write, content, documentation, empty, .nojekyll, nojekyll
License
MIT
Install
npm install jsdoc-file@1.1.0

Documentation

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:

  • Node.js version >= 6.4
  • 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
}

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 Denis Sikuler
Licensed under the MIT license.