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

jengen

v0.0.10

Published

Simple scaffolding cli tool

Downloads

40

Readme

👸 Jengen

install size npm dependents npm version

A Simple Scaffolding CLI tool

Whats Jengen?

Jen-gen is a simple scaffolding tool with minimal configuration. The goal is to provide a scaffolding solution that works for every web developer's workflow without requiring any code writing on the developer's end.

Sidenote: This is a template based solution and the templates are to be provided by the dev using Jengen. It's super duper likely that the templates will be some sort of code. You could argue that devs providing template is violating the goal but in this case templates are not code but configuration.

Usage

Install jengen

thor@marvel avgs-lp % npm i -g jengen

Create your config file

Create a jen.config.json file at the root level of your application. Here's an example of the config file

{
  // Modules are what gets generated
  "modules": {
    // Component here is the module name
    "Component": {
      // Source of the template, can be a file or a directory
      "source": ".jen/Component",
      // Destination of your module, where the file or the directory will be generated to
      "destination": "./src/Components"
    },
    // Model is a module name
    "Model": {
      // Source of the template, can be a file or a directory
      "source": ".jen/Model.js",
      // Destination of your module, where the file or the directory will be generated to
      "destination": "./src/Models",
      // filename is required if source is a file
      "filename": "__name__.js"
    }
  }
}

You'll notice something weird in the config file, __name__.js, this is a placeholder. Any string wrapped by __(double underscore) will be treated as a placeholder and the value will be replaced by arguments passed to jen gen. More on this in the next step.

Gen your modules

To gen your module, you need to tell jen

  • which module to gen
  • placeholder values

Here's an example,

thor@marvel avgs-lp % jen gen --module Model --name User

Based on the config above, jen will generate a new User.js file in ./src/Models directory. If the contents of the template file have any of the placeholders, they'll be replaced by the values passed.

If the keyword gen throws you off, you could use any one these aliases,

  • generate
  • make
  • clone

Example:

thor@marvel avgs-lp % jen clone --module Model --name User

You can also ditch specifying module using the args syntax and just specify your module name after gen command.

Example:

thor@marvel avgs-lp % jen gen Model --name User

or using one of the aliases

thor@marvel avgs-lp % jen clone Model --name User

Conversion Image I spent some time on

Example for a directory based module

In a directory based module, jen will duplicate files and the directory structure.

  • Files with placeholder name will have their names replaced,
  • Placeholders in file content will be replaced.

For the config below

{
  // Modules are what gets generated
  "modules": {
    // Component here is the module name
    "Component": {
      // Source of the template, can be a file or a directory
      "source": ".jen/Component",
      // Destination of your module, where the file or the directory will be generated to
      "destination": "./src/Components"
    },
}

and the following source directory structure (.jen/Component)

├── .jen
│   ├── Component
│   │   ├── __name__
│   │   │   ├── index.js
│   │   │   ├── __name__.js
│   │   │   ├── __name__.module.js

on running jen gen Component --name Button

will generate the following directory structure in the destination directory (./src/Components)

├── src
│   ├── Components
│   │   ├── Button
│   │   │   ├── index.js
│   │   │   ├── Button.js
│   │   │   ├── Button.module.js

Why name this Jengen?

Because generator, scaffold, gen already exist on npm.

I had an idea to call this package Doraemon, the cartoon character. If you are not familiar with Doraemon, Doraemon is an alien who befriended a kid and helps the kid woo his crush and beat his bully by pulling out revolutionary items from it's magic pouch.

I had this whole idea of cli command being do pull Component ... but then I fell asleep and had totally forgotten about it. I just remembered this whole thing while writing this section of the doc.

Plus just checked, doraemon is taken.