-
Notifications
You must be signed in to change notification settings - Fork 16
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
Studio: Download the latest wp-cli and bundle it #178
Conversation
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.
@kozer , thank you for creating this PR.
I tested it and the bundled .phar is present in wp-files
when running npm install
and also in the App resources.
![Screenshot 2024-05-28 at 21 11 20](https://private-user-images.githubusercontent.com/779993/334562125-9d1298e4-e5fd-43d1-b087-02ff25099314.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIyMzY0NTAsIm5iZiI6MTcyMjIzNjE1MCwicGF0aCI6Ii83Nzk5OTMvMzM0NTYyMTI1LTlkMTI5OGU0LWU1ZmQtNDNkMS1iMDg3LTAyZmYyNTA5OTMxNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyOVQwNjU1NTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mMzJlOTgzMzNiZjdjNTBjYWU0OTA5YzFkY2EyZjQwN2FmOTg4NGZiOWFiYzU3ZjlmMjUxODg5OTZmM2ZjMmM4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.d91-gVyB1J6JnxmKE-SrjkNd6ArVaRWuqFT-DoHTrio)
![Screenshot 2024-05-28 at 21 11 39](https://private-user-images.githubusercontent.com/779993/334562007-7d3b17d7-d536-48f4-931c-c4d37807960e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIyMzY0NTAsIm5iZiI6MTcyMjIzNjE1MCwicGF0aCI6Ii83Nzk5OTMvMzM0NTYyMDA3LTdkM2IxN2Q3LWQ1MzYtNDhmNC05MzFjLWM0ZDM3ODA3OTYwZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyOVQwNjU1NTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00NTBiNjViMjU3ODQ3ZDUwNDk2MDQxYjRiODcyZGIzYjEyMjk0MWM4YzdlMDkyMGI1YWVhYTMyNDg0ZTUyNWQyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.X5xbbpV7bFj6kpqtBdZ6e8nuCNvXTu4Jy2s3ak31il0)
I left a comment asking if is possible to use that file directly, instead of copying it to the "home" directory.
When starting the app I also confirm the app downloads and replaces the .phar file in the home directory. But I think we don't need that behaviour. My concern is that it could make the app starting slower.
File at "~/Library/Application Support/Studio/server-files/wp-cli.phar"
![Screenshot 2024-05-28 at 20 54 32](https://private-user-images.githubusercontent.com/779993/334563007-7e3fde9b-6e10-4d70-a946-7314789ef31f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIyMzY0NTAsIm5iZiI6MTcyMjIzNjE1MCwicGF0aCI6Ii83Nzk5OTMvMzM0NTYzMDA3LTdlM2ZkZTliLTZlMTAtNGQ3MC1hOTQ2LTczMTQ3ODllZjMxZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyOVQwNjU1NTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lZTY2NTZlZjVmYTVmNzI0ZmQ4OTg5OTQ4YWQzYjg2M2E5MzcxOTgwNDY2MTUwY2YzYWZiYjQ2ODVmNzZmYzk5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.6EVrYLOwEh6e6_r_SnJxyRBk_1GZyZn7tEQv7EvA8go)
Thank you @sejas for your comments! I updated the PR! Can you test it again? Thanks! |
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.
Looking great. Thanks for the changes @kozer
I tried it by running npm run make
I confirm the bundled version exists and I even executed inside Studio adding some code.
getWpCliPath(): /Users/macbookpro/Downloads/Studio.app/Contents/Resources/wp-files/wp-cli/wp-cli.phar
WP-CLI 2.10.0
Hey @wojtekn ! The benefit I see here, is that, as we don't update it currently, there is no reason to add overhead when we start the app, to move thing around. |
@kozer, so why would we do this in the first place? Wouldn't it be beneficial to have it consistent for all three libraries, what I pointed out in #178 (comment) comment? |
The benefit is only temporary, but it is valid, as is. Not a big deal though, as it will probably change soon. |
we can restore the In this commit we were moving the wp-cli.phar and inmediatly downloading it from the network every time the app started, and we need to add a more complex logic to compare wp-cli versions. The biggest argument to keep wp-cli.phar inside the app is that its an "executable" globally available and not something attached to each site. |
I started working on that. I'll handle everything in this ticket. |
Fixes https://github.com/Automattic/dotcom-forge/issues/7320
Proposed Changes
This PR do the following:
Testing Instructions
nvm use && npm i
wp-files/wp-cli
folder.npm run package
wp-cli.phar
exists in./out/<architecture>/resources
folder underwp-files
folder.wp-cli.phar
is updated and is now located under~/.config/Studio/server-files
directory.Pre-merge Checklist