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

theduke

v0.2.1

Published

(In development)

Downloads

22

Readme

Template

Naming convention

_duke/

  • Data and templates live here

MYC123 ABC-RAQ13232 My Job

  • MYC123 job.num (prefixed by client.code)
  • ABC super.client.code (optional)
  • RAQ1323 super.job.num (optional)
  • My Job Job name

inv-1.xls

  • inv is the template to use
  • 1 is the part (1,2,3 etc)

Entities

config

tax: gst: 0.1 (tax rate as percentage, required)

global

global

  • today

job

job num (pulled from job folder, 3 letter int prefixed by client.code, eg. MFC001) name: My Job (pulled from job dir) total: ex (subtotal ex GST) gst (GST component) inc (total inc GST)

super.job

Client's client's job

super.job num: (Can be any coding convention)

*inv

Invoice specific content

inv num: MYC001-1 part: 1 time_based: true / false auto_summary (Will attempt to summarise the job) data: (internal info about invoice data excel doc) total (optional) min ex (in cents, int) gst (in cents, int) inc (in cents, int) sections: (required array) section (Each invoice consists of one or more sections) title (optional) desc (optional) ex (in cents, int) gst (in cents, int) inc (in cents, int) subs (optional array) sub desc hrs (optional) cost (optional) ex (in cents, int) gst (in cents, int) inc (in cents, int)

client code: mfc (set by filename) company: fullname: My Full Company Name (optional) nickname: Company (optional) abn: 1234567890 (optional) contact: fullname: Barry White (one or the other required) nickname: Bazza (one or the other required) phone: 0412 123 123 (optional) address: line_1: 21 Jump Street line_2: Toowong, QLD 4000 terms: (optional, will override me.terms.rate) rate: 10 (hourly rate ex GST, optional, will override me.terms.rate)

super.client

Same as client, though indicates client's client,

super.client fullname: My Full Company Name (optional) nickname: Company (optional)

me

As client above though with additional fields

bank: name: My Bank Name account: My Bank Account Name bsb: 123-456 account_number: 12-123-123 terms: rate: 10 (hourly rate ex GST, required)

Logic

Optionals

If prop exists will return value, otherwise will return an empty string. %client.contact.nickname?

Optional chains

If first choice is set, will attempt 2nd, 3rd etc. Separated by ??. %client.contact.nickname??client.contact.fullname%

Logic props

%!inv.timebased% Bool only supported for now.

Ternary conditions

Eg. %inv.time_based?inv.total.mins(minsToHrs):inv.total.ex(currency)%

The conditional subject can be an expression, supporting option chains and filters.

Conditional blocks

%if inv.time_based%
Hrs: %inv.total.mins(minsToHrs)%
%else%
Cost: %inv.total.ex(currency)%
%/if%

Conditional optionals

If last char is ? then the result is a bool of whether expression is defined or undefined

%if nosuchprop?%
Prop doesn't exist
%else%
Prop exists
%/if%

Loops

%each inv.arrays as item%

Arry item value is %item%

%/each%
%each inv.arrays as index,item%

Item[%index%] = %item%

%/each%
%each inv.obj as propValue%

- %propValue%

%/each%
%each inv.obj as propName,propValue%

Obj.%propName% is %propValue%

%/each%

Literals

  • Strings, eg 'foo', NOTE: Double quotes not supported.
  • Numbers and numeric expressions, eg -1232132, 123213.2323, 100, 123/4*3` (Brackets not supported);
  • Bools, eg true, false

Eg. %inv.time_based?'YAY':'NAY'%

Relational operators

Supported operators ==,!=,>,>=,<``<=

Filters

Appear as brackets after template entity. Note: camel case

Eg %me.contact.fullname(slugify,nbsp)??global.today(display)%

str

slugify

  • Lowercase, replace spacing with hyphens.

hyphenate

  • Replace spaces with hyphens, leave case as is.

nbsp

  • Replace spaces with &nbsp; HTML

phoneAuHref

  • Eg. 0412 123 123 to +6412123123

int

currency

  • Covert cents to dollars (x100), round to 2 decimal places, add thousand commas. Note: no dollar sign will be added

$currency

  • Same as currency though will add a dollar sign

minsToHrs

  • For display, convert mins int to hours float with 2 decimal places, including hrs suffix.

date

display

  • Eg. 01.12.2017

filename

  • Eg. 2017-12-01

HTML tips

Use below to control page breaks:

page-break-inside: avoid !important;

Add a new section with the title (col #1) as simply --- to insert a linebreak.

Version History

  • 0.2.1 Add PO column above summary for it to be added to invoice header
  • 0.2.0 Will reject jobs with placeholder number 999
  • 0.1.8 Updated page break (---) to ignore line breaks.
  • 0.1.7 Page break code added (---), line break code added (\n)
  • 0.1.5 Direct PDF publishing
  • 0.1.4 Fixed hrs filter, excel doc defines template, multi-line description support added
  • 0.1.3 Added node env
  • 0.1.2 Added README