twinkle-core
v3.1.3
Published
This is intended to be the "core" repository for [Twinkle](https://en.wikipedia.org/wiki/Wikipedia:Twinkle) using which Twinkle installations for different wikis can be created (for example: [twinkle-enwiki](https://github.com/wikimedia-gadgets/twinkle-st
Downloads
202
Readme
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 toexport * 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()
asmsg
will only work onceinitMessaging()
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
- On every push to the master branch, the documentation on Toolforge is automatically updated by the docs-deploy workflow.
- Another workflow (i18n-deploy.yml) sanitises new i18n messages synced from translatewiki.net using the build-i18n script and syncs them to the i18n branch which only contains built i18n messages. This branch is mirrored to the TwinkleCore Gerrit repository. Wikis can fetch i18n messages from Gerrit in a CSP-compliant way.
- You can create a new release using the releases tab in GitHub UI. This triggers the npm-publish workflow to publish a new version of the NPM package. Be sure that the version number in package.json was updated before this is done (trying to republish with the same version will not work).
- On every new release, the docs-deploy workflow also saves the documentation to a permanent link (eg. for v3.0.2-beta at https://twinkle.toolforge.org/core-docs-3.0.2-beta).
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.