I have this simple composer.json file. When I run "composer install" I expect it to run post-install-cmd script but nothing happens. If I change it to post-update-cmd it works as expected. Am i missing something? Doesn't it have to run post-install-cmd instead of post-update-cmd?
{
"name": "vendorName/packageName",
"description": "Some description",
"type": "library",
"require": {
"psr/log": "^1.1"
},
"scripts": {
"post-install-cmd": "$SHELL script.sh"
}
}
The (pre|post)-update-cmd
is invoked when running composer install
if you don't have a lock-file (composer.lock
) in your project's root directory.
The composer install
command is meant to install the dependencies in the lock-file.
If there is no composer.lock
it will run composer update
internally to resolve the dependencies and generate the lock-file for you.
From the documentation of the install
command:
If there is no composer.lock file, Composer will create one after dependency resolution.