Page MenuHomePhabricator

packagefiles should accept wildcards
Closed, DeclinedPublic

Description

It's really tedious having to update skin.json on every single rename of a file. Renaming should be cheap.

Currently we have to list files in packageFiles object in https://github.com/wikimedia/Vector/blob/master/skin.json#L96 so that require() can be used.

Most code editors are good at updating references to require statements when a file gets renamed, but they are not MediaWiki aware.

It's proposed ResourceLoader packageFiles accept a wildcard meaning "any file in this folder". I think this will save a lot of developer frustration.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle closed this task as Declined.EditedMay 24 2021, 10:13 PM
Krinkle subscribed.

Specifying a wildcard would require performing directory scanning at runtime (negatively affecting user experience), or complicating state management in a way that I think is too costly to maintain for the marginal gain it offers. (E.g. worse startup performance, or module module_deps usage, which I'd like to avoid due to the cachce churn and deployment delays it causes.) As such, I'll decline this task in accordance with our principles.

There is however already work upcoming in the pipeline that I think has a better pay-off, namely to automate extension.json updates by automatically scanning for require() statements and interface messages, and ensuring extension.json is up-to-date based on that. This would be invoked similar to how we do with other management scripts such as for autoloader, and foreign resources. Perhaps these can be combined and thrown into a watchmode-capable script one can run in the background. Or run ad-hoc as it shouldn't come up that often when maintaining production code.

In the absence of a wildcard and/or the automatic scanning of require statements, we risk issues like T301810#7712180 (due to development happening outside MediaWiki in storybook/Jest where this is the norm). Is there a task for automating extension.json ?