Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer custom installer paths with WPackagist

By default, dependencies from http://wpackagist.org/ install to /wp-content/plugins or /wp-content/themes to mimic the default locations for WordPress but I've previously been able to specify that dependencies from http://wpackagist.org/ should go in a specific directory with the following:

"extra": {
    "installer-paths": {
        "vendor/{$name}/": ["type:wordpress-plugin"],
        "vendor/{$name}/": ["type:wordpress-theme"]
    }
}

i.e. to put them in the general /vendor directory to be treated as code dependecies. However in a new project this is now not working. Similar searches reveal that the type looks for the value set in the dependency's composer.json but seeing as WPackagist mirrors the WordPress repository, plugins and themes from WPackagist don't have a composer.json.

I tried explicitly stating the vendor-dir but it made no difference but interestingly, setting the installer path for each dependency works as expected, e.g.

"extra": {
    "installer-paths": {
        "vendor/cmb2/": ["wpackagist-plugin/cmb2"]
    }
}

Can anyone see what I'm doing wrong?

like image 852
Rich Jenks Avatar asked Mar 06 '15 10:03

Rich Jenks


1 Answers

The problem is you have two keys with the same name so the second is overwriting the first. Try this instead:

"extra": {
    "installer-paths": {
        "vendor/{$name}/": ["type:wordpress-plugin", "type:wordpress-theme"]
    }
}
like image 160
Tamlyn Avatar answered Nov 14 '22 13:11

Tamlyn