-
Notifications
You must be signed in to change notification settings - Fork 295
[CLI] Add WordPress constants using CLI arguments #1811
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
Conversation
…op-level declarations
It confused me to see a type like: true | 'not-available' | 'origin-mismatch' All values are truthy so you have to know to compare directly with true. And at that point, it's clearer to use the string literal "available" instead.
Initially, we do this by writing one file at a time in Safari, but we can try doing Safari writes in batches in a subsequent commit.
If we don't do this, a quick error-retry scenario could run into cases where the second attempt conflicts with ongoing writes from the first attempt.
…li-constant-support
Would the same make sense for the Query API? |
Adding features to the query API always sounds like an improvement, but at the same time, is it needed? 🤔 Let's add it. The Query API is great for quick edits to your site and with all other APIs supporting it, let's not leave the query API behind. How would the format look? A few things that come to my mind:
|
This will also allow us to store database credentials in the URL. 🤣 |
Let's use the same format as in CLI, I'd like the CLI and the query API to eventually be handled by the same function. |
@adamziel I'm still not sure how to do that. This is how it looks like the CLI One option could be Or we could use only one argument and have a delimiter, but I'm worried that the delimiter could cause issues if it appears in the constant value. |
This could be similar to ENV variables:
This would be consistent with how you can specify multiple However, this gets a bit weird in the query API:
So maybe...
I'm having second thoughts here, though. PHP itself has no CLI option for defining constants, only .ini entries. There may be a good reason for that. When |
That sounds ok to me, we need to enable it and blueprints do the job. CLI and Query arguments should be available for the things that are modified frequently. Are constants something people frequently modify? |
I'd guess |
That one is true by default 🙂 I'm closing this PR as it seems like we don't need a dedicated |
@adamziel, even though we're not doing this, I'll offer some thoughts: Maybe if we reconsider this feature, we could make our best guess with |
Oh the suffix sounds nice. Thinking out loud, I wonder how much value would that add over a simple Blueprint. Once we can merge Blueprints that could be a more practical way vs having an option representing each step. Although CLI flags are natural when working with CLI programs |
👍 That seems like good thinking -- Leverage the more expansive capabilities in Blueprint rather than expanding the CLI flags. |
This PR returns support for login in the CLI using a `login` argument. The support was previously removed in #1811. ## Testing Instructions (or ideally a Blueprint) - Run `bun ./packages/playground/cli/src/cli.ts server --login` - Open Playground and see that you are logged in
Motivation for the change, related issues
I was testing #1789 and added support for defining constants to the CLI during development.
If feels like a useful feature, so I want to include it in the CLI.
Implementation details
A new
--constants
argument enables users to add WordPress constants to Playground.Testing Instructions (or ideally a Blueprint)
bun ./packages/playground/cli/src/cli.ts server --constants PLAYGROUND_FORCE_AUTO_LOGIN_ENABLED=true