0.4.1 • Published 3 years ago

docbits v0.4.1

Weekly downloads
11
License
MIT
Repository
github
Last release
3 years ago

docbits

A single source of truth for documentation, keeping things DRY and maintainable.

How it works

  • Starting in your -r or --root folder, docbits will look for variables in the format ${variable-name}.
  • For each variable, it will look in your _bits folder for a file name that matches the variable name (without the extension).
    • ${foo} will look for a file in _bits matching foo*, which could be a file named foo.md or foo.yml or just foo.
  • Once found, the variable will be replaced by the exact file contents of the bit. This could be a single word or a multi-line file.
  • Finally, the resulting documentation will be written at -o or --outputDir, preserving the existing folder structure.

Installation

npm install --save-dev docbits

Usage

You can run docbits directly from the CLI or it can be imported and run in code via the API.

CLI

npx docbits --help

API

import { resolveBits, writeResult } from 'docbits'

main()

async function main() {
  return writeResult(resolveBits())
}

You don't have to write the result, if you have something else in mind.

async function main() {
  for await (const [relativePath, contents] of resolveBits()) {
    // do stuff
  }
}

This works, because resolveBits is an async generator function, yielding each relativePath and contents as they become available.

0.4.1

3 years ago

0.4.0

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.3.1

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.1

3 years ago