inpsyde / vip-composer-plugin Goto Github PK
View Code? Open in Web Editor NEWA Composer plugin to ease deployment to wordpress.com VIP servers alongside Composer-based local development.
License: MIT License
A Composer plugin to ease deployment to wordpress.com VIP servers alongside Composer-based local development.
License: MIT License
Is your feature request related to a problem? Please describe.
Currently Tasks are added and executed in Command
and on exception we stop the execution. But in some cases like in the SymlinkVipGoDir::run()
we do not check for successful execution and continue with an errornous results. In other cases we continue the runner, but printing errors, like in DownloadWpCore:run()
. We should generalize this and consider, that "critical execution" needs to 100% succeed or otherwhise throw an Exception to stop the program.
Describe the solution you'd like
Following Tasks need to be updated and throw a custom Exception when we cannot ensure that the task 100% completes:
Command
?Additional context
See discussion here: #5
Just had a quick review yet..maybe we'll find more. Will update the list when i find one.
When using this plugin on a composer-project with a dependency of type "wordpress-muplugin" the classmap autoloader created by this plugin does not contain the correct paths to autoloaded files within the plugin folder.
composer vip --local --git
and inspect /vip/.vipgit%hash%/client-mu-plugins/vendor/vip-autoload/autoload_classmap.php
$baseDir . '/vip/client-mu-plugins/%plugin-name%
, which is non-existant.I expect installing mu-plugins to work with the production autoload as composer handles it locally with it's own autoload.
No response
No response
My proposal is to extend the replacement regex here with the client-mu-plugins
directory.
This way the autoloader contains the correct reference again.
It looks like the merge c84c73c introduced a bug.
Now the command copyDevPath()
fails with a fatal error.
composer vip --sync-dev-paths
.The command is executed without any error.
No response
The "/Users/mangiaca/Websites/project/vip-config/env" directory does not exist.
#0 /Users/mangiaca/Websites/project/vip/client-mu-plugins/vendor/inpsyde/vip-composer-plugin/src/Task/CopyDevPaths.php(189): Symfony\Component\Finder\Finder->in('/Users/mangiaca...')
#1 /Users/mangiaca/Websites/project/vip/client-mu-plugins/vendor/inpsyde/vip-composer-plugin/src/Task/CopyDevPaths.php(112): Inpsyde\VipComposer\Task\CopyDevPaths->pathInfoForKey('vip-config-dir')
#2 /Users/mangiaca/Websites/project/vip/client-mu-plugins/vendor/inpsyde/vip-composer-plugin/src/Task/CopyDevPaths.php(86): Inpsyde\VipComposer\Task\CopyDevPaths->copyDevPath('vip-config-dir', Object(Inpsyde\VipComposer\Io))
#3 /Users/mangiaca/Websites/project/vip/client-mu-plugins/vendor/inpsyde/vip-composer-plugin/src/Tasks.php(56): Inpsyde\VipComposer\Task\CopyDevPaths->run(Object(Inpsyde\VipComposer\Io), Object(Inpsyde\VipComposer\Task\TaskConfig))
#4 /Users/mangiaca/Websites/project/vip/client-mu-plugins/vendor/inpsyde/vip-composer-plugin/src/Command.php(185): Inpsyde\VipComposer\Tasks->run()
#5 phar:///opt/homebrew/Cellar/composer/2.6.6/bin/composer/vendor/symfony/console/Command/Command.php(298): Inpsyde\VipComposer\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 phar:///opt/homebrew/Cellar/composer/2.6.6/bin/composer/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 phar:///opt/homebrew/Cellar/composer/2.6.6/bin/composer/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Inpsyde\VipComposer\Command), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 phar:///opt/homebrew/Cellar/composer/2.6.6/bin/composer/src/Composer/Console/Application.php(382): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 phar:///opt/homebrew/Cellar/composer/2.6.6/bin/composer/vendor/symfony/console/Application.php(171): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 phar:///opt/homebrew/Cellar/composer/2.6.6/bin/composer/src/Composer/Console/Application.php(145): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 phar:///opt/homebrew/Cellar/composer/2.6.6/bin/composer/bin/composer(93): Composer\Console\Application->run()
#12 /opt/homebrew/Cellar/composer/2.6.6/bin/composer(29): require('phar:///opt/hom...')
#13 {main}
### Additional context
_No response_
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
It looks like that https://github.com/Automattic/vip-go-mu-plugins/blob/develop/000-pre-vip-config/requires.php needs to be loaded locally in wp-config.php or relatively early. Currently our vip-composer-plugin
does not take that file into consideration and WP VIP does just leave a comment in the file ๐ค
You should make sure to include this file locally in case you're not using VIP Local Development Environment
We should add this file (and others...?) to our vip-composer-plugin
as files which should be required in wp-config.php
.
mu-plugin
class_exists(VIP_Request_Block::class)
false
because its not autoloaded and the "manual" require_once
-file is not added by us.Add the /vip-go-mu-plugins/000-pre-vip-config/requires.php
to wp-config.php
No response
No response
No response
Deprecation Notice: Constant Inpsyde\VipComposer\Task\FILTER_SANITIZE_STRING is deprecated in /home/runner/work/mah-website/mah-website/vip/client-mu-plugins/vendor/inpsyde/vip-composer-plugin/src/Command.php:208
Deploy with PHP 8.1
No response
No response
No response
Due some change on Composer v2.3 and dropped support of PHP < 7.2 the path for the generated autoload file is not correct anymore.
The change on Composer was following:
v2.3
https://github.com/composer/composer/blob/2.3.0/src/Composer/Autoload/AutoloadGenerator.php#L983
self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader(\\dirname(__DIR__));
v.2.2
https://github.com/composer/composer/blob/2.2/src/Composer/Autoload/AutoloadGenerator.php#L985
self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader(\\dirname(\\dirname(__FILE__)));
We see now following fatal error:
PHP message: Compile error: require(): Failed opening required /var/www/wp-content/client-mu-plugins/vendor/vip-autoload/../../../../vip/plugins/{snipped}/inc/helpers.php
It seems, the paths is incorrect. ๐ค
Deploy to VIP with Composer v2.3 and autoload.files
in one of the packages.
Path replacement should work with Composer v2.3.
No response
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.