Commit graph

86 commits

Author SHA1 Message Date
Stephen Niedzielski e2cce6883a Hygiene: improve jQuery JSDoc type checking
Add jQuery types. The JSDocs use TypeScript-compatible typing but tools
such as Visual Studio Code and WebStorm requires the definitions be
supplied. Popups will require these definitions to enable any future
automated type checking too.

Change-Id: I27b5cb052c5ad353322181b0f0ffa4fa56ac1d9f
2019-02-11 15:02:10 -07:00
Ed Sanders e1c4e94b23 build: Update eslint-config-wikimedia to 0.10.0
Also enable jquery ruleset.

Change-Id: Ie1f43d0335ea2aad1e2dd5d86b775316105c3d90
2019-01-31 11:05:33 +01:00
Stephen Niedzielski 6859d6f828 Hygiene: rename NPM test:node to test:unit
Rename the NPM test:node script to test:unit for consistency with
MobileFrontend.

Change-Id: I7329592ab5b375d816cd36a28a04cbe1d8f044a5
2019-01-24 08:29:27 -07:00
Thiemo Kreuz 671c39ef4a Add reference preview type
This adds support for preview popups on reference/footnotes from
the Cite extension. For that a new preview type was introduced and
integrated into the existing structures.

The essential starting points were this code comes into action are
added behind the feature flag introduced in the previous patches.

Bug: T213415
Change-Id: Ie0ccb03117bd654373d0f458b62cc52018361c67
2019-01-23 12:12:36 +01:00
Thiemo Kreuz 3b846cd472 Introduce TYPE_REFERENCE constant in advance
This is split from the current draft patch Ie0ccb03. This is part of a
series of very small patches that prepare the code for new types of popups.

Bug: T213415
Change-Id: I4f4392057f6d3eff78409c8b6f49898c8be45d3e
2019-01-17 17:13:55 +00:00
Nicholas Ray 63031429b8 Upgrade redux / redux-thunk
redux       | 3.6.0 | 4.0.1
redux-thunk | 2.2.0 | 2.3.0

Upgrading these two dependencies caused the build size to increase from
from 12.2 KB to 12.4 KB (gzip) and so the bundlesize was adjusted
accordingly in our package.json.

Additionally, our linters flagged two rules that were then turned off in
.eslintrc.es5.json.

Looks like the changes in Redux were mostly cosmetic with much work
dedicated to typescript definitiions and dropping support of private
imports [1].

The changes to redux-thunk only involved changing typescript typings and
should not affect us. [2]

The upgrade was tested locally and did not appear to break anything.

[1] https://github.com/reduxjs/redux/issues/1342#issue-130452197
[2] https://github.com/reduxjs/redux-thunk/releases/tag/v2.3.0

Bug: T209314
Change-Id: I35284793ca0c72914d9b9b2e7c28dd407bafd4d8
2018-12-13 15:04:03 -07:00
Nicholas Ray 0c1a65f39d Upgrade webpack / webpack-cli
webpack     | 4.1.1  | 4.27.1
webpack-cli | 2.0.12 | 3.1.2

The upgrade of webpack modified our build files and included these
side effects:

* Our linter flagged the usage of bitwise operators in the build files
so I turned that off in our build file lint config (.eslintrc.es5.json)

* Our build file's size increased slightly from 12.1 KB to 12.13 KB
(gzip) so the package.json's bundlesize was updated accordingly.

No deleterious effects were noticed to popups running locally, but the
jump in webpack version included these notable changes:

* Switch from uglify-es to terser minimizer [1]

[1] https://github.com/webpack/webpack/releases/tag/v4.26.0

The upgrade for webpack-cli was a major version jump, but the params
that we pass to it in our package.json file appear to work as before.

Bug: T209314
Change-Id: I1403f2c4d354cf54554a740f8c23176bf80fd3c6
2018-12-13 14:53:54 -07:00
Nick Ray 15cc402343 Upgrade webdriverio / wdio-spec-reporter
wdio-mocha-framework | 0.6.1  | 0.6.3
wdio-spec-reporter   | 0.1.4  | 0.1.5
webdriverio          | 4.13.1 | 4.14.1

Selenium tests were tested locally with these upgrades and passed.

Note: I had some difficulty in upgrading wdio-mocha-framework to the
latest version 0.6.4 on my mac os (10.14) and experienced a `'utility'
file not found` error when npm installed the 'fibers' package. This
appears to be a known problem relating to node-gyp and older versions of
node. [1] Running the following suggested command [2] worked
for me:

`CXXFLAGS="-mmacosx-version-min=10.9" LDFLAGS="-mmacosx-version-min=10.9" npm i`

However, it was a hassle. Therefore, I chose to upgrade to only
0.6.3 in which this problem doesn't occur.

[1] https://github.com/nodejs/node-gyp/issues/1564
[2] https://github.com/nodejs/node-gyp/issues/1564#issuecomment-436609523

Bug: T209314
Change-Id: I0657ca5db4747b4ebb7aa0d01e2aeb97d6b2a7d0
2018-12-13 14:17:38 -07:00
Nick Ray 9975bbc4b4 Replace husky dependency with pre-commit
MobileFrontend uses the npm package 'pre-commit' to execute pre-commit
hooks but Popups was using 'husky'. This commit rectifies that for
consistency.

Bug: T209314
Change-Id: I56e841d6dc6739ffe040cb930ddf0ebce3905a9f
2018-12-13 14:17:06 -07:00
Nick Ray 2ed5587945 Upgrade stylelint-config-wikimedia and remove stylelint
The following upgrade was made:

stylelint-config-wikimedia | 0.4.3 | 0.5.0

The upgraded version stylelint-config-wikimedia includes stylelint as a
dependency (no longer a peer dependency) [1] so our stylelint dependency was
removed.

As a result of this upgrade, several of our .less files were flagged by
the linter and corrected in this patch.

[1] https://github.com/wikimedia/stylelint-config-wikimedia/blob/v0.5.0/package.json#L36

Bug: T209314
Change-Id: Ic6d4b1caf60f4e03fa60076a2ae74d6639117f25
2018-12-13 14:16:23 -07:00
Nick Ray c64497e5df Upgrade elint-config-wikimedia (drop eslint-plugin-qunit)
The following upgrade was made:

eslint-config-wikimedia | 0.8.1 | 0.9.0

The upgrade of eslint-config-wikimedia removes the need of
eslint-plugin-qunit as a peerDependency because it is now a hard
dependency [1] so it was removed in our package.json.

It appears the biggest change in the upgrade was the use of separate
profiles [2]. Given this, our root .eslintrc.json was updated to extend
from 'wikimedia/client'.

Several test files were flagged by the upgraded linter and were fixed in
this patch. Additionally, our build file was flagged for having too many
statements on one line. This rule was turned off in .eslintrc.es5.json

[1] https://github.com/wikimedia/eslint-config-wikimedia/blob/master/package.json#L48
[2] https://github.com/wikimedia/eslint-config-wikimedia/blob/master/CHANGELOG.md#090--2018-11-19

Bug: T209314
Change-Id: I29db72e77f04a327bc9c2b558c6d53849287bb80
2018-12-13 14:12:06 -07:00
Nick Ray 1594374fe2 Upgrade bundlesize, clean-webpack-plugin, grunt-contrib-watch, nyc
The following upgrades were made:

bundlesize           | 0.15.3 | 0.17.0
clean-webpack-plugin | 0.1.19 | 1.0.0
grunt-contrib-watch  | 1.0.1  | 1.1.0
nyc                  | 12.0.2 | 13.1.0

These potentially breaking changes were listed for nyc (but were not
observed):

* "--hook-run-in-context, and --hook-run-in-this-context are no longer
true by default (they should be enabled if you're using a library like
requirejs)."[1]

[1] https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md#breaking-changes

Bug: T209314
Change-Id: Iaf705d4e6cdde1e3d3103f1c154a8fb172815535
2018-12-13 13:09:24 -07:00
Shreyas Minocha 22226f3367
Switch from babel-preset-env to @babel/preset-env
Replace:
    - babel-preset-env@1.6.0 with @babel/preset-env@7.2.0
    - babel-register@6.24.1 with @babel/register@7.0.0
    - babel-loader@7.1.4 with babel-loader@8.0.4

Add:
    - @babel/core@7.2.0

---

- babel-preset-env, @babel/preset-env
  babel-preset-env moved to @babel/preset-env in the Babel monorepo.
  This appears to have incremented the version from v1.6.0[0] to 7.x to
  match the rest of the Babel packages but appears to otherwise be
  undocumented.[1,3]

  [0] https://github.com/babel/babel-preset-env/blob/24b99ec/README.md
  [1] https://github.com/babel/babel/blob/efa571a/CHANGELOG.md

- @babel/preset-env, @babel/register
  *Many* changes as identified by package [2] and summarized [3].

  Node.js v6 or above now required.

  New dependency on @babel/core.

  Support for ES2018 and browserslist v4.

  `modules: false` is now the default for preset-env + babel-loader. The
  .babelrc has been updated.

  New babel-upgrade tool.

  babel.config.js can replace .babelrc. Popups doesn't seem to need it.

  TypeScript and JSX fragment support.

  [2] https://github.com/babel/babel/blob/efa571a/CHANGELOG.md
  [3] https://babeljs.io/blog/2018/08/27/7.0.0

- babel-loader
  Support for Babel 7.x.

  The following warning is printed when building but perhaps this is due
  to another dependency:

    (node:14559) DeprecationWarning: loaderUtils.parseQuery() received a
    non-string value which can be problematic, see
    https://github.com/webpack/loader-utils/issues/56 parseQuery() will
    be replaced with getOptions() in the next major version of
    loader-utils.

  https://github.com/webpack/loader-utils/issues/56#issuecomment-286117000
  https://github.com/babel/babel-loader/releases/tag/v7.1.5
  https://github.com/babel/babel-loader/releases/tag/v8.0.0-beta.0
  https://github.com/babel/babel-loader/releases/tag/v8.0.0-beta.1
  https://github.com/babel/babel-loader/releases/tag/v8.0.0-beta.2
  https://github.com/babel/babel-loader/releases/tag/v8.0.0-beta.3
  https://github.com/babel/babel-loader/releases/tag/v8.0.0-beta.4
  (v8.0.0-beta.5 was erroneous.)
  https://github.com/babel/babel-loader/releases/tag/v8.0.0-beta.6
  https://github.com/babel/babel-loader/releases/tag/v8.0.0
  https://github.com/babel/babel-loader/releases/tag/v8.0.1
  https://github.com/babel/babel-loader/releases/tag/v8.0.2
  https://github.com/babel/babel-loader/releases/tag/v8.0.3
  https://github.com/babel/babel-loader/releases/tag/v8.0.4

Bug: T197883
Change-Id: Ie3a5404630fde87ea7fe618a842950ed8c0c6494
2018-12-11 13:09:45 +05:30
Stephen Niedzielski a24bbe76e6 Hygiene: use source-maps for dev builds not eval maps
Webpack's `-d` option is an alias for
`--debug --devtool cheap-module-eval-source-map --output-pathinfo`[0]
which overrode the `devtool` specified in the config. Specify
`--mode=development` which appears to be better supported than `-d`,
although the distinction is poorly documented[1]. The build products are
identical for `--mode=development --debug --output-pathinfo` and simply
`--mode=development` so the latter is used.

For consistency, replace `-p`, an alias for
`--optimize-minimize --define process.env.NODE_ENV=production`[0],
where `--optimize-minimize` is documented[2] as:

  Minimize JavaScript and switches loaders to minimizing UglifyJsPlugin
  and LoaderOptionsPlugin.

With `--mode=production` which is documented[3] as:

  Sets process.env.NODE_ENV on DefinePlugin to value production. Enables
  FlagDependencyUsagePlugin, FlagIncludedChunksPlugin,
  ModuleConcatenationPlugin, NoEmitOnErrorsPlugin,
  OccurrenceOrderPlugin, SideEffectsFlagPlugin and UglifyJsPlugin.

This change has already been made to MobileFrontend in c10f87d89.

[0] https://webpack.js.org/api/cli/#shortcuts
[1] https://medium.com/webpack/webpack-4-released-today-6cdb994702d4#dfa8
[2] https://webpack.js.org/api/cli/#optimize-options
[3] https://webpack.js.org/concepts/mode/#usage

Change-Id: I7a7ffc913592f0b18e091bb219a7fc75873d4d7a
2018-11-16 13:17:46 -07:00
Ed Sanders c74d2e5313 build: Update linters
Bug: T202739
Change-Id: Ie3f68977598f46f7e12b216f8381b2e9dc6d83ad
2018-09-11 10:26:35 -07:00
Antoine Musso 99d0092096 QA: add missing wdio-junit-reporter
tests/selenium/wdio.conf.js defines a Junit reporter but it is not
installed when running the suite directly from the extension.

Bug: T203591
Change-Id: Idf192506d0af01abbfea479223a3bbcfc5eef4ea
2018-09-06 16:08:44 +02:00
jenkins-bot ddc705c664 Merge "Selenium: add selenium-daily NPM script" 2018-09-06 08:20:04 +00:00
jdlrobson 04afdd4741 Update package.json to ensure assets get built on every commit
diffs now correctly output errors. This will pick up changes to
index.js and index.js.json that have not been committed

--exit-code is passed to ensure that if there are changes then an
error is thrown and the action is not allowed.

The dist folder became out of date as depending on what version
of node you run, the output is different.

To aid debugging, the script that checks the diff now outputs the
node version and the npm version. From now on, we will all have
to use the same node version to build assets.

This is annoying, but we will re-evaluate the approach we are taking
to build assets in T202743. We can easily work around this by all using
nvm and making consistent use of the same node version.

The assets have been rebuilt with the node version that CI uses.

Bug: T202748
Change-Id: I82aee879d4b04ca06447f95eb81230bfc24d20e9
2018-09-05 13:36:39 -06:00
Željko Filipin c578de27d8 Selenium: add selenium-daily NPM script
The script is needed to run the new Docker-based Jenkins job that runs daily and targets beta cluster.
selenium-test script and NPM packages are dependencies. selenium-daily now just calls selenium-test.

selenium-daily might seem redundant, but it provides flexibility. In case a
repository does not want to run all tests daily, that's easily fixed by updating the
selenium-daily script.

Bug: T188742
Change-Id: I35c93ff1897afc4b9e66703a1acf765e3fe7b643
2018-09-05 19:16:12 +00:00
Volker E f47e333ff1 build: Bring SVGO optimization to build step
Enabling SVGO automation with 'grunt-svgmin' and conservative
plugin settings to build step, among those:
- enable removeRasterImages and sortAttrs,
- disable cleanupIDs, removeDesc, removeTitle, & removeViewBox as
  described in
  https://www.mediawiki.org/wiki/Manual:Coding_conventions/SVG#Exemplified_safe_configuration
- disable removeXMLProcInst; if the SVG doesn't start with an XML
  declaration, then it's MIME type will be detected as "text/plain"
  rather than "image/svg+xml" by libmagic and, consequently, MediaWiki's
  CSSMin CSS minifier. libmagic's default database currently requires
  that SVGs contain an XML declaration:
  <https://github.com/threatstack/libmagic/blob/master/magic/Magdir/sgml#L5>.
- make use of pretty and multipass options.

Settings are stored in a JSON file to be independent of the Grunt build
process. Also updating SVG accordingly.

Bug: T185596
Change-Id: I715ad4cf2e900665e4c32c78b4c2d9d9cebf0222
2018-08-01 10:51:43 -05:00
Piotr Miazga c823a0e6cb When request gets aborted it shouldn't finish with FETCH_FAILED
Whe user moves mouse away and we abort the http request we shouldn't
count that request as a FETCH_FAILED. The reasoning behind is that
FETCH_FAILED state increments the counter.PagePreviewsApiFailure.
Our StatsD graph gets polluted with lots of aborted requests and it
becomes unsuable. It doesn't show only the failed requests.

Changes:
 - introduced new state: FETCH_ABORTED
 - switch to FETCH_ABORTED when browser aborts the request

Bug: T199482
Change-Id: I58047eb80f0700b78b2991daff9395ecc92553b8
2018-07-13 16:52:53 +02:00
jdlrobson 10e6e25091 Upgrade eslint-config-wikimedia
* Force arrow-parens
* Disable no-prototype-builtins for time being
* Drop unnecessary maxlen rule

Change-Id: Iceb0fe47354a5753202d2c6ad9e1a9c76791f744
2018-07-13 07:42:12 -05:00
Stephen Niedzielski 2d150f0aad Hygiene: update mw-node-qunit dependency package
mw-node-qunit has moved to a new NPM package, @wikimedia/mw-node-qunit.
There are no functional changes with this release but dependencies
should be kept up to date.

https://github.com/wikimedia/mw-node-qunit/blob/9a368a1/CHANGELOG.md#500

Bug: T197251
Change-Id: I25bfc541551cbc29812985df7fa05dc17f0338c5
2018-06-29 17:30:03 +00:00
Stephen Niedzielski 823b6af879 Hygiene: replace tap-dot reporter
The tap-dot executable crashes on some test failure outputs.[0] This is
confusing since a test failure in itself often requires debugging. The
issue is present from v1.0.1 to the latest, v2.0.0.

Instead of downgrading, replace tap-dot with the popular
tap-mocha-reporter. This change comes with a bonus: console.log is no
longer filtered out. The benefit cannot be overstated.

[0]: https://github.com/scottcorgan/tap-dot/issues/9

Change-Id: I4ce2d2816885b7c5214f5c1863be595be0d8b1aa
2018-06-27 09:16:07 -05:00
Stephen Niedzielski 36741c96c8 Hygiene: don't auto-add on pre-commit
Since it can be unexpected for a pre-commit hook to make edits to the
commit, leverage the existing tests to simply verify that the proper
files have been staged. This also slightly simplifies the existing NPM
scripts and forces the dev to run the same test about to be executed CI,
`npm test` itself, which previously had no other automation tie in.

Change-Id: I74e407ea17a6c2809a49ba56d3ef28b25d5ba5de
2018-06-20 09:40:47 -05:00
Stephen Niedzielski c2a37d75e2 Hygiene: remove doc:start script
The `doc:start` NPM script simply runs the `doc` script whenever a
change is detected. It doesn't seem especially useful for standard
development and adds an extra nodemon depedency. This patch removes the
script and nodemon.

Change-Id: Ib679f6d83bd10f0b8d1572c07080fba7f8d6a701
2018-06-20 09:36:53 -05:00
Stephen Niedzielski 95047ba360 Fix: code coverage
Replace Istanbul with nyc, Istanbul's CLI. nyc appears to have some
bugs that this patch works around:

  - When all files in the project are considered, not just those
    imported via tests, the coverage rates and line numbers vary between
    runs. This patch disables the `all` option for now and points to the
    bug:
    https://github.com/istanbuljs/nyc/issues/537#issuecomment-390814662.

  - Source map line numbers appear to be incorrect except when `all` is
    enabled and working correctly (see previous bullet).

  - `sourceMap` must be disabled to avoid ENAMETOOLONG errors when nyc
    tries to include them as encoded strings. The patch disables the
    setting and points to: https://github.com/istanbuljs/nyc/issues/847.
    Using babel-plugin-istanbul and source-map-support appears to have
    no effect (the former in tests/node-qunit/run.js and .babelrc).

  - CI fails with
    `Error: EACCES: permission denied, mkdir '/nonexistent'`. Specify
    `SPAWN_WRAP_SHIM_ROOT` instead of constructing a subdirectory from a
    nonexistent home directory.

Bug: T196952
Bug: T193519
Change-Id: Idf2e3accd4a6277cbef91c1156fcd206c9e7d882
2018-06-19 18:10:02 -05:00
Stephen Niedzielski fe2c3b23ee Hygiene: replace call to rm with clean-webpack-plugin
The invocation of `rm -rf resources/dist` in package.json
(`check-built-assets`) is replaced with clean-webpack-plugin.
The benefit of this change is that calling `npm run build` now works the
same as the `check-built-assets` script.

Bug: T193522
Change-Id: I64f048855ddceb7159279671b2174a7937e169ff
2018-06-18 09:09:28 -05:00
James D. Forrester a678df93a0 build: Bump lint devDependencies to lastest
grunt                          1.0.1  →    1.0.2
 grunt-contrib-watch            1.0.0  →    1.0.1
 grunt-stylelint                0.9.0  →   0.10.0
 nodemon                       1.11.0  →   1.17.3
 stylelint                      8.2.0  →    9.2.0
 stylelint-config-wikimedia     0.4.2  →    0.4.3

Avoid old (very up) upstream's security issue from nodemon.

Change-Id: I3dcf94746b4383baeae4fe6e2bf95c5da5b87db1
2018-05-01 10:35:23 -05:00
joakin 3c63686da7 Chore: Upgrade mw-node-qunit to 4.0.0
* https://github.com/joakin/mw-node-qunit/blob/master/CHANGELOG.md#400
  * Rely on the CLI runner from qunit
  * Fix testing require and global mediaWiki not asserting anything

The test numbers is not reported by test, instead of by assertion like
it was before because the official qunit tap reporter does that. But the
numbers are correct.

Change-Id: I38d4b5007902ecbef2e2007966fafc4bb88703f6
2018-04-17 09:21:47 -05:00
joakin 4e639b09d4 Update mw-node-qunit to 3.1.0
* 3.1.0
  * Added CONTRIBUTING.md
  * Update jsdom from 11.3.0 to 11.7.0
  * Upgrade jQuery from 3.2.1 to 3.3.1
  * Update QUnit from 2.4.1 to 2.6.0
  * Update prettier, fix formatting glob

* Commits https://github.com/joakin/mw-node-qunit/compare/v3.0.0...v3.1.0
* Changelog https://github.com/joakin/mw-node-qunit/blob/master/CHANGELOG.md#310

Change-Id: I16d4e4f86f59f9a2f441c915a31d1f0617b40c82
2018-04-09 11:58:04 +02:00
jdlrobson 3c892ca9f8 Add eslint auto-fixing to Gruntfile
Run `npm run lint:fix` to use

Change-Id: I445c17a57b5f240ddaa48956d7881cc3228eab76
2018-03-27 12:57:40 -07:00
jdlrobson bb2ad2ed38 Up the max asset and entry point sizes
40kb seems a good time to pause and reflect on the total size.
The current maximum is impossible to meet without no further
changes to the code.

12kb is also more flexible than 11.5

Change-Id: I5ee8c236d90542afacc0e8de513a45a15ccd529b
2018-03-27 12:57:17 -07:00
Stephen Niedzielski c4b50b04ac Hygiene: remove unused resources
In I7395e3438836149becdd576942bdaf6f21b4163f the settings templates
were rewritten so that they no longer displayed an image.

descriptionText and images were dropped from the template but not from
the template provider. These are artifacts from relating to that patch
and are no longer used.

Change-Id: I1be7ef288d37f338e83dab3cf041e628a06608d2
2018-03-21 17:07:18 -05:00
Stephen Niedzielski 18f5c3d060 Fix: erroneous build product diffs
When resources/dist was removed or modified, the diff check erroneously
complained that the resources differed. This could be resolved by simply
running the tests again. This patch fixes the issue by leveraging Git to
do the diffs which eliminates the need for a temporary test-build
directory and has the side-effect of improving the grep experience for
the repo.

Change-Id: Idf33f4d52aab6a2907debf6a7d6c7be5c83d9ee6
2018-03-21 08:08:14 -05:00
Stephen Niedzielski e284163014 Hygiene: use consistent ESLint severity syntax
Bug: T165036
Change-Id: I43a500fceb8179d30240dbec8ed56f8d4c7551e9
2018-03-21 10:45:09 +00:00
Stephen Niedzielski 0bee0906d4 Hygiene: replace var with let and const
eslint \
    --cache \
    --max-warnings 0 \
    --report-unused-disable-directives \
    --fix \
    src tests

Change-Id: I051275126ae7fa9affd16c2504017c0584f2d9c7
2018-03-20 14:14:02 -05:00
Stephen Niedzielski 5872c8376d Fix: JSDoc Node.js file copy bug
Upgrade JSDoc from v3.4.3 to 3.5.5:
- v3.5.0 JSDoc can parse any JavaScript that is supported by Babel
  compiler.
- v3.5.1 fixes an incompatibility bug in Node.js < v5.10.0
- v3.5.5 fixes an incompatibility bug in Node.js v8.5.0

Prior to this change, object shorthand caused the following errors:

  jsdoc -c jsdoc.json
  fs.js:1979
    binding.copyFile(src, dest, flags);
            ^

  Error: EISDIR: illegal operation on a directory, copyfile '/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/static/fonts/OpenSans-Bold-webfont.eot' -> 'doc/autogenerated/fonts'
      at Object.fs.copyFileSync (fs.js:1979:11)
      at /home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/publish.js:471:12
      at Array.forEach (<anonymous>)
      at Object.exports.publish (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/publish.js:468:17)
      at Object.module.exports.cli.generateDocs (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:430:39)
      at Object.module.exports.cli.processParseResults (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:383:20)
      at module.exports.cli.main (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:227:14)
      at Object.module.exports.cli.runCommand (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:180:5)
      at /home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/jsdoc.js:103:9
      at Object.<anonymous> (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/jsdoc.js:104:3)
      at Module._compile (module.js:662:30)
      at Object.Module._extensions..js (module.js:673:10)
      at Module.load (module.js:575:32)
      at tryModuleLoad (module.js:515:12)
      at Function.Module._load (module.js:507:3)
      at Function.Module.runMain (module.js:703:10)

https://github.com/jsdoc3/jsdoc/releases/tag/3.5.0
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.1
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.2
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.3
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.4
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.5

Bug: T165036
Change-Id: Ic7a22b6992d45fa0ea3d011a9ad5200d7cc73b80
2018-03-20 09:24:06 -05:00
Stephen Niedzielski 3c3f162226 Fix: pin package versions to patch revision
CI doesn't use a version of NPM that reads package-lock files which
seems to break some build product diff checks.

Bug: T165036
Change-Id: I29383c1a5c1f7f102fe458ac778adc3bf264c9fd
2018-03-20 09:22:43 -05:00
Stephen Niedzielski 42816702eb Hygiene: replace Mustache templates w/ ES6 strings
Replace Mustache.js templates with template literals. An effort was made
to minimize additional refactoring, so feel free to ask for more but it
ain't coming in this PS.

Bug: T165036
Change-Id: I4a6a1d93a2922c3a9ef3ae93c47da17a35c644f0
2018-03-20 08:06:02 -05:00
Stephen Niedzielski e5df865d51 Hygiene: enable Babel transpilation
Enable the Babel transpiler so that ES6 template literals,
destructuring, and arrow functions can be used in production.
"last n versions" syntax was not used so that builds are more
reproducible.

Bug: T165036
Change-Id: I553b6d14cc368c7b4366f68d13038c3d505f5429
2018-03-20 07:59:14 -05:00
Stephen Niedzielski d35286a064 Update: upgrade to Webpack 4 & improve output size
Upgrade from Webpack v2.0.12 to v4.1.1. There have been many changes to
Webpack... Noticeable in the bundle size is that a number of files are
now inlined and generally minification is improved.

Changes related to the upgrade include:

- Remove unsupported UglifyJS options which link back to T188081. These
  appear to have been anticipatory but never acted on and it isn't clear
  whether they even worked or not.
- Pass the -p plag for production optimizations; pass the -d flag since
  production doesn't support watching.
- NamedModulesPlugin is now on by default but only in development mode
  so no change was made.
- Webpack command line client now must be installed separated and
  appears in package.json as webpack-cli.

https://github.com/webpack/webpack/releases/tag/v2.2.0
https://github.com/webpack/webpack/releases/tag/v2.2.1
https://github.com/webpack/webpack/releases/tag/v2.3.0
https://github.com/webpack/webpack/releases/tag/v2.3.1
https://github.com/webpack/webpack/releases/tag/v2.3.2
https://github.com/webpack/webpack/releases/tag/v2.3.3
https://github.com/webpack/webpack/releases/tag/v2.4.0
https://github.com/webpack/webpack/releases/tag/v2.4.1
https://github.com/webpack/webpack/releases/tag/v2.5.0
https://github.com/webpack/webpack/releases/tag/v2.5.1
https://github.com/webpack/webpack/releases/tag/v2.6.0
https://github.com/webpack/webpack/releases/tag/v2.6.1
https://github.com/webpack/webpack/releases/tag/v3.0.0
https://github.com/webpack/webpack/releases/tag/v3.1.0
https://github.com/webpack/webpack/releases/tag/v3.2.0
https://github.com/webpack/webpack/releases/tag/v3.3.0
https://github.com/webpack/webpack/releases/tag/v3.4.0
https://github.com/webpack/webpack/releases/tag/v3.4.1
https://github.com/webpack/webpack/releases/tag/v3.5.0
https://github.com/webpack/webpack/releases/tag/v3.5.1
https://github.com/webpack/webpack/releases/tag/v3.5.2
https://github.com/webpack/webpack/releases/tag/v3.5.3
https://github.com/webpack/webpack/releases/tag/v3.5.4
https://github.com/webpack/webpack/releases/tag/v3.5.5
https://github.com/webpack/webpack/releases/tag/v3.5.6
https://github.com/webpack/webpack/releases/tag/v3.6.0
https://github.com/webpack/webpack/releases/tag/v3.7.0
https://github.com/webpack/webpack/releases/tag/v3.7.1
https://github.com/webpack/webpack/releases/tag/v3.8.0
https://github.com/webpack/webpack/releases/tag/v3.8.1
https://github.com/webpack/webpack/releases/tag/v3.9.0
https://github.com/webpack/webpack/releases/tag/v3.9.1
https://github.com/webpack/webpack/releases/tag/v3.10.0
https://github.com/webpack/webpack/releases/tag/v3.11.0
https://github.com/webpack/webpack/releases/tag/v4.0.0
https://medium.com/webpack/webpack-4-released-today-6cdb994702d4
https://github.com/webpack/webpack/releases/tag/v4.0.1
https://github.com/webpack/webpack/releases/tag/v4.1.0
https://github.com/webpack/webpack/releases/tag/v4.1.1

Bug: T165036
Change-Id: Ic146e680d368fee7ee207b484460ce94f8bd7283
2018-03-20 07:55:37 -05:00
Stephen Niedzielski 4eb9c0efa8 Hygiene: move SVG string to file
- Add SVG Inline Loader for Webpack. This allows SVG files to be
  imported.

- Update the Webpack and test configurations to use the new loader.

- Scope the ESLint rules down to just JavaScript files so that linting
  isn't attempted on the SVG.

Bug: T165036
Change-Id: I00bccff4c3167975c19d577be6343dcaca7ddb2d
2018-03-14 12:04:28 -07:00
Jan Drewniak 1e946a379d Custom page preview for disambiguation pages
Creating a different page preview for disambiguation pages.

This patch:
- modifies the Preview model to accept a new 'type' property
- modifies the Restbase Gateway to pass the 'type' prop to the Preview model
- creates a new template to accept both generic/disambig previews
- modifies the renderer to render the new template
- generates icons for new template through resource loader
- adds new i18n strings
- modifies event-logging "preview seen" event to send new "disambiguation" previewType
- updates event logging schema version
- adds tests for Preview model and renderer for new preview type
- does way too much? yes, yes it does.

Bug: T168392
Change-Id: Idc936cc3eabbdd99a3d98f43c66b4cdbb7d24917
2018-03-14 11:24:26 -07:00
Stephen Niedzielski e9e3d59232 Hygiene: only report diff status
When the diff test fails, don't dump 40k characters to console. Just
report that the failure occurred.

Change-Id: I1cc31fcdebe3e1097ed9e80dfbe3fb6e0dfc34b2
2018-03-07 13:58:08 -06:00
Stephen Niedzielski e406d4556f Fix: don't assume thumbnail URLs contain pixel size
Don't assume that thumbnail URLs contain a dimension delimiter of "px-".
Previously, thumbnail URLs always contained the width. e.g.:

  https://upload.wikimedia.org/wikipedia/commons/a/aa/100px-Red_Giant_Earth_warm.jpg

However, thumbnail URLs that actually point to the original are not
sizable:

  https://upload.wikimedia.org/wikipedia/commons/a/aa/Red_Giant_Earth_warm.jpg

These are provided, for example, when the thumbnail size requested is
larger than the original. There was code designed to handle this
scenario but it only applies when RESTBase and page preview thumbnail
sizes happen to be in sync. In other words, if RESTBase requests a large
thumbnail on behalf of page previews, and page previews only requested a
small thumbnail, the original may be unexpectedly provided. A
conditional is introduced in this patch to verify that "px-" is actually
detected. If it is not present, the original is used.

Bug: T187955
Change-Id: If4e29dd870aecd6d461cc8203f6576d1bb8844f2
2018-02-22 12:36:30 -06:00
Jan Drewniak f4d04b95b6 Updating mw-node-qunit to v3
Fixes tests for sinon v4, which is a dependency of mw-node-qunit v3.

Bug: T180255
Change-Id: I8c7b703f81140e06546aa954f98b8766f5225ff5
2018-02-08 12:20:52 +01:00
Ed Sanders 998d7c4f22 build: Update linters
Change-Id: I1af64c55fdd26a2923a1ec20500e97ea13d92bc8
2018-02-04 22:09:45 +00:00
Stephen Niedzielski 7da20008c0 Hygiene: add bundlesize test
This patch adds a production build output gzipped file size check to the
test script so that any future changes may only introduce known size
differences. Note:

• The initial limit was taken from the present gzipped file size rounded
  up to the 10th of a kibibyte.

• JEDEC notation is used. bundlesize internally uses Bytes utility which
  only supports base 2 units.

  https://github.com/visionmedia/bytes.js

Bug: T176211
Change-Id: Ie95f388673b0b982b105fef9a2917513a3307060
2018-01-30 20:04:06 +00:00
joakin 122332c66b Test: Update the test runner dependency
To 2.2 which just updates minor versions of dependencies (jsdom, sinon,
qunit).

See https://github.com/joakin/mw-node-qunit/blob/master/CHANGELOG.md#220

Change-Id: I26e6b060b0124d9f91aaa7ccc1d8be1981e5de1e
2017-11-10 17:10:59 +01:00