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

component-gen-cli

v1.0.2

Published

Generate framework components for React, Vue, Angular, Svelte, Solid, and Next.js

Downloads

394

Readme

component-gen-cli

npm version Node engines

CLI to scaffold starter components for React, Vue 3, Angular, Svelte, SolidJS, and Next.js. Use JavaScript or TypeScript via a single flag.

Binaries installed from this package:

| Command | Purpose | |---------|---------| | cg | Short default (shown in docs below) | | component-gen | Same CLI, longer name |


Requirements

  • Node.js ≥ 18

Install

Run once (no global install)

npx component-gen-cli@latest

Opens the built-in help and examples.

Globally

npm install -g component-gen-cli
cg --help

As a dev tool in another project

npm install --save-dev component-gen-cli
npx cg --help

Quick start

# React + TypeScript into ./src/components
npx component-gen-cli@latest generate ProductCard -f react --typescript --out ./src/components

# Same, short form
cg g ProductCard -f react --ts -o ./src/components

Run cg with no arguments to print the full help block (same examples as cg examples).


Supported frameworks

Use -f or --framework with exactly one value:

| Value | Typical output | |-------|----------------| | react | <Name>.jsx or <Name>.tsx | | vue | <Name>.vue (Vue 3 <script setup>) | | angular | <kebab>/<kebab>.component.ts plus .html and .css or .scss | | svelte | <Name>.svelte | | solid | <Name>.jsx / <Name>.tsx (JSX component) | | next | <Name>.jsx / <Name>.tsx (Next-compatible React; optional 'use client') |

Angular uses a standalone component and selector app-<kebab> (from your component name).


CLI reference

Discover commands

cg                           # Help + examples
cg frameworks                # List targets (aliases: cg fw, cg targets)
cg examples                  # Examples only (alias: cg guide)
cg generate --help           # All flags for generate (alias: cg g -h)
cg help generate
cg --version                 # Published version

generate / g

cg generate <ComponentName> -f <framework> [options]
cg g <ComponentName> -f <framework> [options]

<ComponentName> can be PascalCase (UserCard), kebab-case (user-card), or spaced words (user card). Names are normalized to PascalCase for file symbols and sensible paths.

| Option | Description | |--------|--------------| | -f, --framework <fw> | Required. react, vue, angular, svelte, solid, or next. | | -o, --out <dir> | Destination folder (default: current directory .). Parent folders are created as needed. | | --typescript, --ts | TypeScript dialect (.tsx, <script lang="ts">, etc.). Omit for plain JS where supported. Angular component class is always .ts; this flag aligns other TS-related choices where relevant. | | --scss | Angular only: use *.component.scss instead of .css. | | --client | Next.js only: insert 'use client' at top of file (client boundary). |


Examples by stack

cg g Avatar -f react --ts --out ./src/components
cg g Avatar -f react --out ./src/components

Creates Avatar.tsx or Avatar.jsx.

cg g SearchBar -f vue --ts --out ./components
cg g SearchBar -f vue --out ./components

Creates SearchBar.vue.

cg g MetricsTile -f angular --out ./src/app/widgets
cg g MetricsTile -f angular --scss --out ./src/app/widgets

Creates <kebab>/ containing *.component.ts, *.component.html, and *.component.css or *.scss.

cg g Toast -f svelte --ts --out ./lib

Creates Toast.svelte.

cg g Counter -f solid --ts --out ./src/ui

Creates Counter.tsx / Counter.jsx.

cg g Sidebar -f next --ts --out ./components
cg g Sidebar -f next --ts --client --out ./components

Creates Sidebar.tsx or Sidebar.jsx. Use --client when the scaffold uses hooks or browser-only APIs in the App Router.


Programmatic use (advanced)

Published entry is ESM src/index.js. You may import (after resolving from node_modules in your toolchain):

import { generateComponent, FRAMEWORKS } from "component-gen-cli";

Typical callers run the cg CLI instead.


How the npm readme is updated

The page at npmjs.com shows README.md from your package tarball. After you edit this file at the repo root:

  1. Bump version in package.json (required for each new publish unless you unpublished).
  2. Run npm publish --access public (add --otp <code> if npm asks).

Contributing & issues

Use your repository’s tracker for bugs and ideas. Pull requests improving templates or frameworks are welcome once you open a fork and keep changes focused.


License

MIT