Description
Hi, I'm using Composer for my wiki project.
Now, I just started developing my MediaWiki skin and want to load it as package from my Github repo.
I'm trying but it doesn't work fine.
This is my composer.local.json. (In normally, MediaWiki uses this json for dependency.)
{
"repositories": [
{
"type": "package",
"package": {
"name": "extensions/upload-wizard",
"type": "mediawiki-extension",
"version": "1.40.0",
"source": {
"type": "git",
"url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/UploadWizard.git",
"reference": "REL1_40"
}
}
},
{
"type": "package",
"package": {
"name": "skins/example",
"type": "mediawiki-skin",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/hurohukidaikon/mediawiki-skins-Kagaga.git",
"reference": "REL1_40"
}
}
}
],
"require": {
"mediawiki/simple-batch-upload": "^2.0",
"extensions/upload-wizard": "^1.40.0",
"skins/example": "*"
},
"extra": {
"merge-plugin": {
"include": [
"extensions/*/composer.json",
"skins/*/composer.json"
]
}
}
}
- https://github.com/hurohukidaikon/mediawiki-skins-Kagaga.git is my skin repo just forked official example skin repo.
On my environment, the result is bellow.
-
- When I set package type "mediawiki-skin", the skin was installed on "/skins/example".
-
- When I set package type "mediawiki-extension", the skin was installed on "/extensions/Example".
-
- When I set package type "mediawiki-skin" and package name "Example", installation stopped by error. "A repository of type "package" contains an invalid package definition: Invalid package information: name : skins/Example is invalid, it should not contain uppercase characters. We suggest using skins/example instead."
-
- Do result 1, then rename from "/skins/example" to "/skins/Example". It works fine!
Therefore, I learn the skin directory's name needs CamelCase and it sould place in skins directory.
https://www.mediawiki.org/wiki/Manual:How_to_make_a_MediaWiki_skin
So, how about change this function (
installers/src/Composer/Installers/MediaWikiInstaller.php
Lines 52 to 57 in 2a91702
protected function inflectSkinVars(array $vars): array
{
$vars['name'] = $this->pregReplace('/-skin$/', '', $vars['name']);
$vars['name'] = str_replace('-', ' ', $vars['name']);
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
}
Unfortunately I don't test this code yet, because I haven't enough skills.
I hope to test it and make a pull request, but probably your fixing is faster than me.
Thank you for reading!
If you need additional info, let me know!