Skip to content

Commit be50243

Browse files
authored
Add GitDirectoryReference resource documentation (#2492)
This commit introduces documentation for the new `GitDirectoryReference` resource, which allows referencing directories within Git repositories. It includes a type definition, an example usage, and notes on auto-detection of common providers and compatibility with installation steps. This addition enhances the clarity and usability of the documentation for developers working with plugins and themes in subdirectories.
1 parent 6d5dbca commit be50243

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

packages/docs/site/docs/blueprints/04-resources.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,42 @@ With a `"resource": "url"` we can define the location of a `.zip` containing the
4848
The Playground project provides a [GitHub Proxy](https://playground.wordpress.net/proxy) that allows you to generate a `.zip` from a repository (or even a folder inside a repo) containing your plugin or theme. This tool is very useful for avoiding CORS issues, among others.
4949
:::
5050

51+
### GitDirectoryReference
52+
53+
The `GitDirectoryReference` resource is used to reference a directory inside a Git repository. This is useful when a plugin or theme lives in a subfolder of a repo, or when you want to install from a specific branch, tag, or commit.
54+
55+
```typescript
56+
type GitDirectoryReference = {
57+
resource: 'git:directory';
58+
url: string; // Repository URL (https://, ssh git@..., etc.)
59+
path?: string; // Optional subdirectory inside the repository
60+
ref?: string; // Optional branch, tag, or commit SHA
61+
};
62+
```
63+
64+
**Example:**
65+
66+
```json
67+
{
68+
"step": "installPlugin",
69+
"pluginData": {
70+
"resource": "git:directory",
71+
"url": "https://github.com/WordPress/block-development-examples",
72+
"ref": "HEAD",
73+
"path": "plugins/data-basics-59c8f8"
74+
},
75+
"options": {
76+
"activate": true
77+
}
78+
}
79+
```
80+
81+
**Notes:**
82+
83+
- Playground automatically detects providers like GitHub and GitLab.
84+
- It handles CORS-proxied fetches and sparse checkouts, so you can use URLs that point to specific subdirectories or branches.
85+
- This resource can be used with steps like [`installPlugin`](/blueprints/steps#InstallPluginStep) and [`installTheme`](/blueprints/steps#InstallThemeStep).
86+
5187
### CoreThemeReference
5288

5389
The _CoreThemeReference_ resource is used to reference WordPress core themes. The _CoreThemeReference_ resource is defined as follows:

0 commit comments

Comments
 (0)