diff --git a/.github/workflows/update visual snapshots.yml b/.github/workflows/update visual snapshots.yml index a16d5934bf2..b7ac9e205a9 100644 --- a/.github/workflows/update visual snapshots.yml +++ b/.github/workflows/update visual snapshots.yml @@ -48,9 +48,7 @@ jobs: luarocks install --lua-version=5.1 busted - name: Update snapshots - run: npm run lua-test - env: - UPDATE_SNAPSHOTS: true + run: npm run update-snapshots - name: Commit and push if snapshots changed uses: stefanzweifel/git-auto-commit-action@v7 diff --git a/lua/spec/helpers/template.html b/lua/spec/helpers/template.html index f6cf89ebb6e..8f155e709dc 100644 --- a/lua/spec/helpers/template.html +++ b/lua/spec/helpers/template.html @@ -4,8 +4,8 @@ Liquipedia - - + + diff --git a/package.json b/package.json index 46262a788dd..fc675dc336c 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,11 @@ "lint:scss:ci": "stylelint \"stylesheets/**/*.scss\" --custom-formatter @csstools/stylelint-formatter-github", "test:js": "jest", "compile:scss": "sass stylesheets/Main.scss lua/output/css/main.css", + "fetch:remote-css": "bash scripts/fetch-remote-css.sh", "build:css": "npm run compile:scss", "build:js": "node build-js.js", "build": "npm run build:css && npm run build:js", "lua-test": "npm run build:css && busted -C lua", - "update-snapshots": "UPDATE_SNAPSHOTS=true npm run lua-test" + "update-snapshots": "npm run fetch:remote-css && UPDATE_SNAPSHOTS=true npm run lua-test" } } diff --git a/scripts/fetch-remote-css.sh b/scripts/fetch-remote-css.sh new file mode 100644 index 00000000000..208289e9d7a --- /dev/null +++ b/scripts/fetch-remote-css.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +# The styles liquipedia.net serves for the lakesideview skin, fetched once per +# run rather than once per snapshot. +# TODO: We might in the future make the cacheversion dynamic +URL='https://liquipedia.net/commons/load.php?cacheversion=cipipeline&lang=en&modules=fontawesome-pro|ext.TeamLiquidIntegration.liquipedia-custom-icon|skins.lakesideview.mw|skins.lakesideview.theme.commons&only=styles&skin=lakesideview' +ORIGIN='https://liquipedia.net' +OUTPUT='lua/output/css/lakeside.css' + +cd "$(dirname "$0")/.." +mkdir -p "$(dirname "$OUTPUT")" + +# The sed puts back the origin on fonts, logos and icons, which the bundle +# references from the site root, as both url(/x) and url("/x"). Off the local +# filesystem those resolve nowhere. +curl -fsS --compressed --max-time 30 "$URL" \ + | sed -E 's|url\((["'\'']?)/|url(\1'"$ORIGIN"'/|g' > "$OUTPUT"