wp-now load .zip downloaded from wordpress-playground#137
wp-now load .zip downloaded from wordpress-playground#137rhildred wants to merge 8 commits intoWordPress:trunkfrom
Conversation
…e from a wp-content pull request
|
This now works with my wp-bundler wp-cli command. https://github.com/rhildred/wp-bundler. The idea is that I can add the wp-bundler plugin in wordpress playground and it will build on cloudflare pages or github pages with |
|
|
||
| php.mount(`${projectPath}/wp-content`, `${documentRoot}/wp-content`); | ||
|
|
||
| if (!fs.existsSync(`${projectPath}/wp-content/db.php`)) { |
There was a problem hiding this comment.
I see why you put that in here. Normally mountSqlitePlugin() takes care of that, but it also overrides the database file – and in your case the database file is already there. I'd love mountSqlitePlugin() to respect any pre-existing databases so that runWpContentMode() could work with both a "regular" WordPress and a Playground export. What do you think @sejas @danielbachhuber ?
|
This is a great use-case @rhildred, thank you for proposing this PR! It marks an important step in making Playground portable between the browser and a local dev environment ❤️ I left an inline note to see if we could make one of the existing modes support that use-case instead of creating a new mode. |
What?
Bring .zip from wordpress-playground into node.js with wp-now. I also exposed the existing wp-cli code on the command line with
@wp-now/wp-now wp --versionfor further testing.Why?
I am leading a class in wordpress this term. There is a lab each week, for which students hand in a .zip of their site. Wordpress-playground offers the ability for students to produce the .zip that I am looking for. To mark the lab, I have code that makes a folder for each student. I want to be able to start a terminal in vscode in the student folder, type
npx @wp-now/wp-now startand see the student's wordpress.I exposed the wp-cli interface in wp-now so that I can author a plugin that creates a static site from wordpress using ob_start. For instance:
How?
I added a mode that looks for a wp-content folder without a wp-include folder. From there it was fairly short work to get the mounts correct to use the folder.
Testing Instructions
npm run build
unzip ~/Downloads/wordpress-playground\ \(8\).zipor somethingnode ../dist/packages/wp-now/main.js startThanks so much for this package and your advice on using it with my students. My plan is to use wp-playground and the .zip download for my student's first wordpress class on Monday night.