| 1 | # 3. Publish client preferences |
| 2 | |
| 3 | Date: 2024-01-11 |
| 4 | |
| 5 | ## Status |
| 6 | |
| 7 | Accepted. |
| 8 | |
| 9 | ## Context |
| 10 | |
| 11 | As we build out dark mode, font size and other client preference controls, we want |
| 12 | to avoid having to build things twice for two different skins. The existing code |
| 13 | for client preferences lives in Vector. We expect the code to evolve as different |
| 14 | use cases emerge and when the code/UI evolves we want those changes to be seen |
| 15 | on both skins without having to maintain two separate implementations. |
| 16 | |
| 17 | We expect as features like dark mode and font size roll out so that other skins |
| 18 | will want to make use of this code. |
| 19 | |
| 20 | ## Decision |
| 21 | |
| 22 | For now, we will publish a library @wikimedia/mediawiki.skins.clientpreferences to npmjs.org that |
| 23 | will be used inside MobileFrontend. |
| 24 | |
| 25 | When we make significant changes to the the code in Vector, we will update the |
| 26 | version in the mobile site. |
| 27 | |
| 28 | See https://wikitech.wikimedia.org/wiki/Npm_registry for details on the @wikimedia |
| 29 | organization on NPM. |
| 30 | |
| 31 | See https://docs.npmjs.com/creating-and-publishing-scoped-public-packages |
| 32 | When making modifications to the code inside the Vector skin, to use these in the mobile site |
| 33 | we would create a new release of the module by cd-ing into the directory, bumping the version |
| 34 | in the package.json file and using `npm publish`. Then inside MobileFrontend we would pull |
| 35 | down the latest code from npm and run the build step. |
| 36 | |
| 37 | ## Consequences |
| 38 | |
| 39 | On the long term we expect the library @wikimedia/mediawiki.skins.clientpreferences |
| 40 | to become obsolete. This may involve upstreaming the stable library to MediaWiki |
| 41 | core or creating a new extension to house the code. |