npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@retrogen/templates

v0.0.2

Published

templates for retrogen, a markdown generator for GitHub organization data

Downloads

88

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

Usage

Basic example:

// 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:

// 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/.

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.
    • data Object (required):
    • 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.