Manual:Composer.json best practices/fr

Lorsque vous créez un fichier composer.json pour votre extension/bibliothèque/etc qui sera utilisée dans MediaWiki, voici quelques bonnes pratiques à suivre. Vous devriez aussi lancer le validateur de Composer qui vous pointera les erreurs de schéma.

Configuration

 * "prepend-autoloader": false. L’auto-chargeur (autoloader) de Composer est plus lent que celui de MediaWiki et la plupart des classes chargées sont susceptibles d’être trouvées dans MediaWiki, ainsi donc ajoutez après plutôt que avant l’auto-chargeur de Composer. Voyez ceci pour quelques détails supplémentaires.
 * "optimize-autoloader": true. Il n’y a pas de raison de ne pas optimiser.

Bon exemple : mediawiki/core

Dépendances

 * 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.

Good example: 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.

Extensions
Extension names should be be all lowercase with s. For example:


 * Extension:WikiEditor --> mediawiki/wiki-editor
 * Extension: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".

Good example: mediawiki/skins/Vector

Also extension.json
Extensions and skins register information about themselves using an extension.json or skin.json file. Some metadata fields in these files overlap (discussed in T89456), including
 * and
 * and