Commit graph

193 commits

Author SHA1 Message Date
Ed Sanders 461f949823 build: Update linters
Also restructure eslint config so that
* root files are linted with server rules
* src and tests share config

Change-Id: Ie4d0731ba9670af7f3e60cdfe3c4e331386b17c6
2023-11-09 11:36:08 +00:00
WMDE-Fisch 90a829179c Better support RTL direction extracts in ReferencePreviews
When the user sets a different language than the projects content
language, ReferencePreviews were rendered LTR. By using the bdi
tag this behavior is fixed.

Note that PagePreviews gets language and direction from the
TextExtracts response and use them to achive the same. The latter
is not straight forward available for ReferencePreviews so I'm
using bdi to achieve the same.

Bug: T345833
Change-Id: I6554e6e1db3aac06c04c9185500e05de238adde2
2023-10-04 15:28:00 +02:00
WMDE-Fisch 62510a4fba [build] Bump wdio-mediawiki to v2.3.0
Change-Id: Id5ab1b832e48cc9c211278f32354ca97ca3b693f
2023-09-26 14:22:42 +00:00
James D. Forrester a8557a7042 tests: Raise jQuery requirement from v3.6.1 to v3.7.1
Matches MediaWiki change d3d0a363d1f8c70cfa2e880d24182c050ad9bf78.

Change-Id: I948042fb0c4e19d9162680a4fa3e5ae024393859
2023-09-07 16:14:29 +00:00
Umherirrender 97b9e453e2 build: Use quotes for paths in package.json
To make it working on Windows

Change-Id: I432091107356682f4d6bc8613922b908a6c2e6ea
2023-08-10 08:47:16 +00:00
Jon Robson 9aa07d0809 Model: Make dwell delay part of model and registration
Dwell delay varies between popup type so should be part of the
definition. Since this is needed by reference tooltips we should
make this part of the Page preview model. This will allow us to
separate concerns of the architecture and reference  tooltips
for better maintenance between WMDE and web team.

Bug: T326692
Change-Id: Ia021c8b90fd69d70c4b33744520bb963a65db036
2023-07-26 17:42:56 -07:00
WMDE-Fisch c2413c858b selenium: Refactor WebdriverIO tests from sync to async mode
I also removed the bool on the shouldUseReferencePopupsBetaFeature
method. It was always just used with `true`

Bug: T293072
Change-Id: I1a2d6f912fcac2ac77539581897e0feab489edf0
2023-07-18 09:34:47 +02:00
bwang 6b659443b5 Update popups to use codex buttons over mediawiki.ui.buttons
- Provides missing accessible label for the settings button

Bug: T340256
Change-Id: I86972322ae34f1d1df8d79c66daa9e34091f9dd3
2023-07-10 16:03:36 -05:00
Moh'd Khier Abualruz 67a718a5be TypeError: n.closest is not a function
- check if the element has the function in it before using it
- implementing a native code to get the same result based on polyfill examples
- fix Coverage Block

Bug: T340081
Change-Id: I1c2ce46a88cde6323ab862964062dd722ff5edcb
2023-07-10 11:48:40 -07:00
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