docs: update contributor doc for command and add missing plugin info

This commit is contained in:
Alexandre Bodin 2024-01-10 10:39:37 +01:00
parent a2fc472261
commit e3a8922499
2 changed files with 8 additions and 8 deletions

View File

@ -7,7 +7,6 @@ tags:
The CLI is largely contained to the `@strapi/strapi` package, however some packages are able to inject their own commands:
- [`@strapi/admin`](/docs/core/admin/intro)
- [`@strapi/data-transfer`](/docs/core/data-transfer/intro)
## Structure of command
@ -15,16 +14,15 @@ The CLI is largely contained to the `@strapi/strapi` package, however some packa
The CLI is built with `commander` and as such every command we create can be described as:
```ts
import type { Command } from 'commander';
import { createCommand, Command } from 'commander';
type StrapiCommand = (params: { command: Command; argv: string[]; ctx: CLIContext }) => void;
type StrapiCommand = (params: { command: Command; argv: string[]; ctx: CLIContext }) => Command;
// usage
const myCommand: StrapiCommand = ({ command, argv, ctx }) => {
const myCommand: StrapiCommand = ({ argv, ctx }) => {
// do something
command
.command('develop')
return createCommand('develop')
.alias('dev')
.option(
'--no-build',

View File

@ -13,8 +13,10 @@ This is an experimental API that is subject to change at any moment, hence why i
## Available Commands
- [plugin:build](build) - Build a plugin for publishing
- [plugin:watch](watch) - Watch & compile a plugin in local development
- [plugin:init](./03-init.md) - Create a new plugin
- [plugin:build](./01-build.md) - Build a plugin for publishing
- [plugin:watch](./02-watch.md) - Watch & compile a plugin in local development
- [plugin:verify](./04-check.md) - Verify the build output of the plugin before publication
## Setting up your package