README.md 849 Bytes
Newer Older
silver47gin's avatar
silver47gin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
### 安装

- GitRepoURI 为项目的 git 代码仓库 URI

```bash
$ yarn global add ${GitRepoURI}
```

### 本地调试

```
$ yarn HelloWorld hello
```

### 开发

## 添加新命令

- 在 command 下添加新的 ts 文件,文件名和需要注册的命令名保持一致
- 命令需要默认导出函数 `(p:Command) => void`, 该函数在初始化时将被运行,可以在函数中注册命令
- Command 具体参数与使用,参考[commander](https://github.com/tj/commander.js)
- 基本代码如下:

```
import { Command } from "commander";

export default (program: Command) => {
  program
    .command("commandName")
    .description("命令描述")
    .action(async function () {
      // dosomething
    });
};

```

## 提交代码

- 重新构建代码

```
$ yarn build
```

- 打版本

```
$ yarn version
```

- 提交