edition-php-drupal-standard
edition-php-drupal-standard copied to clipboard
postInstallCmd should not run in I have a composer.lock
This install script "PatternLab\Installer::postInstallCmd" is not composer best practice, i think. It should only run if I don't have a composer.lock file.
If I have composer.lock file, I shouldn't be prompted to update/merge/replace anything. A composer.lock should indicate a known install state.
I have remove this from my composer.json so that this script no longer runs in our CI. If this is a problem I'm interested to know what should be running in CI.
"post-install-cmd": [
"PatternLab\\Installer::postInstallCmd"
],
I'm running into the same problem, while attempting to track the generated pattern-lab starter-kit files, besides the composer packages inside the vendor
dir.
In my instance, I've added an additional composer dependency on top of the starter kits installations.
When running subsequent composer install
's (after deleting the vendor dir for example) it runs all post-installation scripts as if I was installing the starter-kit from scratch, attempting to override any potential modifications I've made to the config.yml file for example or any other changes I've made to any files shipped with the starter-kit.
The expected behavior would be that one can install the starter-kit, make modifications and track the source files with git, and it would only override the starter-kit modifications with the post-installation scripts if there was no composer.lock
file.
The only other workaround I discovered, besides what was mentioned by the OP, was to run composer install --no-scripts
on the CI or subsequent builds locally.
Maybe that's how the maintainers intended this to be used, so if someone were to want to install additional composer packages they can still run composer update/install
locally and have the post script run, and verify that one only commits the desired post-installation script changes. On a CI environment they can run composer install --no-scripts
so it doesn't request to replace/modify tracked changes to said files.