An open API service indexing awesome lists of open source software.

https://github.com/gamtiq/jsdoc-file

JSDoc plugin to create files inside directory of generated documentation (e.g. .nojekyll etc)
https://github.com/gamtiq/jsdoc-file

content create directory documentation empty file jsdoc nojekyll plugin write

Last synced: 4 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# jsdoc-file

[JSDoc](https://jsdoc.app/) plugin to create files inside directory of generated documentation (e.g. `.nojekyll` etc).

## Table of contents

* [Installation](#install)
* [Usage](#usage)
* [Examples](#examples)
* [Related projects](#related)
* [Contributing](#contributing)
* [License](#license)

## Installation [↑](#start)

npm install jsdoc-file --save-dev

This plugin requires the following:
* JSDoc version >= 3.2.1

## Usage [↑](#start)

1. Add plugin into `plugins` array of a [JSDoc configuration file](https://jsdoc.app/about-configuring-jsdoc.html#configuring-plugins):

```json
{
...
"plugins": [
...
"jsdoc-file"
],
...
}
```

2. Specify files that should be created as value of `opts.fileSet` field in the [JSDoc configuration file](https://jsdoc.app/about-configuring-jsdoc.html#incorporating-command-line-options-into-the-configuration-file):

```json
{
"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 [↑](#start)

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

Create one empty file:
```json
"fileSet": ".nojekyll"
```
or
```json
"fileSet": {
".nojekyll": ""
}
```
or
```json
"fileSet": {
".nojekyll": true
}
```

Create several files at once:
```json
"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:
```json
"fileSet": {
".nojekyll": false,
"a.txt": "content",
"some/dir/file.md": null
}
```

## Related projects [↑](#start)

* [makef](https://github.com/gamtiq/makef) - a utility to create files inside specified directory.
* [typedoc-light-theme](https://github.com/gamtiq/typedoc-light-theme) - [TypeDoc](https://typedoc.org/) theme that adds some useful options (header links, custom style and script, ability to create files etc).

## Contributing [↑](#start)
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 [↑](#start)
Copyright (c) 2020-2021 Denis Sikuler
Licensed under the MIT license.