Skip to content

Commit 411c999

Browse files
NataliaTepluhinaAkryum
authored andcommitted
docs: move plugin naming (#3874)
* docs: move naming plugin section to the beginning of the guide * docs: added a link to npm * Update docs/dev-guide/plugin-dev.md Co-Authored-By: NataliaTepluhina <NataliaTepluhina@users.noreply.github.com> * docs: add a warning in plugin naming section
1 parent db374ec commit 411c999

File tree

1 file changed

+38
-35
lines changed

1 file changed

+38
-35
lines changed

docs/dev-guide/plugin-dev.md

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,44 @@ So, typical CLI plugin folder structure looks like the following:
3434
└── ui.js # Vue UI integration (optional)
3535
```
3636

37+
## Naming and discoverability
38+
39+
For a CLI plugin to be usable in a Vue CLI project, it must follow the name convention `vue-cli-plugin-<name>` or `@scope/vue-cli-plugin-<name>`. It allows your plugin to be:
40+
41+
- Discoverable by `@vue/cli-service`;
42+
- Discoverable by other developers via searching;
43+
- Installable via `vue add <name>` or `vue invoke <name>`.
44+
45+
:::warning Warning
46+
Make sure to name the plugin correctly, otherwise it will be impossible to install it via `vue add` command or find it with Vue UI plugins search!
47+
:::
48+
49+
For better discoverability when a user searches for your plugin, put keywords describing your plugin in the `description` field of the plugin `package.json` file.
50+
51+
Example:
52+
53+
```json
54+
{
55+
"name": "vue-cli-plugin-apollo",
56+
"version": "0.7.7",
57+
"description": "vue-cli plugin to add Apollo and GraphQL"
58+
}
59+
```
60+
61+
You should add the url to the plugin website or repository in the `homepage` or `repository` field so that a 'More info' button will be displayed in your plugin description:
62+
63+
```json
64+
{
65+
"repository": {
66+
"type": "git",
67+
"url": "git+https://github.com/Akryum/vue-cli-plugin-apollo.git"
68+
},
69+
"homepage": "https://github.com/Akryum/vue-cli-plugin-apollo#readme"
70+
}
71+
```
72+
73+
![Plugin search item](/plugin-search-item.png)
74+
3775
## Generator
3876

3977
A Generator part of the CLI plugin is usually needed when you want to extend your package with new dependencies, create new files in your project or edit existing ones.
@@ -766,41 +804,6 @@ You can put a `logo.png` file in the root directory of the folder that will be p
766804

767805
The logo should be a square non-transparent image (ideally 84x84).
768806

769-
### Discoverability
770-
771-
For a CLI plugin to be usable by other developers, it must be published on npm following the name convention `vue-cli-plugin-<name>` or `@scope/vue-cli-plugin-<name>`. Following the name convention allows your plugin to be:
772-
773-
- Discoverable by `@vue/cli-service`;
774-
- Discoverable by other developers via searching;
775-
- Installable via `vue add <name>` or `vue invoke <name>`.
776-
777-
For better discoverability when a user searches for your plugin, put keywords describing your plugin in the `description` field of the plugin `package.json` file.
778-
779-
Example:
780-
781-
```json
782-
{
783-
"name": "vue-cli-plugin-apollo",
784-
"version": "0.7.7",
785-
"description": "vue-cli plugin to add Apollo and GraphQL"
786-
}
787-
```
788-
789-
You should add the url to the plugin website or repository in the `homepage` or `repository` field so that a 'More info' button will be displayed in your plugin description:
790-
791-
```json
792-
{
793-
"repository": {
794-
"type": "git",
795-
"url": "git+https://github.com/Akryum/vue-cli-plugin-apollo.git"
796-
},
797-
"homepage": "https://github.com/Akryum/vue-cli-plugin-apollo#readme"
798-
}
799-
```
800-
801-
![Plugin search item](/plugin-search-item.png)
802-
803-
804807
## Publish Plugin to npm
805808

806809
To publish your plugin, you need to be registered an [npmjs.com](npmjs.com) and you should have `npm` installed globally. If it's your first npm module, please run

0 commit comments

Comments
 (0)