Adds the craft cli as a composer bin file
There are some times (specifically during plugin development) where I don't need the full craftcms/craft setup and all I really need is the Craft CLI so I can run a queue or execute a one-off task. Adding the bin to composer.json ships the CLI with the craftcms/cms dev so dependent projects can easily run Craft via ./vendor/bin/craft install, for example.
With the new Craft 4 ENV changes, too, I don't even need any config/ dir or anything like that.
After this change it is possible (in a new directory) to do something like this and have a full Craft CLI running.
$ composer require craftcms/cms
$ CRAFT_DB_NAME=craft ./vendor/bin/craft install
Optionally, you could explore shortening the craftcms/craft CLI even more and just pointing to this in the vendor directory.
This is a proof of concept and for your consideration. There are probably downsides (but I can't think of them) and other changes that must be made before this merges in. Just something I was working on and found helpful of late.
{
"config": {
"bin-dir": "./"
}
}
...would put craft (and any other binaries) in the project root, too
Baby steps. bin-dir seems a bit heavy handed to me, personally.
Whatever the outcome—being able to run ./craft without cloning down all of craftcms/craft would be a very welcome addition.
Also, you can do composer exec craft and it'll run it... no need to specify the kind of annoying to type ./vendor/bin/craft
(just putting this here as a hint to others)
Yup, composer exec craft is 😈 (devilishly awesome)