aboutsummaryrefslogtreecommitdiffstats
path: root/Gruntfile.js
Commit message (Collapse)AuthorAgeFilesLines
* build: Update SVGO to latest v2.3.0 and re-crush SVGsVolker E2021-05-181-37/+0
| | | | | | | | | SVGO v2.x changed configuration to JS, amending configuration. Adding new 'minify-svg' npm script. Also re-crushing SVGs. Bug: T278656 Change-Id: I1d746fca051cbc00900a05c33e8a401f95848930
* Update stylelint-config-wikimedia to 0.10.3Ed Sanders2020-11-191-0/+3
| | | | | | Remove needless disables. Change-Id: I324ab9d23a354cb0298a0714df2535f8e8850261
* eslint: Update to eslint-config-wikimedia 0.16.0Ed Sanders2020-06-021-1/+2
| | | | | | | * valid-jsdoc replaced with jsdoc plugin * New /selenium config Change-Id: I471eebac0312cb25c539c3f6a3ecfc7cfd4ed8d6
* build: Move eslint ignores to .eslintignoreTimo Tijhof2020-04-221-18/+1
| | | | | | | Note that node_modules is excluded by default. Bug: T249858 Change-Id: Iaa69092b11e49ebf9cc5f2ec8a695894cda31b83
* Merge "build: Provide linting for .vue files from upstream"jenkins-bot2020-04-161-5/+7
|\
| * build: Provide linting for .vue files from upstreamRoan Kattouw2020-04-151-5/+7
| | | | | | | | | | | | | | | | Was first attempted in f1eaa06d5e2222f3a94dc269977cccfb6e891a25, and reverted in 0b3fe4fe8ca0c69d189e86c31f4ef08982133683. Now this is done in eslint-config-wikimedia for all repos. Change-Id: I9ee735eef40085b6373b565838d67e186e438657
* | resources: Provide an ES6-style Promises library with a skip functionJames D. Forrester2020-04-141-0/+2
|/ | | | | | | Using https://github.com/taylorhakes/promise-polyfill via a skipFunction. Bug: T237688 Change-Id: Ib0ffb5d9821e7b734c3f7533cc99e5fdd2c8da3a
* Revert "build: Linting for .vue files"Catrope2020-03-301-5/+5
| | | | | | | | | This reverts commit f1eaa06d5e2222f3a94dc269977cccfb6e891a25. Reason for revert: accidentally allowed ES6 syntax. Looking for a way to redo this that doesn't break our linting as badly. Change-Id: I78974b97001bdbea9aff5717c69d71b8a2582ade
* build: Remove old ZUUL_PROJECT hack from Gruntfile.jsTimo Tijhof2020-03-291-9/+6
| | | | | | | | | | | | This was here from a year ago when we added CHROMIUM_FLAGS, which has since rolled out. Also make the assert-mw-env less fragile by checking the env variables in one place each instead of two places. Before this, it was relatively easy to accidentally add a warning for one, without the shell exit code changing. Change-Id: I6b85483981b415fe251b3760d5f282433e7fc4e9
* build: Linting for .vue filesRoan Kattouw2020-02-051-5/+5
| | | | | | | | | | | | | | | | Install eslint-plugin-vue, which lints JS inside <script> blocks in .vue files, and also lints Vue templates. Configure eslint and stylelint to run on .vue files. stylelint automatically picks up on CSS in <style> tags. You may have to change a setting in your text editor or IDE to make it run eslint and stylelint in .vue files. For eslint, see https://eslint.vuejs.org/user-guide/#editor-integrations ; for stylelint, I had to install the linter-stylelint-plus Atom plugin then add source.css.embedded.html to the "Base Scopes" setting for that plugin. Change-Id: I7e6a13317792fc25c29106739b0c24864fd8d301
* Remove unnecessary reportUnusedDisableDirectivesEd Sanders2019-11-151-1/+0
| | | | | | This is enabled in eslint-config-wikimedia by default. Change-Id: I4b79025c3b9a130d9e0f0af6282d769bd5ba0044
* ParamValidator: Use MessageValue!Brad Jorsch2019-11-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Trying to get away with returning a single code and parameter-list that was supposed to represent both human-readable and machine-readable data was a mistake. This patch converts it to use DataMessageValue, which represents the two separately and also provides guidance for supplying translations of all the error codes. This also eliminates the "describeSettings()" method that was trying to serve multiple use cases (in terms of the Action API, action=paraminfo and action=help). It's replaced by two methods that each serve one of the use cases. Also some of the functionality was moved out of the TypeDef base class into ParamValidator, to better match where the constants themselves live. Also I wound up creating a NumericDef base class so FloatDef can share the same range-checking logic that IntegerDef has. I probably should have done that as a separate patch, but untangling it now would be too much work. Bug: T235801 Change-Id: Iea6d4a1d05bb4b92d60415b0f03ff9d3dc99a80b
* Split rest messages from the main en.jsonAmir Aharoni2019-10-221-0/+1
| | | | | Bug: T233192 Change-Id: I3990ae4e34a51e7648f74a05a4b7ac744fa9b9c4
* build: Lower default Karma logLevel during local developmentTimo Tijhof2019-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follows-up fa63a70ae90 which enabled this for CI to investigate a Jenkins-specific issue, but it makes for a very noisy and visually unpleasant local experience because these Karma lines interweave with the structural output from the qunit/karma reporter. With this change applied, the local experience from 'npm run qunit' has clean output again like so: ``` … mediawiki.storage ✔ set/get(Object) with storage support ✔ set/get(Object) with storage methods disabled ✔ set/get(Object) with storage object disabled mediawiki.template ✔ add ✔ compile ✔ get Finished in 13 secs SUMMARY: ✔ 440 tests completed ``` Change-Id: I21555468ed30ca3a2220eba1d8a78cc140a13399
* Grunt: Expand js{,on} for readabilityEd Sanders2019-08-281-1/+1
| | | | Change-Id: Ib3bfb1a9d6547e1062ea3ad08de7ea721c111586
* build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlintJames D. Forrester2019-05-061-10/+4
| | | | | Bug: T220036 Change-Id: I7088f9eeb9468b14efb2773fde5f55fd5c95a489
* build: Upgrade grunt-banana-checker from 0.6.0 to 0.7.0 and make passJames D. Forrester2019-04-301-0/+1
| | | | Change-Id: I4c604ab50caeffc5738c719c17f19e769082376f
* eslint: Enable cachingEd Sanders2019-02-191-1/+2
| | | | | | Makes re-running eslint faster on dev environments. Change-Id: I3bd7932b49de35022898cdc8add1934633e6dacb
* build: Use headless Chrome and Firefox for QUnit testingTimo Tijhof2019-02-101-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also: * Remove "watch" task from Gruntfile. This wasn't exposed via npm-run and afaik rarely if ever used. It seems mostly obsoleted by modern editors which perform linting and style guidance as-you-type and on-save. * Remove "chromium" target from karma config, the default target supports both Chromium and Chrome. * Remove unused "default" alias in Gruntfile. Was only accessible if developers installed grunt-cli globally, which we don't require and shouldn't encourage. The new minify task is now exposed as "npm run build". * Remove "test" alias in Gruntfile. Was only used by "npm run test", which now uses "grunt lint" directly, which makes it more clear that these are only linters, and not unit tests. This references T211784 because ensuring no headed browsers are used (which would need Xvfb to start), is a prerequisite for the new Node 10 images. We may still need to provide a slower Xvfb-wrapped variant for some repos, but would be nice of mw-core wasn't one of them. Bug: T211784 Change-Id: I270a16d2b4f799ac7c9f84e9e2ee23806bdbc57e
* build: Add 'svgmin' Grunt task and crush SVGsVolker E2019-02-061-1/+38
| | | | | | | | | | Adding 'grunt-svgmin' package and corresponding 'svgmin' task and also crush SVGs. Several of them are featuring bad UX and are not optimal in many different angles (a.o. clarity, universality, recognizablity etc.). Specifically the 'mediawiki.skinning' ones. But while they are here, let's make them suck less. Change-Id: I8191ceac14565ae31d941982fab1586fa9b6bbdd
* Move exif messages to a separate i18n fileAmir Aharoni2018-12-271-0/+1
| | | | | Bug: T167762 Change-Id: I17900ff07cd9b15f00c7118b4206cf1cdc074469
* eslint: Turn on reportUnusedDisableDirectivesEd Sanders2018-12-141-0/+3
| | | | Change-Id: I3fb88324ba5a46e44041c13eb6447c8e33f4e79b
* skins: Remove redundant mediawiki.hidpi scriptTimo Tijhof2018-06-251-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an internal script automatically loaded by Skin.php to activate the 'jquery.hidpi' polyfill for all images on the current page in browsers that don't natively support the 'srcset' attribute on the HTML img element. This script is loaded via ResourceLoader for which Grade A currently requires: > IE11+/Edge, Chr 65+, Ff 52+, Saf 5+, Op 15+, iOS 6+, Android 4+. According to MDN and CanIUse, the basic 'x' syntax of srcset is supported, and enabled by default, in: > Edge, Chr 34+, Ff 38+, Saf 7+, Op 21+, iOS 8+, Android 5+. This means in the following browsers, MediaWiki will no longer attempt to replace images in articles with their hidpi versions. | Browser | analytics.wikimedia.org (22 May - 22 June) | ---------------------- | ----------------------- | IE 11 on Windows <= 7 | 3.4% (OS does not support HiDPI) | IE 11 on Windows 8+ | 1.1% | Safari 5 & 6 (desktop) | <0.1% | Opera 15-20 (desktop) | <0.1% | iOS 6 & 7 (mobile) | 0.1% | Android 4 (mobile) | 0.5% While the total of 1.7% is higher than our usual point where we decide to remove support, I think we should consider dropping the hidpi polyfill still for several reasons: * MobileFrontend no longer uses 'srcset' attributes. As such, these browsers don't actually change their behaviour based on the polyfill. * For IE 11/Win8 in particular, most users don't have an HiDPI monitor, but we still download the polyfill. HiDPI on Win8 is primarily tablets. * In all cases where the polyfill activates, we download the HiDPI images in addition to the standard resolution (which downloads and renders first). This is because client-side JavaScript is not able to replace it sooner. This could be considered a waste of bandwidth, as it can double or tripple the bandwidth cost for end users. This also means pages complete their loading much later because the browser first renders the page nearly to completion with standard resolution images, and only at the end our polyfill activates to restarts all image loading. The experience gracefully falls back to normal web rendering, where the standard resolution of the image is used. This would match what users of these devices see on other websites, given client-side emulation of srcset is fairly rare. == Modules The 'mediawiki.hidpi' module was removed, and considered internal to Skin.php. It contained no public methods. I confirmed there were no matches in Codesearch, and no matches in mwgrep on Wikimedia wikis. I did not remove 'jquery.hidpi', which is what contains the actual polyfill and the jQuery.fn.hidpi() public method. (Codesearch shows 2 extenisons using it, and mwgrep returned 1 unused gadget on Meta-Wiki referencing it). It has been kept, but marked as deprecated. To be removed in a future release. Bug: T127328 Change-Id: I42ce0feea1fbfe534f00e05a7cd8d81df0c33d8f
* Remove the unused 'jquery.farbtastic' moduleTimo Tijhof2018-05-231-1/+0
| | | | | | | | | | | | | | | | This was added in (r99923; 4d8c7e96ed1f) while reviewing the 'gadget-preferences' branch in SVN of the Gadgets extension during development of MediaWiki 1.18, intended for use in a color picker on Special:Gadgets as part of an experimental feature that was never completed (r94051). The module has no usage anywhere in Wikimedia Git, nor in any third-party hosted repos indexed by MediaWiki Codesearch, nor anywhere on-wiki at WMF in site scripts (per mwgrep). Bug: T193826 Bug: T192623 Change-Id: I8ed6c09dc7efd750ad4688b895b2e3f808a0e52b
* resources: Move the remaining src/mediawiki/ filesTimo Tijhof2018-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | Single-file modules to src/, the remaining as sub directories. A few highlights: * mediawiki.Upload.BookletLayout. (stylesheet: no image references) * mediawiki.feedback - Also move the image to its own images/ subdir. * mediawiki.searchSuggest. (stylesheet: no image references) * mediawiki.toc. (stylesheet: no image references) Also updated any other references to 'src/mediawiki/' that I could find in core: * Fixed references in docs/uidesign/*.html * Remove redundant exclude from jsduck.json. After this, there are 4 files remaining in src/mediawiki, which are the 4 files used by the actual 'mediawiki' base module. Bug: T193826 Change-Id: I8058652892a78b3f5976397bd850741dd5c92427
* jsjpegmeta: Move export patch to a separate fileTimo Tijhof2018-05-041-1/+1
| | | | | | | | | | Keep the main file in src/ for now, because it's got some whitespace changes and a closure-wrap that make it differ from upstream's version. Those changes are hard to review both for diffing and for functional differences due to its odd-looking scope assignments that I'd rather not change as part of this. Change-Id: I248831cfa984432d0a30aa923a9bcd98029b05c4
* selenium: Run wdio directly without gruntTimo Tijhof2018-04-301-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Doesn't seem to add anything, except complexity. This has the benefit of matching more closely the way the README recommends running individual tests. Also add a check for 'chromedriver' before running it. Normally the -e and pipefail would suffice, but because it runs in the background, the error can be buried, hard to find, or even not cause exit code to be set properly. Thus, do a simple 'hash' check that will print a useful command and exit cleanly. Before: > $ something & > [1] 57922 > -bash: something: command not found > [1]+ Exit 127 something > $ echo $? > 0 After: > $ hash something > -bash: hash: something: not found > (exit: 1) $ echo $? > 1 Change-Id: Id95f18927b5443defe679a77a82c5cbdd127c716
* selenium: Remove Jenkins configuration fileŽeljko Filipin2018-04-131-8/+1
| | | | | | | | | | | Both Mocha and Cucumber tests should run. Since WebdriverIO supports only running one test framework, the only way to do it is to have a generic configuration file and two framework-specific files (Mocha, Cucumber). Having Jenkins configuration file complicates things, and there is no need for it. Bug: T179190 Change-Id: I710066f7b5479dcad27aa57cd61007c1c2d88931
* build: Add grunt target for 'karma:firefox'Timo Tijhof2018-02-121-2/+2
| | | | | | | | The 'karma:more' doesn't seem particularly useful, but the ability to run Firefox from a preset seems more useful. Especially from CI in Travis where one might want to use only one or the other. Change-Id: I522295298888e8566781d81fa14dd08368bf0ce4
* build: Update stylelintEd Sanders2017-10-271-3/+0
| | | | Change-Id: I5a0ccb26a54109e641fd121c6427a71e82e05c74
* Gruntfile.js: Remove obsolete eslint omissionsArlo Breault2017-08-031-2/+0
| | | | | | | | * Should have been part of, I4488402686c8b9fefa0af5fed3c9a4b83cbff798 I95400637d1b85d2c607cd91bcb39ce21733295c8 Change-Id: I0546ba007d0a328504e359ade6a1e660387a0645
* build: Update karma to 1.5.0, karma-firefox-launcher to 1.0.1Paladox2017-04-151-1/+4
| | | | | | | | | | | | | | | | | | | | karma: Changelog at https://github.com/karma-runner/karma/releases https://github.com/karma-runner/karma/compare/v1.1.0...v1.5.0 karma-firefox-launcher: Changelog at https://github.com/karma-runner/karma-firefox-launcher/blob/master/CHANGELOG.md#101-2017-03-04 https://github.com/karma-runner/karma-firefox-launcher/compare/v1.0.0...v1.0.1 Karma v1.1.1 added use of `<script crossorigin="anonymous">` for the urls it initially loads. While most requests will be done by MW itself directly (and served locally via the proxy at /w/) the initial request cannot come from the proxy and is loaded from wgServer directly. Therefore we need to set crossOriginAttribute=false to override the new default that v1.1.1 introduced. Change-Id: I9f5067b949c0a77e46f47c2a110a7b5df5953fda
* build: karma now reports with mocha formatterAntoine Musso2017-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | The progress reporter is quite nice to avoid spammy output to the terminal, but it is not very human friendly when trying to find out what is breaking. Mocha has a very nice reporting organized as modules and list items for each of the tests: ext.cx.tools.template ✖ Equivalent template exists ✔ Adapting a template not existing in target language ✖ Adapting template having invalid title ✖ Template name and params adaptation using templatedata ✖ Template params adaptation using templateData - English to French ✖ Template params adaptation using templateData - English to Spanish Add karma-mocha-reporter node module and make it the reporter. Change-Id: Ic7d848b45e8e5ad3839d8a2bd822b63838319ad7
* Selenium tests in Node.js using WebdriverIOŽeljko Filipin2017-03-141-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce the WebdriverIO browser testing framework driven by Node.js. The overall intents are: * have MediaWiki core to provide a platform to run tests that is shared between core and the extensions. * phase out ruby driven browser tests eventually. Code is namespaced in sub directory /tests/selenium The 'pages' sub directory provides helper representing a MediaWiki page such as Special:Login and human friendly helpers to interact with the elements. Add Grunt task webdriver:test. Provide a npm script to easily spawn/dispose chromedriver and run above grunt task. wdio.conf.js provides all the configuration. It defaults to point to a MediaWiki-Vagrant installation on http://127.0.0.1:8080. Can be overriden with environment settings as needed. glob patterns (specs) are made absolute paths from MediaWiki root path that let us run the tests either from the root path (eg the npm wrapper or from the tests/selenium directory when invoking wdio directly. wdio assumes they are relative to the current working directory, hence the normalization. wdio.conf.jenkins.js extends the configuration and is used solely for Jenkins. The switch is done from the Gruntfile.js whenever JENKINS_HOME is set. Specially we want junit reports to be generated. Provide a more specific eslint configuration. References: * MALU https://phabricator.wikimedia.org/source/malu/ * T151442 Research WebdriverIO * T151443 Research Nightwatch.js Bug: T139740 Signed-off-by: Antoine Musso <hashar@free.fr> Change-Id: Ibe7a004a120e82af637ab3e31b725de743134c99
* qunit: Make eslint config pass on qunit test filesTimo Tijhof2017-02-221-1/+2
| | | | | | | | | | | | Follows-up c0fb8a8836, I890e6e49b. * Disable 'qunit' env in general source code. And re-declare locally in the few src files that use it properly. * Create separate eslint config for tests/qunit with various rules disabled (e.g. valid-jsdoc and es3-keywords). Change-Id: I37ccec2019de55edfee92697eb80478df7cb6220
* build: Enable use of stylelint-config-wikimedia and make passVolker E2017-02-201-1/+1
| | | | | | | | | | Enabling stylelint-config-wikimedia for Grunt stylelint, which was already introduced in 3bf6f429295e, but has not yet been actively used to enforce Wikimedia CSS Coding Standards. For this first patch nullifying several options, which will be enabled in follow-up patches in order to be easier reviewable. Change-Id: I3859e04797203a64d82206a379dbb320e5e113d5
* build: Fix stylelint glob patternEd Sanders2017-02-201-1/+1
| | | | Change-Id: I2f37668d32d70d72ed493e81af6b521a3bfaedba
* build: Upgrade karma-chrome-launcher to support Chromium on Mac/WindowsAntoine Musso2017-01-121-0/+3
| | | | | | | | | | | | | | | | | | | | | Before karma-chrome-launcher 2.0.0, Chromium was only detected on Linux and as part of the "Chrome" setting. "Chromium" is now recognised as a separate browser and is detected on Mac and Windows as well. https://github.com/karma-runner/karma-chrome-launcher/issues/45 Add a grunt target for Chromium so users may run the following to use Chromium instead of Chrome: grunt karma:chromium Since we keep the default of "Chrome", we'll need an override for CI since we install Chromium there instead of Chrome. Depends on Ie9f906f8 being merged and Nodepool images updated. Bug: T153756 Change-Id: I6ba0d971e7e8c3022d2ab6268ae637688189d768
* build: Karma proxy should convert Host headerAntoine Musso2016-12-231-1/+4
| | | | | | | | | | | | | | | | | | | By default the Karma proxy does requests against 'localhost', however if the target wiki server has strict host validation (e.g. multiple virtual hosts or otherwise strictly verified) then requests may fail since load.php is not found. An example is with MW_SERVER=devwiki.local. MediaWiki-Vagrant and Wikimedia CI are not affected since they use 'localhost' as the virtual host. Set Karma proxy to change the hostname accordingly. Reference: https://github.com/karma-runner/karma/issues/1729 https://github.com/karma-runner/karma/commit/ae05ea4 Bug: T153757 Change-Id: I317d5686aecd1fb6cf6921cdca77670cded85607
* Merge "Remove JSON polyfill, deprecate 'json' module"jenkins-bot2016-11-231-1/+0
|\
| * Remove JSON polyfill, deprecate 'json' modulePeter Hedenskog2016-11-221-1/+0
| | | | | | | | | | | | | | | | | | | | All A-graded browsers now supports JSON so skip the JSON polyfill. Krinkle investigated the current status for 3 months on Wikimedia traffic (T141344#2784065) with support being nearly 100%. Bug: T141344 Change-Id: I8280faf1cbcd876ead2dafae4347b7d46e3e2acb
* | Fix globbing for eslintBrad Jorsch2016-11-221-2/+3
|/ | | | | | | | Grunt's `**` matches symlinks but doesn't follow them, so `**/*.js` matches files that `!extensions/**` doesn't see to exclude. Bug: T151381 Change-Id: I5d8ae6e24f2fa09efc97db871b0c08d4fbc68efd
* build: Replace jscs+jshint with eslintEd Sanders2016-11-151-20/+31
| | | | Change-Id: Id0a23c03aabadfaf2ec705528ae4b3bd0908fa3e
* build: Enforce the rest of the colour-related stylelintsJames D. Forrester2016-05-191-1/+1
| | | | | | | | * Hex colours must be in short form where possible ('fff' not 'ffffff') * Hex colours must be used over named colours ('fff' not 'white') * Hex colours must be valid ('fff' not 'ffq') Change-Id: I2ba04cc3ad9898c17fee3c65bb3bead834c3a1fd
* build: Introduce stylelintJames D. Forrester2016-05-191-2/+9
| | | | | | | | | | | Initially, with just a single rule to make this a smaller change that we can incrementally extend up to the full Wikimedia coding conventions preset; namely, forcing hex references to colours to be in lower-case. Note the odd src definition to avoid referring to mediawiki.less the directory in the glob. Change-Id: I34f0c8e3c8280e3fce0aa22d7537100b850cbb8d
* build: Enable karma debug log and use progress reporterAntoine Musso2016-01-151-1/+2
| | | | | | | | Should help diagnostic of QUnit failures such as: Error: Pending AJAX requests: 0 (active: 1) Change-Id: I0ed1c8f0c26d49fa13dab2d9de20181d48ee2932
* build: Upgrade grunt-banana-checker from v0.3.0 to v0.4.0James D. Forrester2015-10-121-3/+1
| | | | | | Take opportunity to drop no-longer-needed options. Change-Id: I11250c12d2123d4729e12cd0dce07b24fc5008e5
* build: Upgrade grunt-banana-checker to v0.3.0James D. Forrester2015-09-071-0/+5
| | | | | | | Disable disallowBlankTranslations, disallowDuplicateTranslations and disallowUnusedTranslations for now as they fail so much. Change-Id: I52e1555335a6e64b1e9db541ba726cf6ce8c7dd0
* build: Enable jscs rules 'requireSpacesInside*Brackets' and make passJames D. Forrester2015-09-051-3/+3
| | | | Change-Id: I1cd5b9b92b6e9419d99d9a15ad88a996253ca4cf
* build: Enable jscs rule 'requireSpacesInsideParentheses' and make passJames D. Forrester2015-09-031-1/+1
| | | | Change-Id: Ie88c89344e54657f007e5101472e667be5408319