Commit graph

184 commits

Author SHA1 Message Date
jenkins-bot 655f08aa8a Merge "Publish coverage file" 2023-06-15 16:38:24 +00:00
Jon Robson bf63e2bc6e Publish coverage file
Context [[mw:Topic:Xk10fxsoqth6scfz]]

Change-Id: Ic99cf9bdffdeb56a6182e650d3878902696c0df0
2023-06-15 08:53:39 -07:00
Volker E 4132ee96ab build: Update SVGO to v3.0.2
svgo         2.8.0  →   3.0.2

Amending to new `cleanupIds` plugin name.

Bug: T339162
Change-Id: I8ad37e46501c36883967827b4d622788ae9065f1
2023-06-14 12:32:01 -07:00
Jon Robson 049729626c IP masked users use localStorage for settings
Bug: T330517
Change-Id: Ib283e37f379e8cccc7f49ab0ce9aadd6535ea668
2023-06-14 08:16:50 -07:00
Jon Robson 580067b94e Discourage jQuery usage in Popups extension
Change-Id: Iff0c81e4c1d78cc52d1bd9d81e24d8fae228c9bc
2023-06-13 15:39:57 -07:00
libraryupgrader faa3c63af8 build: Updating npm dependencies
* grunt-banana-checker: 0.10.0 → 0.11.0
* stylelint-config-wikimedia: 0.14.0 → 0.15.0

Change-Id: Ie2be62f89f01533a83982880a0ea7a2a71405b37
2023-06-02 01:01:00 +00:00
jenkins-bot a38f4c5336 Merge "Prefer native JavaScript to jQuery" 2023-05-26 03:22:52 +00:00
libraryupgrader 32778684af build: Updating npm dependencies
* @wikimedia/codex: 0.10.0 → 0.11.0
* @wikimedia/codex-icons: 0.10.0 → 0.11.0

Change-Id: Ic5218ad62e27900eb6a96461d9aa9126829f70e0
2023-05-24 00:54:43 +00:00
Jon Robson 7c592bc790 Prefer native JavaScript to jQuery
Bug: T315929
Change-Id: I949fd9551269a3cb9d9df7744149510949d3076c
2023-05-21 16:53:50 +00:00
libraryupgrader 3840382ba1 build: Updating npm dependencies
* @wikimedia/codex: 0.9.1 → 0.10.0
* @wikimedia/codex-icons: 0.9.1 → 0.10.0

Change-Id: I5e8d4af946ae8d679f9cedbe34eac9f221035bef
2023-05-17 00:51:30 +00:00
Umherirrender 7a6cac8a64 build: Updating eslint-config-wikimedia to 0.25.0
Change-Id: Ic511f54b58947a2694514e2d417e022bdeae219d
2023-05-16 00:22:03 +02:00
Jon Robson 428c32d027 Switch to native Promises and fetch
For fetch and AbortController we provide native polyfills (see
resources/src/skip-web2017-polyfills.js) so safe to use this here.
This will be empty for modern browsers.

Change-Id: Ic0f55eb0a0276be3587a4b866834bddff1124ad2
2023-05-12 21:34:42 +00:00
libraryupgrader 97855ef2f4 build: Updating npm dependencies
* @wikimedia/codex: 0.8.0 → 0.9.1
* @wikimedia/codex-icons: 0.8.0 → 0.9.1
* less: 3.8.1 → 3.13.1

Change-Id: Idb363fba64495430bbc97e044d2047dec450e7cf
2023-04-27 00:25:44 +00:00
Umherirrender 3573232c21 build: Updating npm dependencies
* eslint-config-wikimedia: 0.22.1 → 0.24.0
* @wikimedia/mw-node-qunit: 6.3.3 → 7.0.0

Change-Id: I348eb70bfc6c1d6c922c8290152926183712dee1
2023-04-03 23:14:47 +02:00
Jon Robson ec50f3f6ff Fix storybook integration
Broken by If2b4073115d9082829e4917c87c167d18f5431d9
Change import to directly hit the Codex library
This should also allow web team to respond to Codex upgrades
at their own pace (via package.json)

Render functions must now be registered in storybook for
them to display. Follow up to
Iefe98c1f0422dbf034e385b1a41a859d030a2cf4

Change-Id: Iac9dede15f4de3a4d584f1e505e379764af6dcbf
2023-03-30 15:36:05 -07:00
Umherirrender 5f18164beb build: Updating npm dependencies
* stylelint-config-wikimedia: 0.13.0 → 0.14.0

Run stylelint fix to fix the new stylelint rule

Change-Id: I98f17b481d4ba56a8cd87fcafb1fc2efdaa8abe7
2023-03-28 20:18:47 +00:00
libraryupgrader 7ccf2f0f3a build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 39.0.0 → 41.0.0
* mediawiki/mediawiki-phan-config: 0.11.1 → 0.12.0

npm:
* eslint: 8.9.0 → 8.31.0
* grunt-banana-checker: 0.9.0 → 0.10.0
* @wdio/mocha-framework: 7.4.6 → 7.30.2
* svg-inline-loader: 0.8.0 → 0.8.2
* decode-uri-component: 0.2.0 → 0.2.2
  * https://github.com/advisories/GHSA-w573-4hg7-7wgq
* deep-object-diff: 1.1.7 → 1.1.9
  * https://github.com/advisories/GHSA-653v-rqx9-j85p
* http-cache-semantics: 4.1.0 → 4.1.1
  * https://github.com/advisories/GHSA-rc47-6667-2j5j
* terser: 4.8.0 → 4.8.1
  * https://github.com/advisories/GHSA-4wf5-vphf-c2xc
  * https://github.com/advisories/GHSA-4wf5-vphf-c2xc
* ua-parser-js: 0.7.31 → 0.7.34
  * https://github.com/advisories/GHSA-fhg7-m89q-25r3

Change-Id: I11c9ba8212c9103e92baa5ebc09f9214b04851ff
2023-03-12 08:46:52 +00:00
Vaughn Walters a7dba1c602 selenium: Remove webdriverio npm package from the Popups extension
The `webdriverio` package does not need to be an explicit dependency.
It is a dependency of `@wdio/cli`.

Bug: T325059
Change-Id: I9d72d936e763dde9bc6d21708bf03fd39ee32ba0
2023-01-13 11:38:43 -06:00
Jon Robson 0febc3f54d Extensible previews
Allow extensions to register new types of previews via
extension attributes.

Changes:

- The check for reference previews doesn't make sense
as $('a[ href*="#" ]' ) will match any elements with a hash
fragment, so the additional check to Title.getFragment
will not provide a different result. This was introduced in
I9ec57e0fbb0d21beaaa7b359c1c2bef64d2c14f5
- Links that point to themselves are marked with mw-selflink
in MediaWiki so this can use the not selector we already have.
- The new API is used internally and only available via extension
Attributes
- An example is provided in SkinJSON
(https://github.com/jdlrobson/mediawiki-skins-skinjson/pull/14)

Bug: T233099
Change-Id: Iefe98c1f0422dbf034e385b1a41a859d030a2cf4
2022-11-22 08:45:27 -08:00
James D. Forrester e1ea210f6f build: Upgrade jQuery test install to 3.6.1 to align with MediaWiki
Bug: T316516
Change-Id: I76a4aad525975e7fde7c70a2d0edb9801c1c939b
2022-08-31 09:22:27 -04:00
libraryupgrader f32d77c603 build: Updating dependencies
composer:
* php-parallel-lint/php-parallel-lint: 1.3.1 → 1.3.2
* mediawiki/mediawiki-codesniffer: 38.0.0 → 39.0.0
* php-parallel-lint/php-console-highlighter: 0.5.0 → 1.0.0

npm:
* stylelint-config-wikimedia: 0.12.2 → 0.13.0
* mocha: 8.4.0 → 8.4.0
  * https://github.com/advisories/GHSA-qrpm-p2h7-hrv2
* nanoid: 3.1.20 → 3.1.20
  * https://github.com/advisories/GHSA-qrpm-p2h7-hrv2

Change-Id: I972f0212957bb495238f072a5de64fdd72e8c856
2022-05-21 10:03:09 +00:00
libraryupgrader a5e2d17b45 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.11.0 → 0.11.1

npm:
* eslint: 8.8.0 → 8.9.0
* wdio-mediawiki: 1.1.1 → 1.2.0
* @storybook/html: 6.2.9 → 6.4.22
* bundlesize: 0.18.0 → 0.18.1
* jquery: 3.4.1 → 3.6.0
* jsdoc: 3.6.3 → 3.6.10
* webpack-cli: 3.1.2 → 3.3.12
* ansi-regex: 5.0.1 → 5.0.1
  * https://github.com/advisories/GHSA-93q8-gq69-wqmw
* async: 0.9.2 → 0.9.2
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
* ejs: 3.1.6 → 3.1.6
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
* jake: 10.8.2 → 10.8.4
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
* minimist: 1.2.5 → 1.2.6
  * https://github.com/advisories/GHSA-xvch-5gv4-984h
* mocha: 8.4.0 → 8.4.0
  * https://github.com/advisories/GHSA-qrpm-p2h7-hrv2
* nanoid: 3.1.20 → 3.1.20
  * https://github.com/advisories/GHSA-qrpm-p2h7-hrv2
* prismjs: 1.27.0 → 1.27.0
  * https://github.com/advisories/GHSA-3949-f494-cm99
* refractor: 3.5.0 → 3.6.0
  * https://github.com/advisories/GHSA-3949-f494-cm99

Additional changes:
* Set `name` in package.json.
* Also sorted "composer fix" command to run phpcbf last.
* Added the "composer phan" command to conveniently run phan.
* composer.json: Updated phpcs command in composer test (T280592).
* composer.json: Added phpcs command to scripts (T280592).

Change-Id: Ic9c742a3be5b22ccc1e8dff5b65ee779e2a02175
2022-04-15 19:01:33 +00:00
Ed Sanders 7cb024592b build: Update stylelint-config-wikimedia to 0.12.2
Change-Id: I5deff2e90e0bfa4e318094fe1962c2c66b5bd8f5
2022-02-28 13:18:39 +00:00
Ed Sanders 883c8c1aca build: Update eslint-config-wikimedia to 0.22.1
Change-Id: I055517998ed06fccdf50ec31251ea6aa9040abb5
2022-02-28 13:18:24 +00:00
Volker E 830ec1b56b build: Update 'svgo' to latest v2.8.0 & re-crush images
Updating 'svgo' to v2.8.0 and newest Wikimedia SVG guidelines –
mainly around new whitespace features of SVGO.

Change-Id: I37da089916d2efad696989427b0a06b392d1d89c
2022-02-27 23:58:05 +00:00
Umherirrender d6eddc9ca0 build: Updating stylelint-config-wikimedia to 0.11.1
Change-Id: Id770e10a4c37503eae2b6fb383f12b389d793f77
2021-09-12 16:11:01 +02:00
jdlrobson fa19ee0d4f Adjust previews to meet specifications
Apply max-heights and tweak some of the margin values

Bug: T284643
Change-Id: I0c8a77e10c36ae444e541bb52a8797594c77db63
2021-08-25 22:55:26 +00:00
sahil 7142676629 selenium: Upgrade WebdriverIO to v7
Update npm packages: @wdio/* and webdriverio.

Bug: T274579
Change-Id: Ie9bd50e36f0c888a19e73ab9b424a8b6a5bd67fd
2021-08-24 17:29:16 +00:00
Timo Tijhof 06ab2d7676 build: Fix gaps in lint coverage and update old patterns
eslint:
* Remove hardcoded glob paths that are (relatively slow) to expand
  before linting could start, in favour of specifying directories
  which can be iterated while linting happens.
* JSON files in i18n/ were skipped, unlike other repos.
  JS code under .storybook/ was skipped.
  JS code under resources/ext.popups/ was skipped.
  Fix all these by doing what other repos do, which is to let
  ESLint iterate the repository and tell it which directories not to
  enter. This has the happy side-effect of making IDE integrations
  for ESLint work correctly (as customisation in package.json has the
  same problems as using Gruntfile, namely that invoking 'eslint'
  directly can't be aware of this), as well as allowing things like
  `eslint --fix` to be used.

```
/Popups/resources/ext.popups/index.js
  4:2  error  Unexpected var, use let or const instead  no-var
```

nyc:
* Remove SPAWN_WRAP_SHIM_ROOT.
  This was a hack for an early CI experiment that hasn't been
  needed for several years.

storybook:
* Remove gitignore entries for additional npm and build output in the
  storybook subdirectory, which appears to not exist anymore since
  189b386a13.

Doxygen:
* Sync with cookiecutter example from
  https://gerrit.wikimedia.org/g/mediawiki/tools/cookiecutter-library/+/HEAD/
  - remove redundant stuff,
  - enable quiet mode to hide verbose non-warning,
  - include CoC.

Change-Id: If8f6b833067192aea96a87f04c7978c9af11f996
2021-08-16 17:02:05 +00:00
Sam Smith 8f5000f346 Remove Popups instrumentation
Bug: T267211
Change-Id: I640ab367cd235ab8da7dd70dbef7ae9076712e84
2021-07-29 17:01:01 +00:00
sahil 1e1b8506ac selenium: Update wdio-mediawiki
wdio-mediawiki v1.1.1:
- Includes wdio-defaults.conf.js file that vastly simplifies wdio.conf.js.
- Replaces @wdio/spec-reporter with @wdio/dot-reporter.
- Introduces video recording.

Bug: T283597
Change-Id: I76edb3f16272fc6c1d70b0a796115cf5cc22d255
2021-07-28 16:35:31 +05:30
jenkins-bot abff28e0b2 Merge "Update package.json engines property to match .nvmrc" 2021-07-23 22:02:58 +00:00
bwang 089a219f5d Update package.json engines property to match .nvmrc
Change-Id: I56453ee8bbd6b783204765bbdba1fe509d8b4e90
2021-07-23 14:16:54 -05:00
DannyS712 784d9f4e9b package.json - remove "npm run build-storybook" from test script
The npm "test" script runs, among other things
* npm -s run -s doc
* npm run build-storybook

since the doc script is
`jsdoc -c jsdoc.json && npm run build-storybook`
this results in building the storybook output twice. Remove
it from the "test" script.

Also, remove duplicate -s

Change-Id: Iee54e0c8455b752efc714c1fb1487b030ba007a1
2021-07-22 04:26:59 +00:00
Jan Drewniak dbb58da86b [Storybook] Upgrade Storybook to v6.2.9
This removes the webpack.config.js file, moving the webpack config
into main.js, which replaces config.js.

- Moves the global jQuery into the webpack config in main.js.
- Removes the outdates .nvmrc file in the webpack folder.
- Moves the mockMediaWiki initialization from config.js into
  index.stories.js
- Upgrades webpack to 4.22.2

Bug: T271763
Change-Id: Ie008d69e992625113ae98d52ad6d37186eb933de
2021-07-16 15:38:29 +00:00
Jan Drewniak 1e04551b1c [Storybook] Removing custom CSS grid and addons from Storybook
Removes the following add-ons and their configuration from Storybook:

- addon-cssresources
- addon-knobs
- addon-options

This will hopefully ease the upgrade to Storybook 6.

Removes the custom CSS grid used to position previews within the Storybook
instance in favour of a flexbox layout. This simplifies the creation
of previews for Storybook.

This change requires us to to add relative positioning to
`.mwe-popups-container` so that the footer is correctly positioned in the
popup without absolute positioning. This positioning has been moved to
be Storybook specific to avoid an regressions in production.

Bug: T271763
Change-Id: I9a97291cb4bca7d4cc60dad232a60f6f92c0adea
2021-07-14 12:54:55 +02:00
Volker E 21d49d3de1 build: Add and use 'browserslist-config-wikimedia'
Use central, shareable `browserslist-config-wikimedia/modern` config.

Bug: T282937
Change-Id: I72b38cba2028eab0b67543d066c341b76b91b5bb
2021-05-19 11:19:34 -07:00
WMDE-Fisch cb7fd4e4f8 Update entrypoint- and bundle-size limits
These numbers haven't been updated for some time now due to the many
recent changes in the code. Since we're wrapping things up I guess
it makes sense to have them accurate again.

Change-Id: I73c202a65192e8011acefd664bea7b62b1b556da
2021-05-10 10:00:39 +02:00
James D. Forrester 14c2102476 build: Upgrade eslint-config-wikimedia from 0.17.0 to 0.20.0
Some inline compatibility queries for the maintainers, where it
wasn't obviously intentional.

Change-Id: Idd659a0a0f7fb86c3f6870b8fe4608bbf8a45f05
2021-05-03 12:31:52 -07:00
James D. Forrester 2d5f39f4c7 build: Upgrade stylelint-config-wikimedia from 0.10.1 to 0.10.3
Also update coverage thresholds so the repo builds with newer
build tools.

Change-Id: I5561f2008b5e5462bb9afdb00c3ed86ff59c57f7
2021-05-03 12:29:30 -07:00
James D. Forrester b21da7dcbd build: Switch node version to 10.24.0 now CI is on buster
Change-Id: I7e84c4b668db188bbc930115e05b2d34be256d29
2021-04-30 11:39:16 -07:00
jenkins-bot 121c0093b9 Merge "build: Enforce check for uncompressed SVG files in CI" 2021-04-28 21:47:30 +00:00
jenkins-bot 23c09a5d2a Merge "build: Upgrade 'svgo' & re-crush SVGs" 2021-04-28 07:51:03 +00:00
Jan Drewniak b6fceb2fda build: Upgrade 'svgo' & re-crush SVGs
'svgo' upgraded to v2.3.0

This includes:
- Replacing .svgo.json with .svgo.config.js
- Updating the SVGs files. This amounts to changes in the order of
  some attributes.
- Adding the minify-svg command as part of the npm run test command

Bug: T278656
Change-Id: Ia38332be68b8ac47a31caf30272920c0f0c12053
2021-04-28 07:28:16 +00:00
anjali041 4f12a23794 build: Enforce check for uncompressed SVG files in CI
- 'dev-scripts/svg_check.sh' is added to the Popups repo
- `svg_check` is run during the npm test script

Bug: T280923
Change-Id: I02715a5a70f0effb3625694f0afb3cd6250ef46c
2021-04-25 13:29:44 +00:00
jenkins-bot c3dc5f8e05 Merge "Clean up code enabling individual popup types" 2021-04-22 15:47:08 +00:00
bwang 2081ab4bf3 build: Replace Grunt tasks with npm scripts for eslint, stylelint, banana-checker & svgo.
Changes of note:
- The doc and node-debug jobs are moved to ensure that all test prefixed
jobs are together in the package.json manifest.
- 2 additional scripts are added (linter:js & linter:styles) to match WVUI's NPM script naming convention.

Bug: T206462
Change-Id: Ib84f93c20f13aefb2d8f8755261b1f14e5902f16
2021-04-21 22:25:17 +00:00
Thiemo Kreuz c281bb9302 Clean up code enabling individual popup types
We still have 2 different mechanisms in place, maybe even 3:
* We simplify the CSS selector when we know a popup type is
  disabled, and it's impossible an anonymous user can enable it
  at run-time.
* We create that "initiallyEnabled" map that allows anonymous
  users to toggle the individual popup types at run-time.
* This map is also used to check if the footer link should be
  shown.
* There is also a wgPopupsReferencePreviews global that acts as
  a "kill switch". However, this is not a pure feature flag,
  but incorporates the user setting for registered users. This
  is currently partly redundant (checking
  `mw.user.options.get( 'popupsreferencepreviews' )` does the
  same) and can be removed later when the feature flag is not
  needed any more.

The footer link currently acts odd because anonymous users are
unable to enable ReferencePreviews, but get the footer link.

This patch introduces a 3-state model:
* `true` acts as before.
* `false` means a popup type is disabled, but anonymous users
  can enable it (i.e. this is the opt-out behavior for anonymous
  users).
* `null` means a popup type is not available at run-time, for
  nobody. Anonymous users can't do anything about this.
  Registered users must leave the page and change a setting.

Bug: T277640
Change-Id: Id8d1396c09cf0f706034a66f9cd3c880a8b33df8
2021-04-21 19:38:25 +02:00
WMDE-Fisch 190962cc5b Remove dead code around cog wheel dialogue
An "advanced" option was first introduced in 2014 via patch I374805e
(originally named "monitor-or-edit", renamed via patch I7b4f6d2).

The isNavPopupsEnabled() function was added in 2016 via patch
Ic660f48.

The code that disables the extension entirely the moment the NavPopups
gadget is enabled was added in 2017 via patch Ia474b1b (T151058) and
patch Ia837816 (T160081).

As of now, the "advanced" option can only be seen in an extreme edge
case:
* Only for anonymous users.
* Only if NavPopups is enabled by default for anonymous users.
* Only if the $wgPopupsConflictingNavPopupsGadgetName setting is
  misconfigured.
* … or if NavPopups is not a gadget in the first place, but e.g.
  loaded via Common.js.

In this situation the settings dialog opens with all *3* options. This
is broken for several reasons:
* The "simple" option enables the extension, but doesn't disable
  NavPopups. Both trigger, resulting in both popups being displayed
  the same time.
* Since "simple" is the default, this bogus behavior is the default
  for anonymous users.
* The "off" option doesn't stick. Every time the settings dialog opens
  "advanced" is checked instead.
* "Off" can't work anyway. There is no code to disable the gadget.
* Only the "advanced" option "works", but more by accident.

It's unclear how to fix this:
* There is no code that does anything with the "advanced" option. It's
  not even stored. The behavior of the option is identical to "off".
* The code appears as if "advanced" was meant to be shown instead of
  "off". I.e. anonymous users can only choose one of the popups, but
  not disable both. But there is no code to hide the "off" option.
* The bug when both popups are displayed was fixed in 2017 via an
  entirely different mechanism. Re-introducing "advanced" does not
  only mean duplication, it's unclear how the 2 mechanisms are meant
  to work together.

It really, really feels like this was just forgotten.

Bug: T278949
Change-Id: Iab21f3a649a5b2f19ebb0d0dbb45ce1450c65678
2021-04-15 15:29:16 +02:00
Thiemo Kreuz 622fb6c5e8 Allow to disable/enable popup types individually
Bug: T277639
Change-Id: I0742b8ab1c5ed0b374d4f9447bebc46a35207339
2021-04-15 11:30:36 +02:00