src/ComposerScripts.php
public static function generatePluginsManifest(array $packages, string $outputPath, string $vendorDir = null)
    {
        $plugins = [];

        foreach($packages as $package) {

            /* Skip packages that do not define plugin in extra */
            if(empty($package['extra']['jinitialize-plugin'])) continue;

            /* Append plugin directory to info */
            if(! is_null($vendorDir)) {
                /* The directory where the plugin will be installed */
                $path = $vendorDir .'/'. $package['name'];
                $package['extra']['jinitialize-plugin']['path'] = $path;
            }

            $pluginInfo = $package['extra']['jinitialize-plugin'];
            $plugins[] = $pluginInfo;
        }

        $content = '<?php return ' . var_export($plugins, true) . ';';
        file_put_contents($outputPath, $content);
    }
public static function generatePluginsManifest(array $packages, string $outputPath, string $vendorDir = null)
    {
        $plugins = [];

        foreach($packages as $package) {

            /* Skip packages that do not define plugin in extra */
            if(empty($package['extra']['jinitialize-plugin'])) continue;

            /* Append plugin directory to info */
            if(! is_null($vendorDir)) {
                /* The directory where the plugin will be installed */
                $path = $vendorDir .'/'. $package['name'];
                $package['extra']['jinitialize-plugin']['path'] = $path;
            }

            $pluginInfo = $package['extra']['jinitialize-plugin'];
            $plugins[] = $pluginInfo;
        }

        $content = '<?php return ' . var_export($plugins, true) . ';';
        file_put_contents($outputPath, $content);
    }
public static function generatePluginsManifest ( array $ packages , string $ outputPath , string $ vendorDir = null ) { $ plugins = [ ] ; foreach ( $ packages as $ package ) { /* Skip packages that do not define plugin in extra */ if ( empty ( $ package [ 'extra' ] [ 'jinitialize-plugin' ] ) ) continue ; /* Append plugin directory to info */ if ( ! is_null ( $ vendorDir ) ) { /* The directory where the plugin will be installed */ $ path = $ vendorDir . '/' . $ package [ 'name' ] ; $ package [ 'extra' ] [ 'jinitialize-plugin' ] [ 'path' ] = $ path ; } $ pluginInfo = $ package [ 'extra' ] [ 'jinitialize-plugin' ] ; $ plugins [ ] = $ pluginInfo ; } $ content = '<?php return ' . var_export ( $ plugins , true ) . ';' ; file_put_contents ( $ outputPath , $ content ) ; }
Separate mehtod for testing puroposes
Separate mehtod for testing puroposes