HomePhabricator

Codex: Allow a local development version to be used

Tags
None
Referenced Files
None
Subscribers
None

Description

Codex: Allow a local development version to be used

Developers can use this to test their local version of Codex with
MediaWiki by pointing $wgCodexDevelopmentDir to their local clone of the
Codex repo, e.g. $wgCodexDevelopmentDir = '/home/yourname/git/codex';

Setting $wgCodexDevelopmentDir affects where the following things come
from:

  • Codex JS/CSS files for the full library
  • Codex JS/CSS files for code-split chunks, and the manifest.json file that points to them
  • Icons retrieved by CodexModule::getIcons()
  • CSS-only icons imported in Less
  • Design tokens imported in Less

Other changes in this patch:

  • Add CodexModule::makeFilePath() to centralize the repeated path concatenation. This makes it easier to switch out the regular path for the dev mode path.
  • Replace all uses of $IP (which is deprecated) and MW_INSTALL_PATH in CodexModule with the BaseDirectory config setting.
  • Make CodexModule::getIcons() reset its static cache if the path to the icons file changes. Without this, it's impossible to make the unit tests pass.
  • Move the i18n messages code from the CodexModule constructor to getMessages(). It can't be in the constructor because makeFilePath() doesn't work there (it fails because the Config object hasn't been set up yet).
  • Add a 'mediawiki.skin.codex' import path so that we can stop hard-coding the path to the Codex mixins file. Without this, we can't make the Codex mixins come from the right place in development mode.
  • Consider $wgCodexDevelopmentDir in setting the cache key for compiled Less code, since changing this setting can change the output of Less compilation (by changing design tokens, icons or mixins).
  • Add unit tests for (the non-dev mode behavior of) CodexModule::getIcons() and the i18n message key handling.

Bug: T314507
Change-Id: I11c6a81a1ba34fe10f4b1c98bf76f0db40c1ce98

Details

Provenance
CatropeAuthored on May 2 2024, 3:27 AM
Parents
rMW38066e53178b: tests: Add a test for Codex i18n messages
Branches
Unknown
Tags
Unknown
ChangeId
I11c6a81a1ba34fe10f4b1c98bf76f0db40c1ce98

Event Timeline