I would recommend using the Symfony Process Component for this inside some script handler and then running it as post-install-cmd , as you said.
scripts / composer / ScriptHandler.php
use Composer\Script\Event; use Symfony\Component\Process\Process; use Symfony\Component\Process\Exception\ProcessFailedException; class ScriptHandler { public static function gulpBuild(Event $event) { $process = new Process('cd /path/to/my/theme && gulp build'); $process->run();
composer.json
"autoload": { "classmap": [ "scripts/composer/ScriptHandler.php" ] }, "scripts": { "post-update-cmd": [ "DrupalProject\\composer\\ScriptHandler::gulpBuild" ] },
Check out the composer template for Drupal projects for more inspiration. (For example, a dynamic path to your topic so that this command runs successfully in each environment.)
source share