Add site to Local manually/dynamically

I have created an Electron app which uses wp-cli to create a WordPress install which is tuned to my personal developing preferences when starting a new client project. It uses the npm wp-cli (wp-cli - npm) extensively. For example it creates pages, custom post types, gets my custom starter theme and installs plugins. This is great to hit the ground running on every new project.

I recently started using Local so I’d like to adapt my Electron app to have the site be added to Local automatically.

So the questions are:

  • Is this currently possible?
  • What would be the way (or workaround) to accomplish this?

Hey @Sjoerd - Welcome to the Local Community Forums!

So you created an Electron app to quickly create WordPress sites… Do you want to apply for a job on the Local team to make Local better? :smiley:

I don’t think there is a way to register a site with Local after the fact. I suppose one option would be to have your application scaffold things up, then create a zip export of the site, which contains a database dump and all of the files for the site. From there, you could drag and drop the site onto Local to import it.

One other possible idea would be do create your own Local Add-on that scaffolds out the site using the same logic that the custom Electron app does:

Thanks for the job offer Ben, but I’m having way too much fun freelancing at the moment. Maybe another time :grinning_face_with_smiling_eyes:

I thought of going the way of having my app create a zip-file to drag onto Local. However, to go that route I still have to start MAMP to have a database to fill. I’d like to change my workflow to Local so still having to use MAMP in the workflow is not ideal.

The add-on route was also my second choice, so when I have some extra time I’m going to explore if it’s feasable to port the code into an add-on.

@ben.turner And thanks for the welcome!

1 Like