Bug Report
| Subject |
Details |
| Rector version |
Rector 2.0.10 |
I have a composer.json file with the platform.vendor-dir property set, it looks something like this:
{
"config": {
"vendor-dir": "httpdocs/vendor"
}
}
For background, per https://getcomposer.org/doc/06-config.md#vendor-dir this is how the setting is described:
Defaults to vendor. You can install dependencies into a different directory if you want to. $HOME and ~ will be replaced by your home directory's path in vendor-dir and all *-dir options below.
When I run rector (including just --version) with the Rector\Configuration\RectorConfigBuilder::withComposerBased configuration method I get the following error:
[ERROR] The installed package json not found. Make sure you run `composer update` and the "vendor/composer/installed.json" file exists
Seems like InstalledPackageResolver always gets created with \getcwd()
|
$setManager = new SetManager($setProviderCollector, new InstalledPackageResolver(\getcwd())); |
and inside that always expects the platform.vendor-dir value to be the default with this hard-coded path:
|
$installedPackagesFilePath = $this->projectDirectory . '/vendor/composer/installed.json'; |
Not quite sure if this is technically a bug or a feature request, but I figure since it says "not found" and composer.json says where it is that seems more like a bug to me.
I can work around it by making a symlink in the spot it's looking for to where the installed.json file is, but it does make my directories a bit messier.
Thanks for taking a look!
Bug Report
I have a
composer.jsonfile with theplatform.vendor-dirproperty set, it looks something like this:{ "config": { "vendor-dir": "httpdocs/vendor" } }For background, per https://getcomposer.org/doc/06-config.md#vendor-dir this is how the setting is described:
When I run
rector(including just--version) with theRector\Configuration\RectorConfigBuilder::withComposerBasedconfiguration method I get the following error:Seems like
InstalledPackageResolveralways gets created with\getcwd()rector/src/Configuration/RectorConfigBuilder.php
Line 144 in b298872
and inside that always expects the
platform.vendor-dirvalue to be the default with this hard-coded path:rector/src/Composer/InstalledPackageResolver.php
Line 42 in b298872
Not quite sure if this is technically a bug or a feature request, but I figure since it says "not found" and
composer.jsonsays where it is that seems more like a bug to me.I can work around it by making a symlink in the spot it's looking for to where the
installed.jsonfile is, but it does make my directories a bit messier.Thanks for taking a look!