Commit graph

78 commits

Author SHA1 Message Date
jdlrobson ad5c127239 [Storybook] Add Header component
* Moves screen variables relating to Header to Header
* Adds a Header storybook entry
* Moves data-logo from Logo template to Header.mustache
* Updates UserLinks to use USER_LINK_PARTIALS
* Renames confusing SearchBox story names
* Updates package.json to use a static folder.
* Use mediawiki.org for sourcing mw-ui-button and mw-ui-icon styles
since deploys there come earlier
* Removes usages of ID selectors

Change-Id: I0e158fa7e62c56a50cfff497d75f0808effd1eed
2021-09-14 18:33:10 +00:00
jdlrobson 3ed167f318 [storybook] Document button usage and update broken stories
* add stories for buttons and icons using wvui and mwui
* Update user link stories
* Add the vector-menu-dropdown-noicon class to more and
variants menu
* Fixes the language button story and simplifies its code.
* Updates Hooks::makeButtonIcon to Hooks::makeIcon which
reflects the method purpose more. It doesn't output button
classes.

Bug: T289514
Change-Id: Ifd750da0c0181ec56f39ff00d653e88bfc848038
2021-09-07 21:23:33 +00:00
libraryupgrader aaac2ba4b7 build: Updating stylelint-config-wikimedia to 0.11.1
The following rules are failing and were disabled:
* declaration-property-unit-disallowed-list

Change-Id: I5252d63ec939a711022844ed9e4c2d247e154820
2021-09-04 17:38:00 +00:00
jdlrobson a46e790187 Use centralized MediaWiki typescript definition
Use @wikimedia/types-wikimedia rather than maintaining our own.

Bug: T263914
Change-Id: I5319f422b85a772c248f2114a75f906a1aff6251
2021-07-26 21:27:12 +00:00
libraryupgrader 8dc9511bbc build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)
* prismjs: 1.23.0 → 1.24.1
  * https://npmjs.com/advisories/1762 (CVE-2021-32723)

Change-Id: Ief0fe110b6746c209085502cf4639429a4116ab5
2021-07-24 01:35:45 +00:00
libraryupgrader dd6cdd7149 build: Updating jsdoc to 3.6.7
* https://npmjs.com/advisories/1674 (CVE-2021-23358)

Change-Id: Iaa01d3c4f3becdbc8f45368e9877211b434b7fa6
2021-05-15 18:15:54 +00:00
Volker E 2b5c18d7c9 build: Update 'svgo' to latest
Also change script name to 'minfiy-svg' to align with other npm 'svgo'
using products and to improve readability for non-native speakers.

Bug: T278656
Change-Id: Ib2a8a251a48ea99c8019d63b4f2586fea4079021
2021-04-18 14:51:48 -07:00
libraryupgrader e352b94055 build: Updating npm dependencies
* eslint-config-wikimedia: 0.19.0 → 0.20.0
* ssri: 6.0.1 → 6.0.2
  * https://npmjs.com/advisories/565

Change-Id: I4db94efccd2d6b58b994b080a99c5c066b829892
2021-04-15 13:54:37 +00:00
Volker E 5734191840 build: Update SVGO to latest v2.2.2 and re-crush SVGs
SVGO v2.x changed configuration to JS, amending configuration.
Also re-crushing SVGs.

Change-Id: Id6379e06e6aa1c25760f8489166d354fca25cd52
2021-03-25 09:19:42 -07:00
libraryupgrader f01df6f803 build: Updating eslint-config-wikimedia to 0.19.0
The following rules are failing and were disabled:
* compat/compat

Additional changes:
* eslint: Renamed `wikimedia/client` profile to `client-es5` (T277085).

Change-Id: I12c1a88cef8e2c95bed496628d2fe74d031f8278
2021-03-15 04:57:07 +00:00
Umherirrender 44cdd3290d build: Remove maxWarnings: 0 from eslint configuration
This interferes with LibUp's ability to automatically downgrade newly
failing errors to warnings and is a deviation from the settings we
typically use.

Bug: T263922
Change-Id: Ia44038a1df1052f633ce18ac6f35253e870ab0c6
2021-02-05 20:16:27 +01:00
libraryupgrader 5d279c94d2 build: Updating npm dependencies
* bundlesize: 0.18.0 → 0.18.1
  * https://npmjs.com/advisories/1594 (CVE-2020-28168)
* github-build: 1.2.1 → 1.2.2
  * https://npmjs.com/advisories/1594 (CVE-2020-28168)

Change-Id: I09e83b5e92eb6beeaabc75d44e5582c1389d58e4
2021-01-08 04:48:46 +00:00
Jan Drewniak bd83398659 Integrate WVUI search into Vector
Creates a new skins.vector.search module that
replaces the searchSuggest module from MediaWiki core.

This module creates a new Vue app using the WVUI
search widget for the new search experience.

The legacy search input form is still retains on pageload,
and the new search kicks on search input focus.

In order to manage that transition, the legacy search
input is styled to resemble the new WVUI input, and the
new input is manually focused after the component mounts.

Vue is also added as a dev-dependency to help with
type-checking.

Other changes:
* the entry in skin.json is reordered alphabetically after
skins.vector.js

Bug: T264355
Change-Id: Ibb9561a77a14734297cb4d0ddcd415fc0750b45d
2020-12-08 13:27:12 -08:00
libraryupgrader 659e8989ac build: Updating stylelint-config-wikimedia to 0.10.3
Additional changes:
* Removed globals `require`, `module`, included via `wikimedia/mediawiki` profile (T262222).
* Dropped the emtpy global definition in .eslintrc.json.

Change-Id: I18ea7925d42ae65c6afd49982186d9375ab9e6e3
2020-11-23 03:44:23 +00:00
Bartosz Dziewoński 99568762e8 Windows compat in package.json scripts
Run dev-scripts/setup-storybook.sh using the `bash` executable,
not default shell.

('pre-commit' still doesn't work because of the funky env variable,
but I don't care)

Change-Id: Ibb0bfa0b6687248377ac72629c5642773d5d357f
2020-10-17 01:41:02 +02:00
Jan Drewniak 6907c81a15 [Storybook] Fix PNG/SVG asset resolution.
Fixes the missing images in the Logo story.

The current method of downloading the images into
docs/ui/assets and treating them as static assets
(with the start-storybook -s option) could be problematic
if that directory is deleted or "cleaned" before the
storybook build.

Instead, the images are now downloaded into
./storybook/resolve-imports and imported explicitly in the
code in Logo.stories.data.js.

* ./storybook/resolve-less-imports renamed to resolve-imports
* .gitignore is updated to reflect that
* Webpack config is updated with the `resolve-imports` path
* static option (-s) is removed from npm start script
* Images are explicitly imported in Logo.stories.data.js
* Type definitions are added for .svg and .png files

Change-Id: I242d229242c86a5784d6d4611d0b9c7049712dac
2020-09-25 12:52:05 +02:00
libraryupgrader 1f385f74ad build: Updating node-fetch to 2.6.1
* https://npmjs.com/advisories/1556
* CVE-2020-15168

Change-Id: I6590e57425546f93589838288844d0a2dcf7095b
2020-09-10 23:28:46 +00:00
Ed Sanders 6fe1f39950 build: Update eslint-config-wikimedia to 0.17.0
Change-Id: Ia4911b1706e50106b108b38108430bb950010b21
2020-08-25 14:17:56 +01:00
jenkins-bot 3707751621 Merge "[build] Fold NPM build script into test" 2020-08-03 19:54:52 +00:00
Stephen Niedzielski cf17aee48b [build] Make the pre-commit hook optional
Add a new NPM script, `pre-commit`, which _conditionally_ invokes
`npm test`. Previously, the pre-commit hook was configured by default to
invoke `npm test`. Now it is configured explicitly to invoke the new
`pre-commit` script.

The rationale for this change is that some folks may prefer workflows
that defer all validation until CI. Supporting these workflows is a
small change, most of it documentation.

This change isn't necessary for T257647 but supports and seems like an
overall improvement to the repo regardless of whether code is built or
not.

Bug: T257647
Change-Id: I19a78e0e677026cd6887245d96e63a414397a3db
2020-08-03 18:23:42 +00:00
Stephen Niedzielski d752997e4f [build] Fold NPM build script into test
The NPM `build` script was being used to call `test`. The confusion was
likely due `build` calling the TypeScript compiler which in this case
isn't building anything. It's only used for tests. Since a proper
`build` script will be added in T257647. Move the tests in `build` to
`test` and drop `build`.

Bug: T257647
Change-Id: I7f2c983915f6b1eaa0aa88eb8dd4b32d9c954b78
2020-07-30 19:31:07 -06:00
Ed Sanders 36e91dc04f build: Update devDependencies
Applies new ESLint documentation rules

Change-Id: I7fe458cf52e98baf92f3baec2d9ff54484326673
2020-07-01 14:43:39 -07:00
libraryupgrader 74e19abeec build: Updating npm dependencies
* stylelint-config-wikimedia: 0.9.0 → 0.10.1
* webpack: 4.42.1 → 4.43.0
  * https://npmjs.com/advisories/1179
* markdown-to-jsx: 6.11.0 → 6.11.4
  * https://npmjs.com/advisories/1219

Change-Id: I9fcae139a55916c1ad881583361f41b61d5fe641
2020-06-12 05:51:50 +00:00
Jan Drewniak a3acacc1a4 Add bundlesize test for ResourceLoader modules.
Adds a bundlesize test that measures the bytesize of
individual ResourceLoader modules.
This test depends on a running mediawiki instance as well as
the $MW_SERVER and $MW_SCRIPT_PATH environment variables.

ResourceLoader modules are fetched from a URL and piped
into a bundlesize command based on a custom configuration file.

The test can be run with `npm run test:size`.

Bug: T244276
Change-Id: I4f4534921ccbc6bd4f99229c8dd36b1279dde640
2020-06-11 19:51:20 +02:00
Stephen Niedzielski 14abeb0c2f [dev][Storybook] move to start script; report errors not status
Storybook seems to be our primary stackless development workflow. Move
the `storybook` script to `start` to support the standard `npm start`
command expected in every NPM repo.

Debugging Storybook tooling is the rare case that informational messages
(perhaps even more verbose than default) are wanted. Feature development
is the common workflow that should be optimized for.

Storybook's design philosophy seems to favor incredibly verbose output
by default, both for the CLI and the [browser console]. This is at odds
with Unix's rule of silence, sometimes expressed as "silence is golden."
That is, only report warnings and errors unless told otherwise.

This patch reduces the verbosity of the Storybook [CLIs] as able and its
setup script:

- Only report warnings and errors while building.
- Suppress build informational output when launching.
- Only report curl errors, not progress.

[browser console]: https://github.com/storybookjs/storybook/issues/8461
[CLIs]: https://storybook.js.org/docs/configurations/cli-options/

Change-Id: Ie38ae14e304f7f88f445c0c0fb3f2fbba49d134a
2020-05-12 13:42:01 -07:00
jenkins-bot 337244ebdf Merge "[modern] A new version of Vector with a new logo" 2020-04-30 21:47:44 +00:00
jdlrobson 6a9ee465bc [modern] A new version of Vector with a new logo
Changes to support feature:
* ResourceLoaderSkinModule logo features are dropped
* New layout provided given the fork in layout between legacy and new.
* Legacy sidebar styles now pulled out
* breakpoint styles are not carried over from legacy Vector
The new Vector layout for now has one breakpoint.

Changes to storybook:
* The storybook script now pulls down image assets so that the logos can
be shown in storybook. The script is adjusted to make use of a static folder to
serve these images.

Note:
* The legacy mode is not touched as part of this patchset.
* The personal menu is unaffected by this patch and is out of scope.
* The alignment issue is noted, but will be solved at a later date.
* Changes to portal are out of scope.
* Adding storybook for modern descoped, given its not possible to load
both legacy layout and modern layout inside a storybook at current time.

Sample config:

$wgLogos = [
        'icon' => 'https://di-logo-sandbox.firebaseapp.com/img/globe.png',
        'tagline' => [
                'src' => 'https://di-logo-sandbox.firebaseapp.com/img/tagline/en-tagline-117-13.svg',
                'width' => 117,
                'height' => 13,
        ],
        '1x' => 'https://en.wikipedia.org/static/images/project-logos/enwiki.png',
        'wordmark' => [
                'src' => 'https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg',
                'width' => 116,
                'height' => 18,
        ],
];

Coauthor: Aron Manning

Bug: T246170
Change-Id: Ibc4b055150761388a6b78f9127da342c451ce0e7
2020-04-30 14:11:54 -07:00
Libraryupgrader 1d0fd0bd1b build: Updating eslint-config-wikimedia to 0.15.3
Change-Id: Id8e58bed6af439ccbb12f8947b046c76e7b242c9
2020-04-30 12:47:54 -07:00
libraryupgrader a89c424181 build: Updating grunt-banana-checker to 0.9.0
Change-Id: Ia656ffd71cdbf846cadff005ea34a47bb78bad78
2020-04-17 23:31:20 +00:00
jenkins-bot 3618a6dede Merge "Add script 'npm run lint:fix:js' and 'lint:fix:styles', remove 'lint:fix'" 2020-03-18 19:26:11 +00:00
Stephen Niedzielski bd7bd75569 [JavaScript] Validate types
Lift the mists of confusion by checking that all JavaScript types align.
No ignores! This is the JavaScript equivalent to Phan.

This patch adds the necessary infrastructure for verifying typing and
fixes the few flaws found.

Bug: T239262
Change-Id: I2557471421196ea46cd13dfb786a52968fbfcc97
2020-03-16 09:10:08 -06:00
AronDemian ecf7f811e6 Add script 'npm run lint:fix:js' and 'lint:fix:styles', remove 'lint:fix'
Bug: T247004
Change-Id: I4187799d56c1bae537730af832fe35c655e8ec22
2020-03-16 15:05:33 +01:00
AronDemian cc6a7cca61 Remove unnecessary devdependency 'stylelint'
package-lock.json regenerated using the following process to ensure a clean slate:
rm -r node_modules package-lock.json  ;  npm i

Bug: T247004
Change-Id: Ie7720509ef37b178538a54854c28153ed73e375e
2020-03-13 06:50:23 +01:00
Stephen Niedzielski f4f7f3623c [dev] Run npm t on Git pre-commit hook
Execute `npm test` prior to committing. This saves back-and-forth with
Jenkins. This is the same configuration used by Popups,
MobileFrontend, MinervaNeue, NearbyPages, ContentTranslation, and
others.

Change-Id: If61ab4f28b0ccd38492d11a4cd8a92a97b2eb582
2020-03-11 07:49:48 -06:00
libraryupgrader e9d9949048 build: Updating acorn to 7.1.1
* https://npmjs.com/advisories/1488

Change-Id: I4a6240c578be9b490cb824e24dbc252be60d9c7b
2020-03-08 19:06:33 +00:00
AronDemian b9968d9d93 build: Add 'svgo', SVG minifier script and unify SVGO rules
Adds:
- npm run svgmin
- .svgo.yaml: unified SVGO rules from Wikimedia coding conventions

Bug: T247004
Change-Id: I7017ecfebb811fa8d626747a830ad000774bbf2f
2020-03-07 19:47:58 -08:00
AronDemian 1b340724d4 Separate scripts npm test and npm run build, remove npm run doc from test
- npm doc: unchanged, but no longer called by 'test'
  * it is run on its own by 'mwext-node10-rundoc-docker' CI job.
  * successful build of the documentation is necessary for JenkinsBot to accept the patch
- npm test: runs only 'lint' as of now, future possibility: qunit tests too
  * run by CI job 'mwgate-node10-docker'
- npm build: runs 'test' and 'doc'
  * NOT run by CI jobs

Bug: T247004
Change-Id: I3e6e1ebb220ceb1a1591cb7087bbd071b1bacf8f
2020-03-05 23:43:39 +00:00
AronDemian 71ec758beb Add script 'npm run lint:fix' to fix trivial lint errors
Bug: T247004
Change-Id: Id40b82f64a5c29af4a8e2c7935623df6761d25b1
2020-03-05 22:26:06 +01:00
AronDemian 834f4f837f Port 'storybook' scripts to windows, merge 'jsdoc' into 'doc'
additional changes:
* the jsdoc npm command is removed intentionally to
avoid polluting package.json with too many jobs.

Change-Id: Ie49de1c4b7a40a835ea1b3f8bcdbb779ba919860
2020-03-05 17:48:01 +00:00
jenkins-bot 5b1d77fb9d Merge "Replace Grunt tasks with npm scripts in package.json" 2020-02-27 17:48:52 +00:00
Jan Drewniak 98b70067c9 Replace Grunt tasks with npm scripts in package.json
Adds the following npm scripts:
- npm run lint
- npm run lint:js
- npm run lint:styles
- npm run lint:i18n

Bug: T242781
Change-Id: I0c2cfce73a02029b9d0c4d329309aff477cb02d4
2020-02-27 16:32:12 +01:00
Nicholas Ray 7b7c948bf6 Add 'jsdoc-wmf-theme' to jsdoc
This adds the wmf theme styles to our jsdoc as can be seen on
https://doc.wikimedia.org/Parsoid/master/.

There is a caveat with this though. jsdoc-wmf-theme adds warnings for
unlinked symbols (e.g. 'return {jQuery}') [1] which causes the jsdoc doc
generation to fail since it is set to fail on warnings (we have it
configured with `pedantic: true`).

If we add the jsdoc-wmf-theme, we will need to be stricter about our
symbol usage which could be a good thing or just be tedious and
annoying.

What do you think?

[1] https://github.com/cscott/jsdoc-wmf-theme/blob/master/publish.js#L29

Bug: T239258
Change-Id: Icade62a278d7e685cbda28a8ca26a1b703e64f19
2020-02-14 10:43:46 -07:00
Nicholas Ray a79bb8dff4 build: Replace JSDuck with JSDoc
* jsdoc.json was copied from Minerva. The markdown plugin from that
config was removed since there no usages of that in Vector.

* Added latest jsdoc dependency to package.json

* Copied 'jsdoc' task from Minerva into Vector. Revised storybook output
so that multiple docs (storybook + jsdoc) could be in /docs

* Made collapsibleTabs.js JSDoc compliant (This was really the only
thing using jsduck syntax)

* Modified Gruntfile stylelinter to ignore docs folder

Bug: T239258
Change-Id: Id07d591ffe7bf0ac021109051e89b91ffdcf4c78
2020-02-14 10:29:00 -07:00
jdlrobson ea2bcd44f2 Add storybook to Vector
- Update package.json with the new dependencies.
- A script storybook.sh pulls down CSS and LESS imports from external
dependencies. This copies the approach taken in Popups and MobileFrontend.
- Icons from external repos are maintained within the repo in SVG-only form.
Using load.php modules is also possible, but will pull down other unnecessary icons
and break if any of these modules are changed. Decided that we should manually maintain
these for the time being given there are only 3 icons.
- Several LESS files now import the variables file. I think it's useful for stories
to only import the CSS they use as this encourages us to modularise our CSS. Before these
imports were not necessary as they inherit imports from index.less. This will have no impact
on the bundle size as the LESS compiler silently discards duplicate imports
- stories/utils.js provides a useful placeholder function for generalising our hook entry
points.

Bug: T242674
Change-Id: I722e84d2fb57653a2f96142dc3e5248043261746
2020-01-31 16:59:15 +08:00
libraryupgrader 24b72c8bfa build: Updating npm dependencies
* grunt-stylelint: 0.12.0 → 0.13.0
* stylelint-config-wikimedia: 0.7.0 → 0.8.0

Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: I59abf3b90868ae225a70bc3c0ba287f2c2335c8b
2020-01-10 18:36:03 +00:00
Ed Sanders c61f6469db build: Update linters
Change-Id: I17a65638e0c7d074d4c1db282b278798e875fbe1
2019-10-31 21:43:20 +00:00
Ed Sanders 370f52e692 build: Update linters
Change-Id: I58969b531c70eba70a7fa7a8fc0ba1ad521ba9f5
2019-10-07 16:41:27 +01:00
libraryupgrader 5914274354 build: Updating npm dependencies for security issues
* Updated stylelint-config-wikimedia to 0.6.0, addressing:
  * https://npmjs.com/advisories/786

Committed package-lock.json (T179229) too.

Change-Id: I8eafeb13195b405344ea6ce3da85a4c0f1c4e2a8
2019-06-09 06:51:07 +00:00
WMDE-Fisch 673fed9ac0 build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlint
Change-Id: Ie898fb12b4f144fcfa19c654fed48805df1ebe2d
2019-06-06 18:08:32 +02:00
Ed Sanders 7e76377bf8 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: Idae38d2dff51827f7aff510d40b2358bf939b5e2
2019-03-13 23:23:14 +00:00