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

microgen

v1.1.4

Published

micro-generator for individual files, easy like sunday morning

Downloads

36

Readme

microgen NPM version Build Status Dependency Status

micro-generator for individual files, easy like sunday morning

Yet another generator; how's it different?

  • any file, anywhere on disk can be a template
    • no need to install templates (like heavy weight project generators)
  • easiest way to fill in templates, using simple handlebars placeholders
  • no data files required (like other handlebars cli's)
    • you'll be prompted to fill in the data at runtime

Installation

$ npm install microgen # --global

Usage

$ microgen --help

  Usage: microgen <template-file> [output-file]

  Options:

    -h, --help      show usage help
    -p, --pipe      pipe output to stdout, instead of writing to file

    output-file     if not specified, it will be $PWD/<template-file>
                    * if <template-file> has an ".hbs" extension,
                      it will be removed from the output-file name

How does it work?

A microgen template is any file that can have handlebars placeholders. Microgen will scan the template for placeholders and prompt you to fill in a value for each one.

Supported placeholders:

  • Variable {{some-value}}
  • Block {{#some-boolean}}something{{else}}something else{{/some-boolean}}
    • {{^}} is the same as {{else}}
    • You can use string literals, e.g. {{#"Are you happy"}}great{{/"Are you happy"}}
  • Comment {{!some string to display when prompting}}
    • {{!--x--}} is the same as {{!x}}
    • {{!}} just adds a newline to the display

For example, say you have a package.json template file:

{{!
== Let the Good Times Roll ==
}}
{
  "name": "{{name}}",
  "repository": "{{owner}}/{{name}}",
  "description": "{{description}}",
{{!}}{{#"Include Dependencies"}}
  "dependencies": {
{{#assert-dotenv}}
    "assert-dotenv": "3.0.0",{{/assert-dotenv}}{{!}}{{#"Use a CLI Helper [meow, inquirer, commander]"}}{{#meow}}
    "meow": "^3.0.0",{{else}}{{#inquirer}}
    "inquirer": "^1.0.2",{{^}}{{#commander}}
    "commander": "^2.9.0",{{/commander}}{{/inquirer}}{{/meow}}{{/"Use a CLI Helper [meow, inquirer, commander]"}}
  }
{{/"Include Dependencies"}}
}

Microgen will prompt you like so:



== Let the Good Times Roll ==

name: smile
owner: busterc
description: writes :) to stdout

Include Dependencies (Y/n): y
  assert-dotenv (Y/n): y
  
  Use a CLI Helper [meow, inquirer, commander] (Y/n): y
    meow (Y/n): n
      inquirer (Y/n): n
        commander (Y/n): y

...and the resulting output file will contain:

{
  "name": "smile",
  "repository": "busterc/smile",
  "description": "writes :) to stdout",

  "dependencies": {
    "assert-dotenv": "3.0.0",
    "commander": "^2.9.0",
  }
}

Respect

microgen was inspired by khaos

If you need heavy weight project scaffolding generators, then look into plop and yo

License

ISC © Buster Collings