Skip to content

Commit

Permalink
docs: update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
buns committed Jan 11, 2021
1 parent f557049 commit ce2eea6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions docs/plugin/define.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
## 编写插件

```js

import { CLIOptionHandlerParams PluginApi } from "@siujs/core";

export default (api: PluginApi) => {
api.create.cli((option: CLIOptionHandlerParams) => {
option("-d, --deps <deps>", "name of siblings package, e.g. `pkg1` or `pkg1,pkg2`");
Expand Down Expand Up @@ -128,6 +131,8 @@ export default (api: PluginApi) => {
- 获取: `const err = ctx.ex()`
- 设置: `ctx.ex(new Error('xxxx'))` or `ctx.ex('msg')`

Note: 只要在`start``process`周期中使用了异常记录,那么就认为当前命令处理流程发生了异常,会停止向下流转;

#### ctx.pkg

获取/设置当前正在调用插件的目标`package`的元数据信息
Expand Down
12 changes: 6 additions & 6 deletions docs/usage/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

##### 使用

- `siu init @foo/bar` : will download template files from `https://github.com/foo/bar`
- `siu init bar` : will download template files from `https://github.com/bar`
- `siu init foo#dev`: will download template files from `https://github.com/foo` and branch `dev`
- `siu init git@foo`: will download template files from `git@foo`
- `siu init https://xxx/foo`: will download template files from `https://xxx/foo`;
- `siu init foo --source=gitee`: will download template files from `https://gitee.com/foo`
- `siu init @foo/bar .` : will download template files from `https://github.com/foo/bar`
- `siu init bar .` : will download template files from `https://github.com/bar`
- `siu init foo#dev .`: will download template files from `https://github.com/foo` and branch `dev`
- `siu init git@foo .`: will download template files from `git@foo`
- `siu init https://xxx/foo .`: will download template files from `https://xxx/foo`;
- `siu init foo --source=gitee .`: will download template files from `https://gitee.com/foo`

0 comments on commit ce2eea6

Please sign in to comment.