composer / composer/installers

mediawiki-skin should install in CamelCase name directory

Open
#523 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
PHP
Stars
1.4k
Forks
400
PR merge metrics
No merged PRs in 30d

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.
- 1. When I set package type "mediawiki-skin", the skin was installed on "/skins/example".
- 2. When I set package type "mediawiki-extension", the skin was installed on "/extensions/Example".
- 3. 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."
- 4. 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 ( https://github.com/composer/installers/blob/2a9170263fcd9cc4fd0b50917293c21d6c1a5bfe/src/Composer/Installers/MediaWikiInstaller.php#L52-L57 ) to like bellow?

```
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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.