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

reportwarrior

v0.3.1

Published

Tooling to create reports from TaskWarrior using Mozilla Nunjucks.

Downloads

40

Readme

ReportWarrior

Tooling to create reports from TaskWarrior using Mozilla Nunjucks. This tool is ofcourse not limited to HTML. You can generate Markdown reports as well.

Installation

$ npm install -g reportwarrior

Usage

First usage will install configuration in ~/.reportwarrior.

$ task export | reportwarrior -f basic
$ task export | reportwarrior --flow clientAbc

Example output:

<h2>
   <span style="font-weight: bold;background-color: orange;">&nbsp;Pending&nbsp;</span>
   <span>&nbsp;<i>HASS: program Volume control, from Audiolab M-DAC to TV</i></span>
</h2>
<table>
   <tr>
      <th>Priority</th>
      <td>Low</td>
   </tr>
</table>
<small>Task ref bfafac85-84d5-47ab-9d11-0db61c6fd57c</small>
<hr/>
<h2>
   <span style="font-weight: bold;background-color: orange;">&nbsp;Pending&nbsp;</span>
   <span>&nbsp;<i>Buy bookshelves</i></span>
</h2>
<table>
   <tr>
      <th>Priority</th>
      <td>Medium</td>
   </tr>
</table>
<small>Task ref 55713ae1-9d75-48e9-ae28-800da70a4447</small>
<hr/>
<h2>
   <span style="font-weight: bold;background-color: orange;">&nbsp;Pending&nbsp;</span>
   <span>&nbsp;<i>HASS: Add TV to HomeAssistant</i></span>
</h2>
<table>
   <tr>
      <th>Priority</th>
      <td>Low</td>
   </tr>
</table>
<small>Task ref 4a04082b-af4c-46e3-a9b6-c981243cd654</small>
<hr/>

Configuration

In the configuration, as seen as below, there are options to create your own titles, recipients and use specific templates per flow. In the configuration, you could even define momentjs-filters for Mozilla Nunjucks or use momentjs in your configuration. To do that, first run npm init && npm install --save moment in your ~/.reportwarrior-directory.

const os = require('os');
const path = require('path');

module.exports = {
    registerFilters: (njk) => {
        njk.addFilter('priority', p => ({ 'H': 'High', 'M': 'Medium', 'L': 'Low' })[p])
    },
    paths: { templates: path.resolve(os.homedir(), '.reportwarrior/templates') },
    flows: {
        basic: { template: "basic.html.njk" },
        email: { template: "email.html.njk" },
    }
}

Templates

Templates are using Mozilla Nunjucks. You can register new Filters in the configuration file.

Use with email

IMAP

Taskwarrior can easily be used in combination with IMAP. I personally use this to create a Draft on the remote server, to be able to check it and send it later on. You can even make a cronjob out of it.

$ TMP=$(mktemp); task export | reportwarrior -f email > $TMP && curl --url "imaps://imap.gmail.com:993/%5BGmail%5D%2FDrafts" --user "[email protected]:password" -T $TMP && rm $TMP

In this example, please replace the URL, TaskWarrior filters, username and password appropriately. You can replace the encoded suffix [Gmail]Drafts with any you want. For a IMAP representation of labels:

$ curl --url "imaps://imap.gmail.com:993/" --user "[email protected]:password"

In Gmail, you can easily create new labels. Those are usable by IMAP clients such as cURL.

SMTP

Due to somewhat more complexity (we need to insert the sender and receiver and still maintain the template as is), we use a somewhat different oneliner for sending email using SMTP:

$ export TMP=$(mktemp); task export | reportwarrior -f email > $TMP && curl -kv --url "smtps://smtp.gmail.com:465/" --user "[email protected]:password" --mail-from "$(grep -P "^From:.*<(.*)>" $TMP | grep -o "<.*>" | sed -e 's/^.//' -e 's/.$//')" --mail-rcpt "$(grep -P "^To:.*<(.*)>" $TMP | grep -o "<.*>" | sed -e 's/^.//' -e 's/.$//')" -T $TMP

The chained grep and sed are responsible for optaining the From and To header from the generated output. I hope I will find an easier way to do this, but this works for now.

--mail-from "$(grep -P "^From:.*<(.*)>" $TMP | grep -o "<.*>" | sed -e 's/^.//' -e 's/.$//')"