From d405e8db15800c999eaaed5dadbe13e5f42c7a73 Mon Sep 17 00:00:00 2001 From: Jordan Kohl Date: Tue, 1 Aug 2023 08:31:26 -0400 Subject: [PATCH] updates to lighthouse v10 (fixes #148) (#180) * updates to lighthouse v10 (fixes #148) * only warn on bf-cache * omit analytics on non-prod --- .github/lighthouserc.js | 1 + .github/workflows/main.yml | 2 +- src/_data/mySite.js | 8 ++++++++ src/_includes/base.njk | 2 +- src/_includes/meta-info.njk | 3 ++- 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 src/_data/mySite.js diff --git a/.github/lighthouserc.js b/.github/lighthouserc.js index 85b8559..de1a3ed 100644 --- a/.github/lighthouserc.js +++ b/.github/lighthouserc.js @@ -11,6 +11,7 @@ module.exports = { "uses-rel-preconnect": "warn", // flags Netlify scripts on deploy preview "csp-xss": "warn", deprecations: "warn", + "bf-cache": "warn", }, }, settings: { diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b804ce9..d1a6c66 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: site_name: "simpixelated" max_timeout: 120 - name: Audit URLs using Lighthouse - uses: treosh/lighthouse-ci-action@v9 + uses: treosh/lighthouse-ci-action@v10 with: urls: | ${{ steps.netlify.outputs.url }} diff --git a/src/_data/mySite.js b/src/_data/mySite.js new file mode 100644 index 0000000..48b0f25 --- /dev/null +++ b/src/_data/mySite.js @@ -0,0 +1,8 @@ +module.exports = function () { + return { + // should be Netlify build context + // "It can be production, deploy-preview, branch-deploy, or dev." + // https://docs.netlify.com/configure-builds/environment-variables/#build-metadata + context: process.env.CONTEXT, + } +} diff --git a/src/_includes/base.njk b/src/_includes/base.njk index 22e98c8..69d35e7 100644 --- a/src/_includes/base.njk +++ b/src/_includes/base.njk @@ -8,7 +8,7 @@ - + {% if mySite.context === 'production' %}{% endif %}
diff --git a/src/_includes/meta-info.njk b/src/_includes/meta-info.njk index 0159d37..ddbf922 100644 --- a/src/_includes/meta-info.njk +++ b/src/_includes/meta-info.njk @@ -40,4 +40,5 @@ {% endif %} - \ No newline at end of file + + \ No newline at end of file