-
Notifications
You must be signed in to change notification settings - Fork 368
[Docs] Updating run cli demos #2833
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
base: trunk
Are you sure you want to change the base?
Conversation
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
adamziel
left a comment
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.
Really cool, thank you! I've left a few comments, nothing major.
…playground-cli.md Co-authored-by: Adam Zieliński <adam@adamziel.com>
…playground-cli.md Co-authored-by: Adam Zieliński <adam@adamziel.com>
…playground-cli.md Co-authored-by: Adam Zieliński <adam@adamziel.com>
…playground-cli.md Co-authored-by: Adam Zieliński <adam@adamziel.com>
|
@adamziel I have removed the blueprints v2 examples temporarily and added the suggested changes |
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
| ### Mounting before WordPress installation | ||
|
|
||
| Consider mounting your WordPress project files before the WordPress installation begins. This approach is beneficial if you want to override the Playground boot process, as it can help connect Playground with `WP-CLI`. The `--mount-before-install` flag supports this process. | ||
| Consider mounting your WordPress project files before the WordPress installation begins. This approach is beneficial if you want to override the Playground boot process, as it can help connect Playground with `WP-CLI`. The `--mount-dir-before-install` flag supports this process. |
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.
Hm this paragraph reads weird. Are we selling the user on mounting project files? It's also unclear why we'd want to skip the boot process (which we're not skipping, Playground still boots and will try to install WordPress) and how exactly does it help connect Playground with WP-CLI. Let's take this opportunity to clarify it and, e.g.:
When you have a local WordPress site, you can run it in Playground CLI as well. Here's one way to do it:
npx @wp-playground/cli@latest server \ --mount-dir-before-install ./wordpress-path-on-host /wordpress/ \ --wordpress-install-mode=do-not-attempt-installingTo unpack it, that command mounted the entire WordPress site you already had on your disk using the
--mount-dir-before-installflag. That mount happened before Playground had a chance to download another WordPress version and unzip it in/wordpress. Then, we've told Playground CLI to skip running the WordPress installer. That site was already installed, so why would we?With this workflow, you can store your WordPress site directly in the filesystem, retain it across multiple Playground CLI executions, and use the usual WordPress tools with it, e.g. WP-CLI.
You can also use the
--mount-dir-before-installflag to populate a local directory with a newly created WordPress site:npx @wp-playground/cli@latest server \ --mount-dir-before-install ./wordpress-path-on-host /wordpress/Since we did not skip the installer, Playground CLI runs the site setup as usual, only this time the
/wordpressdirectory is connected to your local directory. At the end of the command, the new site files are stored in./wordpress-path-on-hostin your local filesystem! To run that site again, use the--wordpress-install-modeflag discussed above.
| ``` | ||
|
|
||
| :::caution | ||
| Using `--follow-symlinks` can expose files outside mounted directories to Playground and could be a security risk. Only use this flag when you trust the symlink targets. |
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.
This sounds scary! Let's explain what kind of security risks are we facing here – it's not that bad if you trust the site.
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.
Can symlink points to sensitive files elsewhere on your system (like /etc/passwd or ~/.ssh/), those files could become accessible to the WordPress site running in Playground and expose to malicious code?
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.
Yeah, that's exactly the risk. If you're running an untrusted Blueprint, that's a problem. But if you're just working on a local site and you trust the code, it's not a big deal. I'd just say that part out loud in the doc
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Outdated
Show resolved
Hide resolved
packages/docs/site/docs/developers/05-local-development/04-wp-playground-cli.md
Show resolved
Hide resolved
| } | ||
| ``` | ||
|
|
||
| ### Following symlinks programmatically |
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.
The reader probably got the idea by now and understands they can just pass the same flags in a shell command and the runCLI() function. What do you think about skipping a few of these option-specific examples? They inflate the document and IMHO don't add that much value. If something can be explained with more words or less words, less words is always more convenient – it's less work for the user.
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.
Can those code snippets be a post on the blog? I think we need to have a space for more code examples.
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.
Another alternative will be create a dedicated page for runCLI
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.
Blog post sounds good 👍 Or maybe a sub-page just for these examples? So just like you've proposed.
…playground-cli.md Co-authored-by: Adam Zieliński <adam@adamziel.com>
…playground-cli.md Co-authored-by: Adam Zieliński <adam@adamziel.com>
…playground-cli.md Co-authored-by: Adam Zieliński <adam@adamziel.com>
Motivation for the change, related issues
Updating the
runCLIdemos to show other ways of working with the method, applying for tests. Including more examples of the new flags. The change also included a description to improve the page SEO and apply some recommendations of the WordPress Docs handbook.New demos:
Portuguese and Spanish versions are also included.