1.0.0 • Published 6 years ago

yzb-cli v1.0.0

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

yzb-cli

yzb-cli 可以快速为我们生成模板项目

Q: 为什么要使用 yzb-cli

yzb-cli 提供了 webpack, fis3, gulp 三大构建工具的模板项目, 帮你省去删删减减的重复操作

yzb-cli 让我们的项目更具统一性, 规范性

yzb-cli 生成的模板会不断更新底层支持, 通用性支持

全局安装

sudo npm install -g git+http://git.yizhibo.com/web-utils/yzb-cli.git

安装完终端输入 yzb-cli

  Usage: yzb-cli <command>

  Options:

    -V, --version  output the version number
    -h, --help     output usage information

  Commands:

    add|a          Add a new template
    list|l         List all the templates
    init|i         Generate a new project
    delete|d       Delete a template
    push|p         Push code remote repositories

功能

  • init
  • list
  • add
  • delete
  • push

关键词解释

  • Template Name 模板名称, init , add, delete 都是通过它来进行操作
  • Owner/Name 仓库所有者/仓库名 init 时根据 Owner/Name 进行 url 拼接进行clone
  • Branch 模板分支 init 时,默认拉取 master 分支上代码
  • Developer 模板开发者 add 时,会有 Developer 选项, 此项为必填项, 便于模板追踪
  • Doc 模板文档 add 时,会有 Doc 选项, 此项为必填项, 便于使用者快速上手

Init

初始化一个项目, 目前考虑提供 webpack, fis3, gulp 三大构建工具的版本, 后期会随着项目的多样性,功能的健全性增加及更新模板

yzb-cli init
? Template name: webpack-vue
? Project name: demo
? Where to init the project: ./
⠋ Downloading template...utils/template-webpack-vue
⠸ Downloading template...New project has been initialized successfully!

List

查看有效的模板列表

yzb-cli list
┌───────────────┬────────────────────────────────┬────────┬───────────────────┬─────────────────────────────────────────────────────────────────────────────┐
│ Template Name │ Owner/Name                     │ Branch │ Developer         │ Doc                                                                         │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ webpack-vue   │ web-utils/template-webpack-vue │ master │ yzb-cli@yixia.com │ http://git.yizhibo.com/web-utils/template-webpack-vue/blob/master/README.md │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ fis           │ web-utils/template-fis         │ master │ yzb-cli@yixia.com │ http://git.yizhibo.com/web-utils/template-fis/blob/master/README.md         │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ gulp          │ web-utils/template-gulp        │ master │ yzb-cli@yixia.com │ http://git.yizhibo.com/web-utils/template-gulp/blob/master/README.md        │
└───────────────┴────────────────────────────────┴────────┴───────────────────┴─────────────────────────────────────────────────────────────────────────────┘

Add

添加模板

yzb-cli add
? Set the custom name of the template: test 
? Owner/name of the template: test
? Branch of the template: test
? Developer of the template: test
? Doc of the template: test
┌───────────────┬────────────────────────────────┬────────┬───────────────────┬─────────────────────────────────────────────────────────────────────────────┐
│ Template Name │ Owner/Name                     │ Branch │ Developer         │ Doc                                                                         │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ webpack-vue   │ web-utils/template-webpack-vue │ master │ yzb-cli@yixia.com │ http://git.yizhibo.com/web-utils/template-webpack-vue/blob/master/README.md │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ fis           │ web-utils/template-fis         │ master │ yzb-cli@yixia.com │ http://git.yizhibo.com/web-utils/template-fis/blob/master/README.md         │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ gulp          │ web-utils/template-gulp        │ master │ yzb-cli@yixia.com │ http://git.yizhibo.com/web-utils/template-gulp/blob/master/README.md        │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ test          │ test                           │ test   │ test              │ test                                                                        │
└───────────────┴────────────────────────────────┴────────┴───────────────────┴─────────────────────────────────────────────────────────────────────────────┘
✔ New template has been added successfully!

Delete

删除模板

yzb-cli delete

? Which template you want to delete: test
┌───────────────┬────────────────────────────────┬────────┬───────────────────┬─────────────────────────────────────────────────────────────────────────────┐
│ Template Name │ Owner/Name                     │ Branch │ Developer         │ Doc                                                                         │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ webpack-vue   │ web-utils/template-webpack-vue │ master │ yzb-cli@yixia.com │ http://git.yizhibo.com/web-utils/template-webpack-vue/blob/master/README.md │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ fis           │ web-utils/template-fis         │ master │ yzb-cli@yixia.com │ http://git.yizhibo.com/web-utils/template-fis/blob/master/README.md         │
├───────────────┼────────────────────────────────┼────────┼───────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ gulp          │ web-utils/template-gulp        │ master │ yzb-cli@yixia.com │ http://git.yizhibo.com/web-utils/template-gulp/blob/master/README.md        │
└───────────────┴────────────────────────────────┴────────┴───────────────────┴─────────────────────────────────────────────────────────────────────────────┘
✔ Template has been deleted successfully!

Push

自动打包推送代码至static 及 tpl 的远程分支

首次使用会询问static及tpl本地开发路径, 按提示完成即可,这里需要注意的是tpl的路径只需要tpl文件夹下的任意子目录都行,static需要在fis3运行的具体目录

yzb-cli push [commitmessage]  // commitmessage 为必填项 为每次的提交的基本概要

? Set your static/repo relative path: /Users/yixia/Documents/web/static_yizhibo_com/html/app/loginLive/h5_source
? Set your tpl/repo relative path: /Users/yixia/Documents/web/tpl_yizhibo_com
cd /Users/yixia/Documents/web/static_yizhibo_com/html/app/loginLive/h5_source
exec fis3 release test

 [INFO] Currently running fis3 (/Users/yixia/.nvm/versions/node/v8.0.0/lib/node_modules/fis3/)

 Ω ............................................................................................................................................................................................................................................................................................................................ 709ms