Hi everyone,
I’m trying to generate a file out of a Settings.yaml configuration as soon as my package has been added to the project via composer. What I did so far:
<?php
namespace DIU\Neos\PWA\Composer;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\Script\Event;
use Composer\Installer\PackageEvent;
use Neos\Flow\Package\PackageManager;
use Neos\Utility\Files;
/**
* Class for Composer install scripts
*/
class InstallerScripts
{
/**
* Make sure required paths and files are available outside of Package
* Run on every Composer install or update - must be configured in root manifest
*
* @param Event $event
* @return void
*/
public static function postInstallCreateFile(Event $event){
# I need the root path as I want to add the file here, copied from Neos Flow package
if (!defined('FLOW_PATH_ROOT')) {
define('FLOW_PATH_ROOT', Files::getUnixStylePath(getcwd()) . '/');
}
echo "hello world";
// add command to create file from Settings.yaml
}
}
and I have added this to my composer.json of my package:
...
"scripts": {
"post-install-cmd": [
"DIU\\Neos\\PWA\\Composer\\InstallerScripts::postInstallCreateFile"
],
"post-update-cmd": [
"DIU\\Neos\\PWA\\Composer\\InstallerScripts::postInstallCreateFile"
]
}
...
Unfortunately it looks like my command won’t get executed. I always see only
Neos\Flow\Composer\InstallerScripts::postUpdateAndInstall
instead of my command. Can I hook in here somehow? Can I even use the Flow commands when they are executed from composer ?
Thanx a lot!