Skip to main content

WriteFilesStep <DirectoryResource>

Writes multiple files to a specified directory in the Playground filesystem.

my-plugin/
├── index.php
└── public/
└── style.css
@hasRunnableExample
@landingPage

/test.php

@example
<code>
{
"step": "writeFiles",
"writeToPath": "/wordpress/wp-content/plugins/my-plugin",
"filesTree": {
"name": "my-plugin",
"files": {
"index.php": "<?php echo '<a>Hello World!</a>'; ?>",
"public": {
"style.css": "a { color: red; }"
}
}
}
}
</code>

Index

Properties

filesTree

filesTree: DirectoryResource

The ‘filesTree’ defines the directory structure, supporting ‘literal:directory’ or ‘git:directory’ types. The ‘name’ represents the root directory, while ‘files’ is an object where keys are file paths, and values contain either file content as a string or nested objects for subdirectories.

step

step: writeFiles

writeToPath

writeToPath: string

The path of the file to write to