Skip to content

Commit cc037da

Browse files
committed
feat: update docs for picgo-init
1 parent 04d63d9 commit cc037da

File tree

4 files changed

+92
-66
lines changed

4 files changed

+92
-66
lines changed

docs/dev-guide/cli.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -493,24 +493,28 @@ If you want to add more languages or set the current language, refer to the [pic
493493

494494
### Using the Plugin Template
495495

496-
To help developers bootstrap PicGo plugins quickly, the PicGo team provides a plugin template: [picgo-template-plugin](https://github.com/PicGo/picgo-template-plugin). Its usage is similar to `init` in [vue-cli](https://cli.vuejs.org/).
496+
To help developers bootstrap PicGo plugins quickly, PicGo provides a plugin template workflow. Its usage is similar to `init` in [vue-cli](https://cli.vuejs.org/).
497+
498+
Starting from PicGo-Core v1.7.0, the legacy `picgo init` command is no longer bundled. Use the standalone [`picgo-init`](https://github.com/PicGo/PicGo-Init) command instead.
497499

498500
To use the official plugin template:
499501

500502
```bash
501-
picgo init plugin <your-project-name>
503+
npx picgo-init plugin <your-project-name>
502504
```
503505

504506
If you've created a template once, you can use offline mode next time:
505507

506508
```bash
507-
picgo init plugin <your-project-name> --offline
509+
npx picgo-init plugin <your-project-name> --offline
508510
```
509511

510-
If you want to use your own template, use `user/repo` to download a specific GitHub repo as the template:
512+
Offline mode uses cached templates under `~/.picgo/templates`.
513+
514+
If you want to use your own template, use `username/repo` to download a specific GitHub repo as the template:
511515

512516
```bash
513-
picgo init user/repo <your-project-name>
517+
npx picgo-init username/repo <your-project-name>
514518
```
515519

516520
Then follow the prompts to create the project.

docs/guide/commands.md

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ $ picgo -h
2323
set|config <module> [name] configure config of picgo modules
2424
upload|u [input...] upload, go go go
2525
use [module] use modules of picgo
26-
init [options] <template> [project] create picgo plugin's development templates
2726
i18n [lang] change picgo language
2827
help [command] display help for command
2928
```
3029

30+
::: warning
31+
Starting from PicGo-Core v1.7.0, PicGo no longer bundles the legacy `picgo init` command.
32+
Use the standalone [`picgo-init`](https://github.com/PicGo/PicGo-Init) command instead (see `picgo-init` section below).
33+
:::
34+
3135
::: tip Tip
3236
Options wrapped in `<>` are required, and options wrapped in `[]` are optional.
3337
Some commands have aliases—for example, `picgo upload` can be shortened to `picgo u`.
@@ -173,33 +177,6 @@ picgo uninstall [name]
173177
picgo update [name]
174178
```
175179

176-
## init
177-
178-
> Download and generate a PicGo plugin development template.
179-
180-
```bash
181-
$ picgo init -h
182-
Usage: init [options] <template> [project]
183-
184-
Options:
185-
186-
--clone use git clone
187-
--offline use cached template
188-
-h, --help output usage information
189-
190-
Examples:
191-
192-
# create a new project with an official template
193-
$ picgo init plugin my-project
194-
195-
# create a new project straight from a github template
196-
$ picgo init username/repo my-project
197-
```
198-
199-
Similar to `vue-cli`’s `init`, PicGo provides an official template: [picgo-template-plugin](https://github.com/PicGo/picgo-template-plugin). When running `init`, you can use `plugin` as the template name. Internally, if the template is not in `username/repo` form, PicGo automatically prefixes it with `PicGo/picgo-template-`.
200-
201-
This command helps you bootstrap a PicGo plugin quickly. For details, see [Plugin Development](/dev-guide/cli).
202-
203180
## i18n
204181

205182
> Switch PicGo’s UI language. Supported languages:
@@ -233,3 +210,35 @@ PicGo loads plugins from the `node_modules` directory next to the config file.
233210
## -s, --silent
234211

235212
Add `-s` or `--silent` to any valid command to enter silent mode. PicGo will output nothing except error messages.
213+
214+
## picgo-init
215+
216+
> Download and generate a PicGo plugin development template.
217+
218+
Starting from PicGo-Core v1.7.0, this is provided by the standalone `picgo-init` command.
219+
See [`PicGo/PicGo-Init`](https://github.com/PicGo/PicGo-Init) for installation and usage.
220+
221+
```bash
222+
$ picgo-init -h
223+
224+
Usage: picgo-init <template> [project]
225+
226+
create picgo plugin's development templates
227+
228+
Options:
229+
--offline use cached template
230+
--debug debug mode
231+
-h, --help display help for command
232+
233+
Examples:
234+
235+
# create a new project with an official template
236+
$ picgo-init plugin my-project
237+
238+
# create a new project straight from a github template
239+
$ picgo-init username/repo my-project
240+
```
241+
242+
Similar to `vue-cli`’s `init`, PicGo provides official templates. When running `picgo-init`, you can use `plugin` as the template name. Internally, if the template is not in `username/repo` form, PicGo automatically prefixes it with `PicGo/picgo-template-`.
243+
244+
This command helps you bootstrap a PicGo plugin quickly. For details, see [Plugin Development](/dev-guide/cli).

docs/zh/dev-guide/cli.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -478,22 +478,26 @@ module.exports = (ctx) => {
478478

479479
### 使用插件模板
480480

481-
为了方便开发者快速开发picgo的插件,PicGo官方提供了插件模板:[picgo-template-plugin](https://github.com/PicGo/picgo-template-plugin),它的使用和[vue-cli](https://cli.vuejs.org/)`init`很类似。要使用官方的plugin模板你只需要:
481+
为了方便开发者快速开发 picgo 的插件,PicGo 提供了插件模板工作流,它的使用和[vue-cli](https://cli.vuejs.org/)`init`很类似。
482+
483+
从 PicGo-Core v1.7.0 开始,原来的 `picgo init` 命令不再内置,请使用独立的 [`picgo-init`](https://github.com/PicGo/PicGo-Init) 命令。
482484

483485
```bash
484-
picgo init plugin <your-project-name>
486+
npx picgo-init plugin <your-project-name>
485487
```
486488

487489
如果你已经创建过一次模板,下次可以使用离线模式:
488490

489491
```bash
490-
picgo init plugin <your-project-name> --offline
492+
npx picgo-init plugin <your-project-name> --offline
491493
```
492494

493-
如果你想要使用自己的模板,可以使用`user/repo`来下载指定的GitHub仓库的模板:
495+
离线模式会使用 `~/.picgo/templates` 下缓存的模板。
496+
497+
如果你想要使用自己的模板,可以使用 `username/repo` 来下载指定的 GitHub 仓库模板:
494498

495499
```bash
496-
picgo init user/repo <your-project-name>
500+
npx picgo-init username/repo <your-project-name>
497501
```
498502

499503
然后根据提示创建项目即可。官方插件模板里提供了`TypeScript``JavaScript`两种模板,开发者可以二选一。推荐使用`TypeScript`模板来得到更好的语法提示。

docs/zh/guide/commands.md

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ $ picgo -h
2323
set|config <module> [name] configure config of picgo modules
2424
upload|u [input...] upload, go go go
2525
use [module] use modules of picgo
26-
init [options] <template> [project] create picgo plugin's development templates
2726
i18n [lang] change picgo language
2827
help [command] display help for command
2928
```
3029

30+
::: warning
31+
从 PicGo-Core v1.7.0 开始,PicGo 不再内置原来的 `picgo init` 命令。
32+
请使用独立的 [`picgo-init`](https://github.com/PicGo/PicGo-Init) 命令(见下方 `picgo-init` 小节)。
33+
:::
34+
3135
::: tip 提示
3236
其中,命令选项如果是用`<>`包围起来的为必须输入项,如果是用`[]`包围起来的则为可选输入项。
3337
有些命令支持简写,比如`picgo upload`可以写为`picgo u`
@@ -173,33 +177,6 @@ picgo uninstall [name]
173177
picgo update [name]
174178
```
175179

176-
## init
177-
178-
> 该命令用于下载和生成picgo的插件开发模板
179-
180-
```bash
181-
$ picgo init -h
182-
Usage: init [options] <template> [project]
183-
184-
Options:
185-
186-
--clone use git clone
187-
--offline use cached template
188-
-h, --help output usage information
189-
190-
Examples:
191-
192-
# create a new project with an official template
193-
$ picgo init plugin my-project
194-
195-
# create a new project straight from a github template
196-
$ picgo init username/repo my-project
197-
```
198-
199-
类似于`vue-cli`的`init`命令,picgo也提供了官方的插件模板叫做[picgo-template-plugin](https://github.com/PicGo/picgo-template-plugin),不过你在`init`的时候,模板名只需要写`plugin`,内部会自动判断如果非`username/repo`形式的话,自动加上`PicGo/picgo-template-`的前缀。
200-
201-
这个命令用于方便用户快速开发一个picgo插件。关于插件开发,可以查看[插件开发](/zh/dev-guide/cli)一章。
202-
203180
## i18n
204181

205182
> 用于切换 picgo 的语言。目前支持的语言有:
@@ -233,3 +210,35 @@ picgo将会读取配置文件所在目录下`node_modules`的插件。
233210
## -s, --silent
234211

235212
在输入任何有效命令的情况下加入`-s`或者`--silent`将会进入静默模式,除了报错信息之外,picgo在命令行里将不会输出任何信息。
213+
214+
## picgo-init
215+
216+
> 该命令用于下载和生成 picgo 的插件开发模板
217+
218+
从 PicGo-Core v1.7.0 开始,该能力由独立的 `picgo-init` 命令提供。
219+
你可以在 [`PicGo/PicGo-Init`](https://github.com/PicGo/PicGo-Init) 找到安装与使用说明。
220+
221+
```bash
222+
$ picgo-init -h
223+
224+
Usage: picgo-init <template> [project]
225+
226+
create picgo plugin's development templates
227+
228+
Options:
229+
--offline use cached template
230+
--debug debug mode
231+
-h, --help display help for command
232+
233+
Examples:
234+
235+
# create a new project with an official template
236+
$ picgo-init plugin my-project
237+
238+
# create a new project straight from a github template
239+
$ picgo-init username/repo my-project
240+
```
241+
242+
类似于`vue-cli`的`init`命令,picgo 也提供了官方模板。你在执行 `picgo-init` 时,模板名只需要写 `plugin`,内部会自动判断如果非 `username/repo` 形式的话,自动加上 `PicGo/picgo-template-` 的前缀。
243+
244+
这个命令用于方便用户快速开发一个picgo插件。关于插件开发,可以查看[插件开发](/zh/dev-guide/cli)一章。

0 commit comments

Comments
 (0)