Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for shorthand alternatives of Blueprint steps #1261

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions packages/docs/site/docs/09-blueprints-api/05-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,132 @@ import BlueprintExample from '@site/src/components/Blueprints/BlueprintExample.m

Each step is an object that contains a `step` property that specifies the type of step to run. The rest of the properties depend on the type of step. Learn and try each step type below.

## Shorthands

You can specify some `steps` using a `shorthand` syntax. The following `steps` are currently supported:

### `login`

Use

```json
"login": true,
```

Or

```json
{
"step": "login",
"username": "admin",
"password": "password"
}
```

### `plugins`

(replaces the `installPlugin` step)

Use

```json
"plugins": [
"hello-dolly",
"https://raw.githubusercontent.com/adamziel/blueprints/trunk/docs/assets/hello-from-the-dashboard.zip"
]
```

Or

```json
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "hello-dolly"
}
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "url",
"url": "https://raw.githubusercontent.com/adamziel/blueprints/trunk/docs/assets/hello-from-the-dashboard.zip"
}
}
```

### `siteOptions`

Use

```json
"siteOptions": {
"blogname": "My first Blueprint"
}
```

Or

```json
"step": "setSiteOptions",
"options": {
"blogname": "My first Blueprint"
}
```

### `defineWpConfigConsts`

(`constants` only)

Use

```json
{
"step": "defineWpConfigConsts",
"consts": {
"WP_DISABLE_FATAL_ERROR_HANDLER": true,
"WP_DEBUG": true,
"WP_DEBUG_DISPLAY": true
}
}
```

Or

```json
{
"step": "defineWpConfigConsts",
"consts": {
"WP_DISABLE_FATAL_ERROR_HANDLER": true
}
},
{
"step": "defineWpConfigConsts",
"consts": {
"WP_DEBUG": true
}
},
{
"step": "defineWpConfigConsts",
"consts": {
"WP_DEBUG_DISPLAY": true
}
}
```

---

The `shorthand` syntax and the `step` syntax correspond to each other. Every `step` specified with the `shorthand` syntax is added to the top of the `steps` array in arbitrary order.

:::info **Which should you choose?**

- Use `shorthands` when **brevity** is your main concern.
- Use explicit `steps` when you need more control over the **execution order**.

:::

---

import BlueprintStep from '@site/src/components/BlueprintsAPI/BlueprintStep';
import { BlueprintSteps } from '@site/src/components/BlueprintsAPI/model';
import UpdateTopLevelToc from '@site/src/components/UpdateTopLevelToc';
Expand Down
Loading