-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wp-now: execute blueprint steps given a file path #82
Conversation
Hi @sejas. I'm getting an error trying start the server:
Removing |
@sergeymitr , thanks for trying this PR. I changed the testing instructions to cover the custom domain case. Not all the blueprints are supported at the moment. For example, install plugins/themes are failing. We will need to adapt those blueprint steps to work in Node.js. This is not limiting for merging this PR, though. |
…d/wp-now-blueprints
"step": "defineWpConfigConsts", | ||
"consts": { | ||
"WP_HOME": "http://127.0.0.1", | ||
"WP_SITEURL": "http://127.0.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 127.0.0.1
instead of myurl.wpnow
because the DNS tests would fail resolving that custom URL.
The default URL is localhost:8881
.
I checked that @sejas , and works as expected! Nice work! |
I merged this branch. It would be great to bump the playground dependencies such us |
@@ -1,6 +1,6 @@ | |||
import { runCli } from './run-cli'; | |||
|
|||
const requiredMajorVersion = 18; | |||
const requiredMajorVersion = 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, can we handle version bumps as a separate PR?
@@ -65,6 +66,92 @@ Of these, `wp-now php` currently supports the `--path=<path>` and `--php=<versio | |||
- The `~/.wp-now` home directory is used to store the WP versions and the `wp-content` folders for projects using 'theme', 'plugin', 'wp-content', and 'playground' modes. The path to `wp-content` directory for the 'plugin', 'theme', and 'wp-content' modes is `~/.wp-now/wp-content/${projectName}-${directoryHash}`. 'playground' mode shares the same `~/.wp-now/wp-content/playground` directory, regardless of where it's started. | |||
- For the database setup, `wp-now` is using [SQLite database integration plugin](https://wordpress.org/plugins/sqlite-database-integration/). The path to SQLite database is ` ~/.wp-now/wp-content/${projectName}-${directoryHash}/database/.ht.sqlite` | |||
|
|||
## Using Blueprints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for including docs! I cleaned up a couple of things with #85
Do we need to publish the packages now that this is merged? it doesn't seem like support is there in the version pulled from |
To close the loop on this: we met in Slack and published the new version. |
Is there any reason why only |
Never mind, I see this being mentioned in the PR description: #9 |
What?
It adds Blueprint support for wp-now.
Blueprint steps code relies heavily on Web functions and some of them will not work on Javascript for Node.js. We will need to find those steps and convert them into isomorphic javascript.
Why?
How?
After setting up WordPress and for all the modes except
index
we apply the blueprint steps before any PHP request, so before installing the theme/plugin and before auto-logging.If the steps
defineWpConfigConsts
ordefineSiteUrl
are passed in the blueprint steps, then we will use its value to change theabsoluteUrl
.Testing Instructions
127.0.0.1 myurl.wpnow
to your/etc/hosts
foo.json
.Blueprint example:
Check out more examples: https://wordpress.github.io/wordpress-playground/docs/blueprints-api/examples
nvm use
>npm install
. This PR requires Node v20+npx nx build wp-now
node dist/packages/wp-now/main.js start --blueprint=foo.json --port=80
blurpinrt steps: 1
andBlueprint step completed: defineWpConfigConsts
appear in the console outputhttp://myurl.wpnow
opens in your browser and WordPress still working as expected.Ngrok case
ngrok http 8881
.foo.json
file with the ngrok temporal URL.node dist/packages/wp-now/main.js start --blueprint=foo.json --port=80