playground-step-library
v1.2.1
Published
A compiler that transforms WordPress Playground blueprints with custom steps into blueprints with native steps
Maintainers
Readme
WordPress Playground Step Library
In this Github repository we collect custom blueprint steps for WordPress Playground.
Web UI
You can then use those custom steps in our Step Builder to create more complex WordPress Playground setups more easily.
NPM Package
You can also use the steps in your own projects by using the npm package.
📚 Documentation
Comprehensive documentation for all steps is available:
- 📖 Step Documentation - Complete documentation with examples
- 📋 Steps Reference - All steps in one page
- 🔍 Individual Steps - Detailed docs for each step
What does it mean?
You can tell WordPress Playground what to do before it loads using a Blueprint JSON file. There are a number of builtin steps provided that in combination can make it do powerful things.
Now, this tool collects custom steps that make it easier to specify more complex tasks. The steps get transformed into builtin steps to form a valid, final blueprint that can be executed by WordPress Playground.
How does it work?
In the Step Library UI you can select the steps you want to use by clicking or dragging. On each step you can modify the variables if any. You can also reorder the steps when necessary.
The final blueprint is immediately updated so that you can click the "Launch in Playground" to see if it achieves what you try to do.
Sharing & Import/Export
To make it easy to share what you are building, the URL of the page is updated with the blueprint. You can copy the URL and share it with others.
You can also share the Playground URL which contains the final blueprint.
Import blueprints:
- Drag & drop any
.jsonblueprint file to import it - Paste Playground URLs - Both hash format and Query API URLs
- Native Playground blueprints are automatically decompiled into custom steps
See Blueprint Import for details.
Screenshot
Try it now from scratch or with a preloaded example.
Contributing
We welcome contributions! See our Contributing Guide for details on:
- Setting up your development environment
- Creating new steps
- Testing your changes
- Submitting pull requests
Using as NPM Package
The npm package provides a compiler to transform WordPress Playground blueprints with custom steps into blueprints with native steps. It's available as an npm package.
npm install playground-step-libraryimport PlaygroundStepLibrary from 'playground-step-library';
const compiler = new PlaygroundStepLibrary();
// Compile to V1 format (imperative, with steps array)
const v1 = compiler.compile({
steps: [
{ step: 'setSiteName', sitename: 'My Site', tagline: 'A WordPress site' }
]
});
// Compile to V2 format (declarative, with schema properties)
const v2 = compiler.compileV2({
steps: [
{ step: 'setSiteName', sitename: 'My Site', tagline: 'A WordPress site' }
]
});
// Transpile native V1 blueprints to V2 (limited support - see docs)
const result = compiler.transpile(nativeV1Blueprint);See the Programmatic API Documentation for full details on CLI usage, methods, and examples.
Custom Steps
This library provides 62 total steps (8 built-in enhanced steps + 54 custom steps):
Built-in Enhanced Steps
defineWpConfigConst- Define a wp-config PHP constant.enableMultisite- Enable WordPress Multisite functionality.importWxr- Import a WXR from a URL.installPlugin- Install a plugin via WordPress.org or Github (branches, releases, PRs).installTheme- Install a theme via WordPress.org or Github.login- Login to the site.runPHP- Run code in the context of WordPress.setSiteOption- Set a site option.
Custom Steps
activatePlugin- Activate an already installed plugin.activateTheme- Activate an already installed theme.addClientRole- Adds a role for clients with additional capabilities than editors, but not quite admin.addFilter- Easily add a filtered value.addMedia- Add files to the media library.addPage- Add a page with title and content.addPost- Add a post with title, content, type, status, and date.addProduct- Add a WooCommerce product (will install WooCommerce if not present)addTemplate- Add a template (home, single, page, etc.) for a block theme.addTemplatePart- Add a template part (header, footer, etc.) for a block theme.blockExamples- Creates a post with all block examples from registered blocksblueprintExtractor- Generate a new blueprint after modifying the WordPress.blueprintRecorder- Record steps made and compile a new blueprint.changeAdminColorScheme- Useful to combine with a login step.cp- Copy a file or directory.createUser- Create a new user.customPostType- Register a custom post type.debug- Configure WordPress debug settings and optionally install Query Monitor plugin.deleteAllPosts- Delete all posts, pages, attachments, revisions and menu items.disableWelcomeGuides- Disable the welcome guides in the site editor.doAction- Execute a custom action.dontLogin- Prevent automatic login (Playground logs in as admin by default).enqueueCss- Enqueue custom CSS on frontend and/or admin.enqueueJs- Enqueue custom JavaScript on frontend and/or admin.fakeHttpResponse- Fake a wp_remote_request() response.generateProducts- Generate WooCommerce products and other data using the WC Smooth Generator plugin (automatically installs WooCommerce and the generator plugin)githubImportExportWxr- Provide useful additional info.githubPlugin- Install a plugin from a Github repository.githubPluginRelease- Install a specific plugin release from a Github repository.githubTheme- Install a theme from a Github repository.importFriendFeeds- Add subscriptions to the Friends plugin.importWordPressComExport- Import a WordPress.com export file (WXR in a ZIP)installAdminer- Install Adminer with auto login link.installPhEditor- Install phEditor. Password: admininstallPhpLiteAdmin- Provide phpLiteAdmin. Password: adminjetpackOfflineMode- Start Jetpack in Offline mode.mkdir- Create a directory.muPlugin- Add code for a plugin.mv- Move a file or directory.removeDashboardWidgets- Remove widgets from the wp-admin dashboard.renameDefaultCategory- Change the default "Uncategorized".rm- Remove a file.rmdir- Remove a directory.runSQL- Execute SQL queries.runWpCliCommand- Run a wp-cli command.sampleContent- Inserts sample pages to the site.setLandingPage- Set the landing page.setLanguage- Set the WordPress site language.setSiteName- Set the site name and tagline.setTT4Homepage- Set the homepage for the twentytwentyfour theme.showAdminNotice- Show an admin notice in the dashboard.skipWooCommerceWizard- When running WooCommerce, don't show the wizard.unzip- Extract a zip file.writeFile- Write content to a file.
