1.0.3 • Published 3 years ago

diandian-cli v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

diandian-cli

一键生成点点前端项目的脚手架工具

发布

npm run release

安装

npm install diandian-cli -g

使用

打开终端输入 ddcli 或者 ddcli -h,你会看到如下输出

Usage: ddcli <commander>

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

Commands:
add|a          添加一个模版
list|l         模版列表
init|i         生成项目文件
delete|d       删除一个模版

命令说明

add | a

添加自定义模版到templates.json中(git中存在的仓库)

$ ddcli add
? 设置你的模版名称: dd-nuxt
? Git仓库位置:仓库地址(私有的需要加上direct:)  例:direct:git@git.***.com:***/dd-nuxt-template.git
? 所属分支:(默认master) master
┌──────────────────┬───────────────────────────────────────┬────────┐
│ Template Name    │ Owner/Name                             │ Branch │
├──────────────────┼───────────────────────────────────────┼────────┤
│ dd-nuxt          │ direct:git@git.***.com:***/nuxt-template.git │ master │
├──────────────────┼───────────────────────────────────────┼────────┤
│ dd-nuxt-i18n     │ direct:git@git.***.com:***/nuxt-template.git │ i18n │
└──────────────────┴───────────────────────────────────────┴────────┘
✔ 新的模版已经添加成功!

list | l

查看dd-cli中已经设置的模版列表

$ ddcli list
┌──────────────────┬───────────────────────────────────────┬────────┐
│ Template Name    │ Owner/Name                             │ Branch │
├──────────────────┼───────────────────────────────────────┼────────┤
│ dd-nuxt          │ direct:git@git.***.com:***/nuxt-template.git │ master │
├──────────────────┼───────────────────────────────────────┼────────┤
│ dd-nuxt-i18n     │ direct:git@git.***.com:***/nuxt-template.git │ i18n │
└──────────────────┴───────────────────────────────────────┴────────┘

init | i

当已经添加模版后,可以使用指定模版,去初始化一个你自己的项目

$ ddcli init
? 你要使用的模版名称:(默认:dd-nuxt) dd-nuxt
? 你的项目名称: nuxt_project
? 你的项目介绍: nuxt_project的介绍
? 作者: Leo_chen
? 项目存放的目录:(默认当前目录) ./
⠸ 模版下载中,请稍等...新的项目已经初始化成功!
 新的项目已经初始化成功!

这样一个新的项目就生成成功了,是不是很方便

delete | d

删除一个模版

$ ddcli delete
你要删除模版的名称: dd-nuxt
┌──────────────────┬───────────────────────────────────────┬────────┐
│ Template Name    │ Owner/Name                            │ Branch │
├──────────────────┼───────────────────────────────────────┼────────┤
│ dd-nuxt          │ direct:git@git.***.com:***/nuxt-template.git │ master │
└──────────────────┴───────────────────────────────────────┴────────┘
✔ 模版已成功删除!

这样一个新的项目就生成成功了