-
Notifications
You must be signed in to change notification settings - Fork 274
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 executeWPCli()
function to download and execute WP-CLI
#395
wp-now: Add executeWPCli()
function to download and execute WP-CLI
#395
Conversation
…to add/wp-now-command-wp-cli
…to add/wp-now-command-wp-cli
wp-cli
commandexecuteWPCli()
function to download and execute WP-CLI
@sejas is that callback just for unit tests? If yes, you could mock process.stdout instead |
…to add/wp-now-command-wp-cli
@adamziel , yes this callback is just for the unit test. So I decided to go with the option of Some things I tried:
Maybe a related bug: jestjs/jest#9984 |
@sejas oh, sorry, that wasn't
Mocking console.log should work better |
@adamziel , Yay!, it worked. I mocked the |
@danielbachhuber , @adamziel , I think this PR is ready to merge. |
if (process.env.NODE_ENV !== 'test') { | ||
return path.join(getWpNowPath(), 'wp-cli.phar'); | ||
} | ||
return path.resolve('./wp-cli.phar'); |
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.
Should this be a temp directory?
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.
I found that using a temporal directory on my laptop, the wp-cli.phar
cannot be executed.
I tried setting the right permissions fs.chmod()
to the file and folder and it didn't work.
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.
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.
@danielbachhuber , with the temp folder, it seems to pass ok in CI. But it is still failing on my local computer.
Maybe it's something just in my environment.
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.
Is it getting mounted correctly @sejas? What do you see when you list files?
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.
@sejas It failed locally for me too.
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.
Is it getting mounted correctly @sejas? What do you see when you list files?
Yes, the file is accessible in VFS and the file size is correct. It must be something related to MacOs and the tmp path.
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.
@sejas would you start a new issue for this? I'd like to make sure this works on MacOs
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.
Fixing it with WordPress/playground-tools#42
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.
There was a conflict mounting /var
and using the hostFilesystem
.
A second PR was needed:
WordPress/playground-tools@bf31e3e
...args, | ||
]); | ||
} catch (resultOrError) { | ||
const success = |
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.
FYI I merged this change: https://github.com/WordPress/wordpress-playground/pull/470/files#diff-3652c54df4b8d0d8e367481121e32f08cc409cfc4236fdb3172d69dcbf6ca8b0
It shouldn't matter here at all and this check still passes, but I wanted to flag it here just in case.
@@ -2,7 +2,7 @@ | |||
"extends": "./tsconfig.json", | |||
"compilerOptions": { | |||
"outDir": "../../dist/out-tsc", | |||
"types": ["jest", "node"] |
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.
nice
wp-cli support 💯 |
What?
executeWPCli
function to download and execute `wp-cli.wp-now wp
. Currently, we drop it out until we improve the pthreads execution. Currently a PR in progress: PHP: Explore building with pthreads #346emscriptenOptions
to catch print and print error forwp-cli
execution.Why?
How?
It downloads the wp-cli.phar file if the file doesn't exist, then uses
php.cli()
to execute it.There are some limitations in the
wp-cli
features. Some of them may not work.Testing Instructions
npx nx test wp-now