From 9d1db05e7bc12d9a3235dae75fa1f13650198fa3 Mon Sep 17 00:00:00 2001 From: Volker E Date: Fri, 18 Sep 2020 12:34:48 -0700 Subject: [PATCH] Fix storybook dev-script imports * Correctly pull down mediawiki.skin.variables.less * Update source of clock icon in last modified bar * Update query selectors * Push to docs.wikimedia.org so things do not break so easily again Bug: T263270 Change-Id: I93cb7e53fb78d3a03019583b3b0c69a057088044 --- dev-scripts/setup-storybook.sh | 13 +++++++------ package.json | 4 ++-- stories/footer.less | 6 +++--- stories/lastModifiedBar.stories.js | 8 ++++---- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/dev-scripts/setup-storybook.sh b/dev-scripts/setup-storybook.sh index 84a37a7fe..79eddf545 100755 --- a/dev-scripts/setup-storybook.sh +++ b/dev-scripts/setup-storybook.sh @@ -4,17 +4,18 @@ set -eu mkdir -p .resolve-less-imports/images mkdir -p .resolve-less-imports/mediawiki.ui -# LESS imports -curl "https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.less/mediawiki.mixins.less?view=raw" -o .resolve-less-imports/mediawiki.mixins.less -L -curl "https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.less/mediawiki.ui/variables.less?view=raw" -o .resolve-less-imports/mediawiki.ui/variables.less -L -curl "https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.less/mediawiki.mixins.rotation.less?view=raw" -o .resolve-less-imports/mediawiki.mixins.rotation.less -L -curl "https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.less/mediawiki.mixins.animation.less?view=raw" -o .resolve-less-imports/mediawiki.mixins.animation.less -L +# Fetch resources via curl, `-sSL` silently, Show only errors, Location header and also with a 3XX response code. +curl -sSL "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.less/mediawiki.skin.defaults.less?format=TEXT" | base64 --decode > .resolve-less-imports/mediawiki.skin.variables.less +curl -sSL "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.less/mediawiki.mixins.less?format=TEXT" | base64 --decode > .resolve-less-imports/mediawiki.mixins.less +curl -sSL "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.less/mediawiki.ui/variables.less?format=TEXT" | base64 --decode > .resolve-less-imports/mediawiki.ui/variables.less +curl -sSL "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.less/mediawiki.mixins.rotation.less?format=TEXT" | base64 --decode > .resolve-less-imports/mediawiki.mixins.rotation.less +curl -sSL "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.less/mediawiki.mixins.animation.less?format=TEXT" | base64 --decode > .resolve-less-imports/mediawiki.mixins.animation.less # Append compatibility with wgMinervaApplyKnownTemplateHacks. echo "@wgMinervaApplyKnownTemplateHacks: 1;" >> .resolve-less-imports/mediawiki.ui/variables.less # clock icon -curl "https://en.m.wikipedia.org/w/load.php?modules=skins.minerva.icons.images&image=clock&format=original&skin=minerva&version=7aa66" -o .resolve-less-imports/images/clock.svg +curl "https://en.m.wikipedia.org/w/load.php?modules=skins.minerva.icons.wikimedia&image=history&format=original&skin=minerva&version=7aa66" -o .resolve-less-imports/images/clock.svg # expand icon curl "https://en.m.wikipedia.org/w/load.php?modules=mobile.ooui.icons&image=expand&variant=gray&format=rasterized&skin=minerva&version=grblv" -o .resolve-less-imports/images/expand.svg diff --git a/package.json b/package.json index 2d360dac1..bea35fca6 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "scripts": { "storybook:setup": "./dev-scripts/setup-storybook.sh", "storybook": "npm run storybook:setup && start-storybook -p 6006", - "build-storybook": "npm run storybook:setup && build-storybook -o docs/", + "build-storybook": "npm run storybook:setup && build-storybook -o docs/ui", "test": "grunt test && npm run doc && dev-scripts/svg_check.sh", - "doc": "jsdoc -c jsdoc.json", + "doc": "jsdoc -c jsdoc.json && npm run build-storybook", "test:size": "node ./tests/resource-loader-bundlesize.js", "selenium-test-cucumber": "wdio tests/selenium/wdio.conf.cucumber.js", "selenium-daily": "MW_SERVER=https://en.m.wikipedia.beta.wmflabs.org npm run selenium-test", diff --git a/stories/footer.less b/stories/footer.less index fe432d390..2ab2346ef 100644 --- a/stories/footer.less +++ b/stories/footer.less @@ -3,15 +3,15 @@ } // Icons -.mw-ui-icon-mf-expand-gray:before { +.mw-ui-icon-mf-arrow-gray:before { background-image: url( ../.resolve-less-imports/images/expand.svg ); } -.mw-ui-icon-minerva-clock:before { +.mw-ui-icon-wikimedia-history-base20:before { background-image: url( ../.resolve-less-imports/images/clock.svg ); } .mw-ui-icon-mf-expand-invert:before, -.mw-ui-icon-minerva-clock-invert:before { +.mw-ui-icon-wikimedia-history-invert:before { filter: brightness( 0 ) invert( 1 ); } diff --git a/stories/lastModifiedBar.stories.js b/stories/lastModifiedBar.stories.js index 4f84e844d..e6af7328f 100644 --- a/stories/lastModifiedBar.stories.js +++ b/stories/lastModifiedBar.stories.js @@ -9,7 +9,7 @@ export default { export const lastModifiedBar = () => withAnnotation( mustache.render( template, { - clockIconClass: 'last-modified-bar__icon mw-ui-icon mw-ui-icon-mw-ui-icon-small mw-ui-icon-minerva-clock', + historyIconClass: 'last-modified-bar__icon mw-ui-icon mw-ui-icon-mw-ui-icon-small mw-ui-icon-wikimedia-history-base20', arrowIconClass: 'mw-ui-icon mw-ui-icon-small mw-ui-icon-mf-expand-gray mf-mw-ui-icon-rotate-anti-clockwise indicator mw-ui-icon-mf-arrow-gray', text: 'Last edited on 20 January 2020, at 18:38', href: "#/wiki/Special:History/Username", @@ -20,7 +20,7 @@ export const lastModifiedBar = () => export const lastModifiedBarActive = () => { const html = mustache.render( template, { - clockIconClass: 'last-modified-bar__icon mw-ui-icon mw-ui-icon-mw-ui-icon-small mw-ui-icon-minerva-clock', + historyIconClass: 'last-modified-bar__icon mw-ui-icon mw-ui-icon-mw-ui-icon-small mw-ui-icon-wikimedia-history-base20', arrowIconClass: 'mw-ui-icon mw-ui-icon-small mw-ui-icon-mf-expand-gray mf-mw-ui-icon-rotate-anti-clockwise indicator mw-ui-icon-mf-arrow-gray', text: 'Last edited on 20 January 2020, at 18:38', href: "#/wiki/Special:History/Username", @@ -35,8 +35,8 @@ export const lastModifiedBarActive = () => { node.querySelector( '.last-modified-bar__text' ).outerHTML = ` Last edited 57 seconds ago by Username`; // invert icons - node.querySelector( '.mw-ui-icon-minerva-clock' ).classList.add( - 'mw-ui-icon-minerva-clock-invert' + node.querySelector( '.mw-ui-icon-wikimedia-history-base20' ).classList.add( + 'mw-ui-icon-wikimedia-history-invert' ); node.querySelector( '.mw-ui-icon-mf-expand-gray' ).classList.add( 'mw-ui-icon-mf-expand-invert'