8.1 Composer Scripts
How about using "scripts" you know these!
@ drupal8-site/composer.json
{ "scripts": { "preinstall-cmd": [ "drupal chain --file=../console/chain/pre.yml" ], "postinstall-cmd": [ "drupal chain --file=../console/chain/post.yml" ], "preupdate-cmd": [ "drupal chain --file=../console/chain/pre.yml" ], "postupdate-cmd": [ "drupal chain --file=../console/chain/post.yml" ] } },
8.2 Example of pre command chain
Now you can run commands from a pre.yml
or a post.yml
files
commands: - command: database:dump - command: exec arguments: bin: composer archive --working-dir=../ --dir/tmp/
The database:dump
command is a drupal Console command.
The exec
command allows you to execute any other shell command
8.3 Example of post command chain
@ post.yml
commands: - command: config:import - command: update:execute arguments: module: all
There are plenty or events that can be attached to, this is just an example of uesing pre and post...