Skip to content

@onerepo/plugin-docgen

Install via npm
npm install --save-dev @onerepo/plugin-docgen
function docgen(opts): Plugin;

Include the eslint plugin in your oneRepo plugin setup:

onerepo.config.ts
import { docgen } from '@onerepo/plugin-docgen';
export default {
plugins: [docgen()],
};
ParameterType
optsOptions
type Options: {
format: "markdown" | "json";
name: string | string[];
outFile: string;
outWorkspace: string;
safeWrite: boolean;
};

Full configuration options for the Docgen core command.

onerepo.config.ts
import { docgen } from '@onerepo/plugin-docgen';
export default {
plugins: [
docgen({
format: 'markdown',
outFile: './docs/cli.md',
safeWrite: true,
}),
],
};
optional format: "markdown" | "json";

Default output format for the documentation

  • Default: 'markdown'
optional name: string | string[];

Override the name of the command.

  • Default: 'docgen'
optional outFile: string;

If set, a file will be written by default to the given location (in the given outWorkspace)

optional outWorkspace: string;

If outFile is also set, the generated documentation will be written out.

optional safeWrite: boolean;

Set to true to amend content to the given file using the file.writeSafe | `file.writeSafe` method.

Generate documentation for the oneRepo cli.

Terminal window
one docgen [options...]

Help documentation should always be easy to find. This command will help automate the creation of docs for this command-line interface. If you are reading this somewhere that is not your terminal, there is a very good chance that this command was already run for you!

Add this command to your one Repo tasks on pre-commit to ensure that your documentation is always up-to-date.

OptionTypeDescription
--addbooleanAdd the output file to the git stage
--format"markdown", "json", default: "markdown"Output format for documentation
--heading-levelnumberHeading level to start at for Markdown output
--out-filestringFile to write output to. If not provided, stdout will be used
--out-workspacestringWorkspace name to write the —out-file to
--safe-writebooleanWrite documentation to a portion of the file with start and end sentinels.
Advanced options
OptionTypeDescription
--commandstringStart at the given command, skip the root and any others
--show-advancedbooleanPair with --help to show advanced options.
--use-defaultsbooleanUse the oneRepo default configuration. Helpful for generating default documentation.