See https://www.mediawiki.org/wiki/Extension:Popups for more information about what it does.
Popups uses an asset bundler so when developing for the extension you'll need to run a script to assemble the frontend assets.
You can find the frontend source files in src/
, the compiled sources in resources/dist/
, and other frontend assets managed by resource loader in resources/*
.
After an npm install
:
npm start
Will run the bundler in watch mode, re-assembling the files on file change. Additionally, this builds debug-friendly assets and enables Redux DevTools debugging.npm run build
Will compile the assets just once, ready for deployment. You must run this step before sending the patch or CI will fail (so that sources and built assets are in sync).npm test
To run the linting tools and the tests.tests/qunit/
tests/node-qunit/
, which you can run with npm run test:unit
nodemon
to watch sources and auto run linting and tests.npm install -g nodemon
nodemon -w src/ --exec "grunt lint:all && npm run test:unit"
npm run coverage
coverage/
folderDevelopers are likely to work with local MediaWiki instances that do not have content to test with. To reduce this pain, you can create a single page with a list of links that point to an existing and external wiki by using the following config flag:
$wgPopupsGateway = 'restbaseHTML'; $wgPopupsRestGatewayEndpoint = 'https://en.wikipedia.org/api/rest_v1/page/summary/';
Popups works with a local copy of the Mobile Content Service too:
$wgPopupsGateway = 'restbaseHTML'; $wgPopupsRestGatewayEndpoint = 'http://localhost:6927/en.wikipedia.org/v1/page/summary/';
$0.dispatchEvent(new MouseEvent("mouseover", { view: window, bubbles: true, cancelable: true, }));
npm start
enables Redux DevTools functionality. In production builds, this same functionality can be enabled by setting a debug=true
query. E.g., https://en.wikipedia.org/wiki/Popup?debug=true
.| tap-mocha-reporter dot
.The root of the repository contains a .storybook directory. This folder contains a separate NPM project using the Storybook.js UI framework. This framework provides an environment that showcases all possible permutations of popups, without the state-management constraints of having only one popup per page.
This framework requires Node 8 (because of the spread ...
operator) and is therefore separated from the main package.json until CI upgrades from Node 6. NVM can be used to manage multiple Node versions to run the Storybook app (cd .storybook && nvm use
). See the .storybook/README.md for details.
Execute npm -s run doc
.