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

codegen-cli

v1.0.1

Published

A code generator cli tool for front end developers, without configuring Java environments.

Readme

codegen-cli

A CLI code generator specially for frontend developers to generate repeatly codes from database.

Why this

Long time ago, we had a Java code generator that can read database table information and generate .java files (like JavaBean, Controller, Service, etc) and .js/.html files (using jQuery and EasyUI) for a basic CURD page.

Nowadays, we don't use jQuery or EasyUI any longer. But we still working on some MIS systems which also needs many many CURD pages. Though we are using Angular and NG-ZORRO-ANTD, code generator is still useful.

Instead of configuring Java environments(jdk, gradle, maven, etc...), I prefer using some cli-tool like vue-cli, angular-cli that frontend developers are familiar with.

Install

npm i -g codegen-cli

Usage

cg <templates-repo> --host localhost --user root --password root --schema db --table table

template-repo

The template repository name in Github, given by user/repo format

--host

Database host address

--user

Database login user

--password

Database login password

--schema

Database schema

--table

Database table name

--db

Tell the cli the templates needs database information, and there is a interact interface for you to input database config needed

--component-name

The component name, currently only supports bar-seperated format, like a-b-ccc

Example:

Give everything in command

cg ryancui-/zorro-mis-tpl --host localhost --user root --password qwerty --schema mydb --table t_user --component-name user-page

Use interact input

$ cg ryancui-/zorro-mis-tpl --db
? Input database <host>: 
? Input database <user>: 
? Input database <password>: 
? Input database <schema>: 
? Input database <table>: 
? Input component name: 

Write your own template

codegen-cli use art-template to render files. In order to let you write your own template, I seperate database model and view template, so you just need to know the data format given to template, then you can easily build your templates.

Data structures

An array of the database table columns information would be sent to template. In art-template, you can use $data to retrieve them.

{
  "component": "order-detail",
  "columns": [{
    "column": "product_price",
    "comment": "The product price",
    "type": "number",
    "allowNull": false
  }, {
    "column": "description",
    "comment": "Description",
    "type": "string",
    "allowNull": true
  }]
}

type is not the database(MySQL) data types, but JavaScript types, which includes number/string/date

TODO

A lot of features are still under developing...

  • [x] Seperate template from cli tool into a different repo
  • [ ] Support other template engine(like ejs...)
  • [x] Camel-case tranforming
  • [ ] Allow database table prefix
  • [x] Allow variables in filename
  • [x] Generation process info in terminal