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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ggen

v0.1.5

Published

A directory structure generator

Readme

gGen NPM version Tests Coverage

A directory structure and file generator.

gGen allows you to easily create template directory structures and template files for your project.

You can generate any kind of files

  • Java classes, interfaces...
  • Golang files
  • React Components
  • Redux Reducers
  • Redux Sagas
  • index.js files based on directory content
  • CSS
  • HTML
  • And many more !

Install

# Local install
npm i -D ggen
# Global install
npm i -g ggen

# In each project directory
npm link ggen

Create default configuration:

# From your project directory
ggen init

Usage

After you've edited your configuration:

ggen <command> [opts]

<command> and [opts] depend on your config files, see below.

Examples

Look in the .ggen directory of this project to have more complete examples.

Configuration

By default, ggen looks for its configuration in .ggen/ in the current working directory. You can override this path with the GGEN_PATH environnement variable.

.ggen structure:

.ggen
├── templates/  -- Handlebars template files for file generation
└── config.js   -- Main configuration file

File generation uses Handlebars templates located at <GGEN_PATH>/templates.

Simple example

Let's say you want to automate the process of creating a nodejs module, using the following structure:

<module name>/
└── index.js

Where index.js exports a single function.

Template and config files

  • .ggen/templates/index.js.hbs

    module.exports = function {{ module_name }}() {
    
    }
  • .ggen/config.js

    const type = require('ggen')
    
    module.exports = {
      // adds the "module" command to the ggen cli
      module: {
        params: {
          // adds the --module_name option the ggen cli
          // adds a "module_name" variable to the template's context
          module_name: type.String() // function to parse the command line input
        },
        // will create a directory named after the "module_name" cli option,
        // containing an index.js file based on the index.js.hbs template
        tree: {
          "{{module_name}}": {
            "index.js": "index.js.hbs"
          }
        }
      }
    }

Generating an example module

To generate the example module, simply call:

ggen module --module_name example

It will create the following structure in your current working directory:

example/
└── index.js

example/index.js:

module.exports = function example() {

}

Parameter types

NOTICE If you have installed ggen globally, you will need to link it to your project to use included type parsers. npm link ggen

Start your config file with:

const type = require('ggen')
// type.String()
// type.Array()
// type.Map()
// ...

type.String(), type.Number(), type.Boolean()

Parses the input into either a String, Number, or Boolean types

type.Array(separator = ",")

Parses the input into an array of strings.

// config.js
const example = {
  tree: {
    // directory structure
  }
  params: {
    list: type.Array()
  }
}
# generation command
ggen example --list apple,banana,orange
// Resulting template context
{
  "list": [ "apple", "banana", "orange" ]
}

type.Map(entrySeparator = ",", keyValueSeparator ":")

Parses the input into an object.

// config.js
const example = {
  tree: {
    // directory structure
  }
  params: {
    properties: type.Map()
  }
}
# genaration command
ggen example --properties email:null,isOk:true
// Resulting template context
{
  "properties": {
    "email": "null",
    "isOk": "true"
  }
}