# @retrogen/templates

> templates for retrogen, a markdown generator for GitHub organization data

Latest version **0.0.2** (published 2022-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @retrogen/templates
pnpm add @retrogen/templates
yarn add @retrogen/templates
bun add @retrogen/templates
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2022-04-18 |
| First published | 2022-04-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 148.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | Tierney Cyren |
| Maintainers | bnb |

## Links

- npm: https://www.npmjs.com/package/@retrogen/templates
- Repository: https://github.com/cutenode/retrogen
- Homepage: https://github.com/cutenode/retrogen#readme
- Issues: https://github.com/cutenode/retrogen/issues
- npm.io page: https://npm.io/package/@retrogen/templates

## Recent versions

- 0.0.2 (latest) — 2022-04-18
- 0.0.1 — 2022-04-18

## README

# @retrogen/templates

Templates to convert data from `@retrogen/core` into human-readable markdown.

> Note: If you want to use these templates without having to write your own scripts, you'll want to take a look at [`@retrogen/generate`](../generate/)

# Usage

Basic example:

```js
// source: ./examples/default.js

const templates = require('@retrogen/templates')
const data = require('./data/example.json') // assuming you've got generated data in a file

async function useTemplate () {
  // use our basic template with the imported data
  const result = await templates('basic', data)

  // output the result
  console.log(result)
}

useTemplate()
```

An example with data from [`@retrogen/core`](../core/):

```js
// source: ./examples/usingCore.js

  const templates = require('@retrogen/templates')
const core = require('@retogen/core')
const { DateTime } = require('luxon')

async function useTemplate () {
  // set up relative dates
  const now = DateTime.now()
  const then = now.minus({ days: 7 })

  // convert them to usable ISO dates
  const dates = {
    start: then.toISODate(),
    end: now.toISODate()
  }

  // fetch and format our data from GitHub
  const data = await core('nodejs', dates)

  // use our basic template with the generated/formatted data
  const result = await templates('basic', data)

  // output the result
  console.log(result)
}

useTemplate()
```

Addtional examples can be found in [`./examples/`](./examples/).

### API

Assuming you've required this module as `templates`:

* `templates(template, data, options)`
  * `template` String (required) - Valid values:
    * `basic`: a basic template.
    * That's all for now. If you'd like to see another template, [PRs are welcome](https://github.com/cutenode/retrogen/pulls).
  * `data` Object (required):
    * This has to be output from [`@retrogen/core`](../core/).
  * `options` Object (optional):
    * `heading` String (optional): the heading to use for the output Markdown.
      * Default: `# Retrospective for ${data.meta.owner}`.
    * `preface` String (optional): the preface to use for the output Markdown.
      * Default: `Reporting on ${data.meta.issues.count} Issues from ${data.meta.issues.authors.count} authors, ${data.meta.pullRequests.count} Pull Requests from ${data.meta.pullRequests.authors.count} authors, and ${data.meta.discussions.count} Discussions from ${data.meta.discussions.authors.count} authors.`.
    * `includeDatesInHeadings` Boolean (optional): Boolean that tells the template whether to include the dates in the headings if both `options.start` and `options.end` have non-undefined values.
      * Default: `false`.
    * `start` String (optional): Start date of the range passed, in the format of `YYYY-MM-DD`.
    * `end` String (Optional): End date of the range passed, in the format of `YYYY-MM-DD`.

The goal with these API docs is to have a consistent style of documentation for each module in the monorepo. If there's inconsistencies, please feel free to open an issue to let the maintainers know.

---
_Source: https://npm.io/package/@retrogen/templates · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
