Manual:Composer.json best practices/es

When creating a composer.json file for your extension/library/etc that will be used inside MediaWiki, here are a few best practices to follow. You should also run composer validate, which will point out schema errors.

Configuración

 * "prepend-autoloader": false. Composer's autoloader is slower than MediaWiki's, and most of the classes being loaded are likely to be found inside MediaWiki, so append the composer autoloader instead of prepending it. Véase esto para más detalles.
 * "optimize-autoloader": true. No reason not to optimize.

Buen ejemplo: mediawiki/core

Dependencias

 * Dependencies should be pinned to a specific version number or sha1 commit if a tag isn't available.
 * For development tools like phpunit or phpcs, "dev-master" or "*" is acceptable.

Buen ejemplo: mediawiki/core

Naming
Libraries hosted in Gerrit or by the Wikimedia GitHub account should typically be published under the "wikimedia" namespace (e.g. "wikimedia/cdb", "wikimedia/simplei18n"). The use of the "mediawiki" namespace should be reserved for extensions and other intrinsically MediaWiki related components (bot frameworks, etc). Projects hosted at GitHub under an independent organization are encouraged to adopt a similar convention of an organization namespace to be applied consistently across the libraries published by the group.

Extensiones
Extensions should be named using -'s and all lowercase. For example:


 * Extensión:WikiEditor --> mediawiki/wiki-editor
 * Extensión:MassMessage --> mediawiki/mass-message

To make themselves installable, a dependency upon "composer/installers" is needed, and the type needs to be set to "mediawiki-extension".

Good example: mediawiki/extensions/Bootstrap

Skins
Mainly the same as extensions, except the type should be "mediawiki-skin". The names should end with a suffix of "-skin".

Buen ejemplo: mediawiki/skins/Vector