Commit graph

56 commits

Author SHA1 Message Date
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
Ed Sanders e09e880e2f build: Update to eslint-config-wikimedia 0.10.1
Change-Id: Ie4363abc9c60291ef4a69f35973f3c25f5e3a3ec
2019-02-09 18:17:44 +00:00
Ed Sanders 8634a77d0e build: Update linters
Change-Id: I8b99db813f12dc2031b5a1c195e6480f5512792a
2019-01-11 13:03:15 +00:00
Volker E 20cbac1f5b build: Remove 'stylelint' package as it gets pulled-in by 'stylelint-config-wikimedia'
Change-Id: I164512519c0b34fc9d9a9415e55f265ebf3d1ad0
2019-01-09 13:14:10 -08:00
Volker E 0e089a0d4c build: Update 'stylelint-config-wikimedia' and make pass
Change-Id: I147ea18307c58c5091c5ad79585b5acec9d46235
2018-12-02 14:40:28 -08:00
Ed Sanders 828452ff27 build: Update eslint-config-wikimedia to 0.9.0
Change-Id: I3ea907f6ef3b6337c1e793668ae889610fc6a635
2018-11-26 23:39:36 +00:00
Ed Sanders 329f0c7327 build: Update devDependencies
eslint-config-wikimedia  0.7.2  →  0.8.1

Change-Id: I7a5553e9abf44fb681825c83c1984aae883f9c72
2018-11-01 11:20:46 +00:00
Ed Sanders 0b7cc4ffce build: Update linters
Change-Id: Ic11eea77b944cfc98e9494a9d215a138f386f1eb
2018-09-09 18:30:26 +00:00
James D. Forrester 2cd16d6012 build: Bump devDependencies to latest
grunt                        1.0.1  →   1.0.2
 grunt-banana-checker         0.5.0  →   0.6.0
 grunt-eslint                20.0.0  →  20.1.0
 grunt-stylelint              0.8.0  →   0.9.0
 stylelint                    7.8.0  →   8.2.0
 stylelint-config-wikimedia   0.4.1  →   0.4.2

Change-Id: I3b1c13f3fe5c4f1f90dd1db658700aecda0d0724
2018-02-26 10:29:23 -08:00
Ed Sanders 8842f744ee build: Update eslint-config-wikimedia 0.4->0.5, eslint 19->20
Change-Id: I61a9bc5567036dfcbc7697276583facbefac8b93
2017-08-25 16:21:21 +01:00
Antoine Musso 60d6ecbaad Define npm peer dependency explicitly
npm 3 requires dependencies to be explicitly defined.

Bug: T172094
Change-Id: Ic640ccf0f577e47036d473892522ea758014fab4
2017-07-31 12:04:32 +02:00
Ed Sanders ea6f33eff7 build: Update eslint to 0.4.0
Change-Id: I16ee2a0414cc79ae4fe32a55637f0d075956c1ba
2017-05-04 17:01:53 +01:00
Fomafix 0ce7fe792e Use tabs instead of spaces for indenting
Change-Id: Id88ed98763265f0eea75514e52fbd0f546ef72b4
2017-03-25 14:56:54 +01:00
James D. Forrester 298af67c06 build: Bump stylelint and make pass
grunt-stylelint              0.6.0  →   0.7.0
 stylelint-config-wikimedia   0.3.0  →   0.4.1

Change-Id: Id87b8df04d415e1f1058a4042a31408236402037
2017-02-17 16:34:04 -08:00
Ed Sanders 5cad73068e build: Update package versions and sort
Change-Id: Icfda010166b29916e2b3217873c30d459b4c041c
2017-01-23 15:04:05 +00:00
James D. Forrester 0019f6d5a5 build: Introduce stylelint and make pass
Change-Id: I48d542580d767df2d17ce4c6668e9e233a0f7904
2016-11-29 08:40:03 -08:00
James D. Forrester 9bd5ce5a1e build: Replace jshint and jscs with eslint
Change-Id: I48d542580d767df2d17ce4c6668e9e233a0f7903
2016-11-29 08:39:55 -08:00
Timo Tijhof 1f26153a5d collapsibleTabs: Clean up and simplify code
* Rename 'rtl' to 'isRTL' and use DOM to compute its value.
* Document code with JSDuck similar to other extensions.
* Remove unused 'prevElement' property. Not used in Vector
  nor anywhere else in Wikimedia Git.
* Make 'boundEvent' property private. Not used anywhere in
  Wikimedia Git outside this file.

* Simplify 'instances' tracking.
  The jQuery object stored in this property wasn't used beyond
  calling each(). Convert to a plain array.
  Preserve and re-use the jQuery object first created
  by collapsibleTabs().

* Simplify calculateTabDistance() by using getElementById() and
  getBoundingClientRect(). Its support includes IE 5.
  The "new" version (since Firefox 3.5 and IE 9) also includes
  'height' and 'width' properties and is supported in all
  browsers supported by the MediaWiki 1.28 startup feature test.

  This helps avoid code in offset() and width(), which is fairly
  expensive in jQuery 1.x.

* moveToCollapsed()
  - Remove redundant jQuery object creation (only caller passes a
    jQuery object already).
  - Remove redundant re-receiving of expContainerSettings inside
    the animate() callback. Already in the main scope.
    Relates to a bunch of patches that work around a problem
    caused by use of remove() instead of detach() in an earlier
    version of the code. Which was only a problem because the
    other settings object was also not used from the main scope.
    (See pre-Gerrit commits 1f93310e and e7900807.)

Change-Id: I48d542580d767df2d17ce4c6668e9e233a0f7902
2016-11-29 02:25:00 +00:00
Paladox 43207bb62d Update three packages
Update grunt-contrib-jshint to 1.0.0

Update grunt-banana-checker to 0.5.0

Update grunt-jscs to 2.8.0

Change-Id: I2875efab17acc9007725f1e79b9353cb8b0ceb3f
2016-03-30 22:36:42 +01:00
Paladox 0f7f31f519 Update grunt-jscs to 2.6.0
Change-Id: I765880ee81a466f302dd677372e32ad0a3ff302e
2016-01-19 14:26:27 +00:00
Paladox 76b668eaf5 Update grunt-jsonlint to 1.0.7 and MW codesniffer to 0.5.1
Change-Id: If8c4cc68156467746a679144039b978fe0247401
2015-12-29 11:33:41 +00:00
Paladox f43716fcfe Update grunt-jscs to 2.5.0
Change-Id: I79bda05766997f4bb73b8948215ed1b41c3e2d49
2015-12-09 22:13:37 +00:00
Paladox a4134557e9 Update packages
Update grunt-jscs to 2.3.0

Update grunt-jsonlint to 1.0.6

Add new jscs-preset-wikimedia package.

Change-Id: Ie175abf1d692dac78afe02b2d70867c1369353b4
2015-11-07 17:45:46 +00:00