A single source of truth for documentation, keeping things DRY and maintainable.
- Starting in your
-ror--rootfolder, docbits will look for variables in the format${variable-name}. - For each variable, it will look in your
_bitsfolder for a file name that matches the variable name (without the extension).${foo}will look for a file in_bitsmatchingfoo*, which could be a file namedfoo.mdorfoo.ymlor justfoo.
- 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
-oor--outputDir, preserving the existing folder structure.
npm install --save-dev docbitsYou can run docbits directly from the CLI or it can be imported and run in code via the API.
npx docbits --helpimport { 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.