Skip to content

Commit 2c55972

Browse files
authored
docs: improve custom plugin docs (#381)
1 parent 6778136 commit 2c55972

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

packages/cli/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
We provide comprehensive documentation on [how to create a custom plugin](./docs/custom-plugins.md).
140140
141141
The repository also maintains a set of plugin examples showcasing different scenarios.
142-
Each example is fully tested to give demonstrate best practices for plugin testing.
142+
Each example is fully tested to demonstrate best practices for plugin testing as well.
143143
144144
**Example for custom plugins:**
145145
@@ -170,7 +170,7 @@ Each example is fully tested to give demonstrate best practices for plugin testi
170170
| **`--onlyPlugins`** | `string[]` | `[]` | Only run the specified plugins. Applicable to all commands except `upload`. |
171171

172172
> [!NOTE]
173-
> All common options, expect `--onlyPlugins`, can be specified in the configuration file as well.
173+
> All common options, except `--onlyPlugins`, can be specified in the configuration file as well.
174174
> CLI arguments take precedence over configuration file options.
175175

176176
> [!NOTE]
@@ -184,7 +184,7 @@ Usage:
184184
`code-pushup collect [options]`
185185

186186
Description:
187-
The command initializes the necessary plugins, runs them, and then collects the results. After collecting the results, it generates a comprehensive report.
187+
The command initializes and executes the necessary plugins and collects the results. Based on the results it generates a comprehensive report.
188188

189189
Refer to the [Common Command Options](#common-command-options) for the list of available options.
190190

@@ -204,7 +204,7 @@ Usage:
204204
`code-pushup autorun [options]`
205205

206206
Description:
207-
Run plugins, collect results and upload report to the Code PushUp portal.
207+
Run plugins, collect results and upload the report to the Code PushUp portal.
208208

209209
Refer to the [Common Command Options](#common-command-options) for the list of available options.
210210

packages/cli/docs/custom-plugins.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Integrating a custom plugin in the CLI
22

3-
One of the main features of Code PushUp is the ability to write custom plugins and track your own metrics.
4-
It enables you to implement nearly any kind of metric you want to track progress with minimum effort.
3+
One of the main features of Code PushUp is the ability to track your own metrics by writing custom plugins.
4+
It enables you to implement any kind of metric you want to track progress with minimum effort.
55
In this section we will go through the steps needed to create a custom plugin and integrate it in your project.
66

77
## Set up the core config
88

9-
To start crafting custom plugins you need a minimum `code-pushup.config.(ts|js|mjs)` file maintaining a `plugins` property.
10-
All plugins are registered in a core configuration object and can take potential options to configure its behaviour.
11-
The following example shows where to register the plugin:
9+
All plugins are registered in a core configuration, also allowing for further configuration of the plugins behavior.
10+
Creating custom plugins requires you to create a `code-pushup.config.(ts|js|mjs)` file, that exposes a `plugins` property.
11+
See the following example:
1212

1313
```typescript
1414
// code-pushup.config.ts
@@ -35,7 +35,7 @@ The plugin configuration contains:
3535
- a [runner](#plugin-runner) that maintains the internal logic that produces the [plugin output](#plugin-output) as [`AuditOutputs`](@TODO - link models).
3636
- optional [`groups`](#audit-groups) to pre score audits
3737

38-
A minimal custom plugin containing the required fields looks like the following:
38+
See the following example that shows a minimal implementation of a custom plugin containing all required fields:
3939

4040
**template for a custom plugin**
4141

@@ -145,11 +145,10 @@ const pluginOutput: AuditOutputs = [myAuditOutput];
145145

146146
## Plugin runner
147147

148-
The core of a plugin is defined under the `runner` property.
149-
The `runner` property is the entry point of your plugin and is called by the CLI. It should return the audit results
150-
as [`AuditOutputs`](@TODO - link models).
148+
The `runner` property defines the core of a plugin.
149+
It also serves as the entry point of your plugin and is executed by the CLI. It should return the audit results as [`AuditOutputs`](@TODO - link models).
151150

152-
A plugins runner logic can get implemented in 2 ways:
151+
A runner can be implemented in two ways:
153152

154153
- as a [`RunnerFunction`](#runnerfunction)
155154
- as a [`RunnerConfig`](#runnerconfig)

0 commit comments

Comments
 (0)