zachleigh's avatar

Composer package: composer scripts won't fire

Im trying to get post-install and post-update scripts working in a composer package but they arent firing at all.
Excerpt from composer.json file:

    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },

    "scripts": {
        "post-update-cmd": [
            "App\\Install\\ComposerScripts::postUpdate"
        ],
        "post-package-install": [
            "App\\Install\\ComposerScripts::postInstall",
            "./install.sh"
        ]
    }

ComposerScripts.php

<?php

namespace App\Install;

use Composer\Script\Event;
use Composer\Installer\PackageEvent;

class ComposerScripts
{

    public static function postInstall(PackageEvent $event)
    {
        $io = $event->getIO();

        if ($io->askConfirmation('Install Mecab? ', false)) {
            return true;
        }

        exit;
    }

    public static function postUpdate(Event $event)
    {
        $event->getIO()->write("Working!");

        return true;
    }
}

These scripts don't appear to be firing at all. I get no prompt or message in terminal when installing/updating and the script file doesnt run. No errors either.

0 likes
0 replies

Please or to participate in this conversation.