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 🙏

© 2025 – Pkg Stats / Ryan Hefner

templx

v0.0.3

Published

Lightweight CLI to render Handlebars templates with options derived from CLI flags.

Readme

templx

Lightweight CLI to render Handlebars templates with options derived from CLI flags.

Usage

npx templx format <template.hbs> [flags] [-]
  • Command: only format is supported.
  • Template: path to a Handlebars file.
  • Flags: become template options (see mapping below).
  • - (single hyphen) as a positional means: read JSON options from stdin.

Flags ➜ options mapping

  • Flags become keys on the options object by flag name, without dashes.
    • Parsing collects values as arrays, then a single value is coerced to a string.
    • --name Alice{ name: "Alice" }
    • --name=Alice is equivalent.
  • Repeating a flag accumulates values:
    • --color red --color blue{ color: ["red", "blue"] }
  • Pending option consumption: if a flag has no inline value, the next positional token becomes its value—even if it is -.
  • Option terminator -- stops parsing further tokens.

Notes:

  • Single-occurrence flags become strings; repeated flags remain arrays. Write templates normally, e.g. {{name}}.
  • Stdin JSON values are left as-is; only CLI flags are coerced.
  • Handlebars runs in strict mode: missing variables cause an error.

Stdin JSON (-)

Provide a single - positional to read a JSON object from stdin. The JSON object is intelligently merged with CLI flags. Stdin values are not coerced; only flags are.

# stdin only
echo '{"name":"Bob","colors":["green"]}' \
  | npx templx format template.hbs -

# stdin + flags merge
echo '{"name":"Bob","colors":["green"],"meta":{"a":1}}' \
  | npx templx format template.hbs - --name Carol --colors yellow --meta.b 2

Merge rules:

  • At most one - is accepted as a free positional.
  • If a flag is waiting for a value, - is consumed as that value (no stdin mode in that case).
  • Stdin must be a top-level JSON object.
  • Intelligent merge between stdin (left) and CLI (right):
    • Objects: deep-merged
    • Arrays: concatenated (stdin first, then CLI)
    • Mixed array/scalar: scalar promoted to array and concatenated
    • Scalars: CLI overrides stdin

Examples

Template (template.hbs):

Hello {{name}}!
Colors: {{#each colors}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}.

Run:

npx templx format template.hbs --name Alice --colors red --colors blue
# => Hello Alice!
# => Colors: red, blue.

With stdin merge:

echo '{"name":"Bob","colors":["green"],"meta":{"a":1}}' \
  | npx templx format hi.hbs - --name Carol --colors yellow --meta.b 2
# => Hello Carol!
# => Colors: green, yellow.