andrewjmead / wpsites

A CLI for quickly spinning up WordPress sites
MIT License
17 stars 1 forks source link

Feature: templates.scripts to run commands with the newly created site #40

Open slaFFik opened 5 days ago

slaFFik commented 5 days ago

Similar to what composer.json : scripts allows us to do - execute a certain script.

So, when a site is created using this templates, for example:

[
    "name" => "Basic WordPress",
    "scripts" => [
        "wp post generate --count=10",
        "wp comment generate --count=20",
        "wp import /home/user/Projects/prefill.xml --authors=create",
    ]
],

the commands from an array in the scripts section will be executed, allowing to do something with the new WP install: hydrate the database from the SQL or wrx/xml file, configure settings, etc. Tons of possibilities.

I don't think this needs to be in the defaults section though, can't think of the use cases where it's needed globally for all templates.