The global command for cli is: cv
➜ cv -h
Usage: cv [options] [command]
Options:
-v, --version output the version number
-h, --help display help for command
Commands:
create|c create a project
install|i <pkgName> install a cv template
list|ls list all installed templates
uninstall|remove uninstall a cv template
info show information about a template
update-template|up update a template to the latest version
outdated check for outdated templates
search search for templates on npm
yo|y <projectName> create cv template
update update cv self
help [command] display help for commandInitialize a project and choose from different project templates. The default template will be downloaded and configured on first use:
- xxx template
If the desired template is not available, you can choose to install other templates.
✗ cv create
? Please select a template: (Use arrow keys)
xxx template
yyy template
❯ Don't have the template you want? Install a new template now?Install other templates, supporting both npm packages and git url packages.
The npm package for templates should have the prefix cv-generator-.
cv install cv-generator-pc-xxxIf the project corresponding to the git url is not a yeoman-generator package as specified by this project, it will be forcibly converted to a yeoman-generator package after downloading.
➜ cv install https://github.com/todrfu/xxx.git
# or specify the branch
➜ cv install https://github.com/todrfu/xxx.git#masterList all installed templates.
# List all templates
➜ cv list
# Output as JSON
➜ cv list --jsonUninstall a template.
# Uninstall a specific template
➜ cv uninstall generator-chrome-extension
# Interactive uninstall
➜ cv uninstall
# Uninstall all templates
➜ cv uninstall --allShow detailed information about a template.
# Show info for a specific template
➜ cv info generator-chrome-extension
# Interactive selection
➜ cv infoUpdate a template to the latest version.
# Update a specific template
➜ cv update-template generator-chrome-extension
# Update all templates
➜ cv update-template --allCheck which templates have updates available.
# Check for outdated templates
➜ cv outdated
# Output as JSON
➜ cv outdated --jsonSearch for templates on npm.
# Search for templates
➜ cv search react
# Show popular templates
➜ cv search --popular
# Output as JSON
➜ cv search react --jsonWhen you need to add template options, you can customize the project template using the cv yo xxx command to initialize a Yeoman project template. Fill in the content as needed.
➜ cv yo test-yoA folder named generator-test-yo will be created in the current directory, containing the code for creating project templates suitable for cv.
➜ cd generator-test-yo
➜ tree -L 1
.
├── README.md
├── index.js
├── package.json # The package name must have the prefix cv-generator-
├── questions.js # Yeoman script, can be adjusted as needed
└── template # Project template code should be placed in this directory