-
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: Add wp-cli integration #212
base: trunk
Are you sure you want to change the base?
Conversation
I tested other commands, and on the first one I got an unhandled exception:
Not sure if I needed to pass another argument to make it work, however, for sure the unhandled exception should not be happening. Correct? |
}, | ||
async () => { | ||
// 0: node, 1: wp-now, 2: wp, 3: [wp-cli options...] | ||
const args = process.argv.slice(3); |
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.
Suggestion: Can we replace the 3 with something that express better your comment?
Eg:
const args = {
node: 0,
wpNow: 1,
wp: 2,
wpCliOptions: 3
}
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.
Wouldn't yargs
provide you a list of everything that comes after the command?
* Test wp-cli eval-file works correctly. | ||
* We will use the context of Playground mode. | ||
*/ | ||
test('wp-cli eval-file works correctly', async () => { |
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.
TIL about that command, how lovely!
|
@n3f what would be a reproduction? |
I just followed the instructions in the PR then as an additional case ran |
@n3f , thanks for testing it. Maybe it's a matter of using the latest dependencies. |
What?
Brings
wp-cli
execution towp-now
with the current site context.The new command will be
wp-now wp ...
I'm open to other command names, like
cli
.Why?
wp-cli is a handy tool for all WordPress developers opening a wide range of automatizations.
How?
wp-cli was intentionally removed until the Playground was mature enough to support a wide range of operations.
I added a new command that calls
executeWPCli
, which downloads the phar file and mounts the current directory to make easier the execution of local files witheval-file
.Testing Instructions
nvm use && npm install && npx nx build wp-now
npx nx run wp-now:test
node dist/packages/wp-now/cli.js wp eval-file /./foo.php
node dist/packages/wp-now/cli.js wp cli version