bamarni/composer-bin-plugin

[RFC] Add support for dev packages

PabloKowalczyk opened this issue · 4 comments

Hello,
thanks for great plugin!

Sometimes we would like to have "bins" in production, for example https://github.com/cakephp/phinx or https://github.com/lavary/crunz, also we would like to have some "bins" for development, for example https://github.com/FriendsOfPHP/PHP-CS-Fixer and/or https://github.com/sebastianbergmann/phpunit.

Currently there is no way "mark" bin-package as dev only, this can be a problem in production env, because there are no sense to install phpunit and/or php-cs-fixer on prod.

I suggest two changes:

  • add no-bin-dev option to bin all command or add bin all-no-dev command
  • store dev-bins in vendor-bin-dev directory

WDYT?

Why not using composer bin phpunit require --dev phpunit/phpunit instead? I.e. leveraging Composer dev dependencies for the bin namespaces as opposed to introduce dev bin namespaces?

You are right, this work well.

But consider deployment script, which build artifact for production. Script call composer install --no-dev and "dev-bins" will be installed also.

Now, is there any way to sync --no-dev with:

{
    "scripts": {
        "post-install-cmd": ["@composer bin all install --ansi"],
        "post-update-cmd": ["@composer bin all update --ansi"]
    }
}

?

IMO that's more a limitation of Composer scripts and I would just not use that for the deployment script :)

An alternative is also to leverage Makefiles which can give a finer grained control on what you want to do cf. PHP-Scoper

By "deployment script" i mean bash script or Phing task :)

Ok, thank you for you time, i will close this issue.