private function getInstalledPackages(string $vendorDir): array
    {
        try {
            $installedData = (new JsonLoader($vendorDir . '/composer/installed.json'))->getData();
        } catch (NotReadableException $e) {
            $message = 'The composer dependencies have not been installed, run composer install/update first';
            throw new DependenciesNotInstalledException($message);
        }

        $installedPackages = [];

        $packages = $installedData['packages'] ?? $installedData;
        foreach ($packages as $vendorJson) {
            $vendorName = $vendorJson['name'];
            $installedPackages[$vendorName] = $vendorJson;
        }

        return $installedPackages;
    }