Skip to content

MQpeng/cg

Repository files navigation

cg

a text tool that saves you time and helps your team build new files with consistency.

Install

  1. Download from release
  2. Install by npm
npm i -g @tonyer/cg
# other package manager
yarn add -g @tonyer/cg
pnpm add -g @tonyer/cg

Quick Start

  • Add template
cd examples
# add a template to user path
cg add base
# as new name
cg add base test
  • Use Template name
# use template to generate
cg g base --name Tom --age 12
cg g test --name Job --age 44
  • Use Template path
# use template to generate
cg g --template=examples/base --params="name=Tom&age=12"
cg g --template=examples/test --params="name=Tom&age=12"

Use git

  • Add template repo
# clone template repo
cg clone https://github.com/MQpeng/cg-templates
  • fetch template repo
# pull template repo
cg pull