@chaosxu/cli
chaos-fe cli
Last updated 6 months ago by chaosxu .
ISC · Original npm · Tarball · package.json
$ cnpm install @chaosxu/cli 
SYNC missed versions from official npm registry.

cli

脚手架练习

实现功能

init

初始化一些配置

chaos init [options]

Options:
  --project-path [projectPath]  project path
  -h, --help                    output usage information

create

可以根据自定义的模板生成包代码

chaos create <packageName> [options]

Options:
  --package-name [packageName]  package name
  --config-path [configPath]    config path
  --src [src]                   template dir
  --dest [dest]                 target package dir
  -h, --help                    output usage information

chaos-cli.json

{
  "src": "template",
  "dest": "packages",
  "commands": [{
    "command": "lerna link"
  }, {
    "command": "lerna bootstrap"
  }],
  "questions": [{
    "name": "packageName",
    "message": "package name"
  }, {
    "name": "description",
    "message": "description"
  }, {
    "name": "author",
    "message": "author"
  }]
}
  • src

    模板路径(相对命令行的当前目录)

  • dest

    输出目录(相对命令行的当前目录)

  • copyOptions

    copy规则:fs-extra.CopyOptions 详细的见文档

  • questions

    交互命令配置,遵循inquirer.prompt的配置,目前仅仅实现了所有非函数的配置。

    不同的是type扩展了multiple类型,支持输入多个值,输出的是一个数组,输入空(不输入直接按回车键)退出输入。

模板

模板后缀名统一为mustache,他会通过mustache编译,注入questions里面的answers

相关文档

Current Tags

  • 0.0.19                                ...           latest (6 months ago)

11 Versions

  • 0.0.19                                ...           6 months ago
  • 0.0.18                                ...           6 months ago
  • 0.0.17                                ...           6 months ago
  • 0.0.16                                ...           6 months ago
  • 0.0.15                                ...           6 months ago
  • 0.0.14                                ...           6 months ago
  • 0.0.13                                ...           6 months ago
  • 0.0.12                                ...           6 months ago
  • 0.0.11                                ...           6 months ago
  • 0.0.10                                ...           6 months ago
  • 0.0.9                                ...           6 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 11
Last Day 0
Last Week 11
Last Month 1
Dependencies (11)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |