twinkle-core
This is intended to be the "core" repository for Twinkle using which Twinkle installations for different wikis can be created (for example: twinkle-enwiki)
The twinkle-starter repository provides a template using which a new Twinkle installation can be started off easily. Each twinkle installation relies on twinkle-core as an npm dependency. Please refer to the README of twinkle-starter for instructions on setting up twinkle for a new wiki.
Documentation for twinkle-core is hosted on Toolforge. Check it out at https://tools-static.wmflabs.org/twinkle/core-docs (alternative link).
Twinkle-core uses orange-i18n for internationalisation. A fork of banana-i18n, it uses the same format for messages as MediaWiki. Translations are coordinated via translatewiki.net. See https://translatewiki.net/wiki/Translating:Twinkle for contributing translations.
Contributing
- Set up an IDE or code editor to work with JS/TS. Popular choices include Visual Studio Code or one of the JetBrains IDEs if you have a licence (JetBrains offers free licenses to MediaWiki contributors and students). If you are a command line veteran, check out TypeScript for Vim or emacs!
- Work on twinkle-core is usually done while developing or testing a localised twinkle installation (such as twinkle-enwiki). In twinkle-enwiki, all imports from twinkle-core are used through the gateway file core.ts file. Change
export * from 'twinkle-core';
there to export * from '../../twinkle-core/src/index';
. (Assuming that you have twinkle-core and twinkle-enwiki cloned as sibling directories).
- Some other projects such as WVUI follow a somewhat more systematic workflow. You can also try this method though it wasn't working reliably for me.
- Try to ensure all documentation comments align with the TSDoc standard, and what Typedoc supports.
- Ensure that code at the top level (that is, code at 0 level of indentation as well as class property initialisations) don't have usages of
msg()
as msg
will only work once initMessaging()
is run. - This library has no side effects. Never do anything at the top level that impacts the DOM or changes the state of any globally available variable, as that affects tree-shaking. All such code must be within a function that is exported and called only by the client twinkle installation.
- There do exist many TypeScript type errors currently. They should be avoided but are not disallowed if there isn't actually a bug.
Workflows
Credits
Thanks to the authors of wikimedia-gadgets/twinkle from which the code is adapted.
This repository was created by siddharthvp (SD0001) as part of Grants:Project/Rapid/SD0001/Twinkle localisation.