composer-custom-directory-installer icon indicating copy to clipboard operation
composer-custom-directory-installer copied to clipboard

Ensure Idempotent, First-Run Correctness

Open mnsami opened this issue 10 months ago • 0 comments

Fix installer ordering so custom paths are applied on the first composer install

Some users report needing to run composer install twice for packages to land in their custom directories due to ordering issues between Composer’s default installers and custom logic. This friction leads developers to seek alternatives.

Technical Issue & Solution:

Issue: Custom install events sometimes trigger after Composer’s autoload dump, causing intermediate installs in vendor/.

Solution: Tie into Composer’s event lifecycle more precisely by subscribing to both pre-package-install and pre-package-update events, applying path remapping before any files are written. Optionally, integrate with the post-autoload-dump event to perform cleanup of residual files in vendor/.

Scope & Goal:

  • Update plugin event subscriptions to hook earlier in the install/update process.
  • Add tests simulating fresh installs to verify that no leftover artifacts remain in vendor/.
  • Goal: Guarantee that on the first invocation of composer install or composer update, packages are installed directly into the custom directories with no extra steps.

mnsami avatar Jun 16 '25 09:06 mnsami