From ce2eea638f9a470e0486ee30fc259e7b0c602e38 Mon Sep 17 00:00:00 2001 From: buns Date: Mon, 11 Jan 2021 16:28:56 +0800 Subject: [PATCH] docs: update doc --- docs/plugin/define.md | 5 +++++ docs/usage/init.md | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/plugin/define.md b/docs/plugin/define.md index b6f162e..6e209ed 100644 --- a/docs/plugin/define.md +++ b/docs/plugin/define.md @@ -38,6 +38,9 @@ ## 编写插件 ```js + +import { CLIOptionHandlerParams PluginApi } from "@siujs/core"; + export default (api: PluginApi) => { api.create.cli((option: CLIOptionHandlerParams) => { option("-d, --deps ", "name of siblings package, e.g. `pkg1` or `pkg1,pkg2`"); @@ -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`的元数据信息 diff --git a/docs/usage/init.md b/docs/usage/init.md index da9673b..eb738b8 100644 --- a/docs/usage/init.md +++ b/docs/usage/init.md @@ -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`