Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Update nuxtjs/plausible (#4716)

Olga Bulatacadc1d1b89d
diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts
index a02f64227..0e8597ecd 100644
--- a/frontend/nuxt.config.ts
+++ b/frontend/nuxt.config.ts
@@ -32,16 +32,22 @@ export default defineNuxtConfig({
deploymentEnv: "local",
apiUrl: "https://api.openverse.org/",
savedSearchCount: 4,
+ site: {
+ trailingSlash: false,
+ },
sentry: {
dsn: "",
environment: "local",
// Release is a build time variable, and as such, is defined in app.config.ts
},
+ plausible: {
+ ignoredHostnames: ["localhost", "staging.openverse.org"],
+ logIgnoredEvents: true,
+ apiHost: "http://localhost:50290",
+ domain: "localhost",
+ },
},
},
- site: {
- trailingSlash: false,
- },
/**
* Disable debug mode to prevent excessive timing logs.
*/
@@ -114,9 +120,4 @@ export default defineNuxtConfig({
trailingSlash: false,
vueI18n: "./src/vue-i18n",
},
- plausible: {
- // `trackLocalhost` is deprecated, but the replacement `ignoredHostnames: []`
- // has a bug, @see https://github.com/nuxt-modules/plausible/issues/30
- trackLocalhost: true,
- },
})
diff --git a/frontend/package.json b/frontend/package.json
index 74e821680..cfd31e2b2 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -25,9 +25,9 @@
"talkback": "node ./test/proxy.js",
"prepare:nuxt": "pnpm i18n:en && npx nuxi prepare",
"test": "pnpm test:unit && pnpm test:playwright",
- "test:unit": "pnpm run i18n:en && vitest run",
- "test:unit:ui": "vitest run --ui",
- "test:unit:coverage": "vitest run --coverage",
+ "test:unit": "pnpm run i18n:en && NUXT_PUBLIC_PLAUSIBLE_ENABLED=false vitest run",
+ "test:unit:ui": "pnpm test:unit --ui",
+ "test:unit:coverage": "pnpm test:unit --coverage",
"test:unit:watch": "pnpm test:unit --collectCoverage=false --watch",
"test:playwright": "./bin/playwright.sh",
"test:playwright:local": "playwright test -c test/playwright",
@@ -62,7 +62,7 @@
"@floating-ui/dom": "^1.6.8",
"@intlify/core-base": "^9.13.1",
"@intlify/message-compiler": "^9.13.1",
- "@nuxtjs/plausible": "^1.0.0",
+ "@nuxtjs/plausible": "^1.0.2",
"@nuxtjs/robots": "^4.0.2",
"@nuxtjs/sitemap": "^5.3.5",
"@nuxtjs/tailwindcss": "^6.12.1",
diff --git a/frontend/src/plugins/03. analytics.ts b/frontend/src/plugins/03. analytics.ts
index 02fe8c887..1ff0a3977 100644
--- a/frontend/src/plugins/03. analytics.ts
+++ b/frontend/src/plugins/03. analytics.ts
@@ -1,13 +1,8 @@
import { defineNuxtPlugin, useTrackEvent } from "#imports"
-import type { Events, EventName } from "~/types/analytics"
+import type { SendCustomEvent } from "~/types/analytics"
import { useUiStore } from "~/stores/ui"
-type SendCustomEvent = <T extends EventName>(
- name: T,
- payload: Events[T]
-) => void
-
export default defineNuxtPlugin(() => {
if (import.meta.server) {
// Inject a noop on the server, as vue-plausible does not support SSR
diff --git a/frontend/src/plugins/errors.ts b/frontend/src/plugins/errors.ts
index 2494cf03f..ab8ac86f4 100644
--- a/frontend/src/plugins/errors.ts
+++ b/frontend/src/plugins/errors.ts
@@ -139,7 +139,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
return {
provide: {
- processFetchingError: processFetchingError,
+ processFetchingError,
},
}
})
diff --git a/frontend/src/types/analytics.ts b/frontend/src/types/analytics.ts
index f69a36de6..307b1ecc5 100644
--- a/frontend/src/types/analytics.ts
+++ b/frontend/src/types/analytics.ts
@@ -484,3 +484,8 @@ export type Events = {
* the name of a custom event sent from the site
*/
export type EventName = keyof Events
+
+export type SendCustomEvent = <T extends EventName>(
+ name: T,
+ payload: Events[T]
+) => void
diff --git a/frontend/test/playwright/playwright.config.ts b/frontend/test/playwright/playwright.config.ts
index aca6a39f5..6ccc3e9d1 100644
--- a/frontend/test/playwright/playwright.config.ts
+++ b/frontend/test/playwright/playwright.config.ts
@@ -27,13 +27,14 @@ const config: PlaywrightTestConfig = {
port: 8443,
reuseExistingServer: !process.env.CI || process.env.PWDEBUG === "1",
env: {
- API_URL,
+ UPDATE_TAPES,
NUXT_PUBLIC_API_URL: API_URL,
- UPDATE_TAPES: UPDATE_TAPES,
NUXT_PUBLIC_DEPLOYMENT_ENV: STAGING,
- NUXT_PUBLIC_PLAUSIBLE_ENABLED: "true",
NUXT_PUBLIC_PLAUSIBLE_DOMAIN: "localhost",
NUXT_PUBLIC_PLAUSIBLE_API_HOST: "http://localhost:50290",
+ NUXT_PUBLIC_PLAUSIBLE_AUTO_PAGEVIEWS: "false",
+ NUXT_PUBLIC_PLAUSIBLE_IGNORED_HOSTNAMES: "[]",
+ NUXT_PUBLIC_SITE_INDEXABLE: "true",
},
},
use: {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 13f40a49a..fca70caec 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -70,8 +70,8 @@ importers:
specifier: ^9.13.1
version: 9.13.1
'@nuxtjs/plausible':
- specifier: ^1.0.0
+ specifier: ^1.0.2
'@nuxtjs/robots':
specifier: ^4.0.2
@@ -548,8 +548,8 @@ packages:
resolution: {integrity: sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==}
engines: {node: '>=6.9.0'}
- '@barbapapazes/[email protected]':
- resolution: {integrity: sha512-4hhXK62ORb4feJfjnIILXRnb6xfejHM6yvGCid6MwNdKiQyj6YLW0M779zXLH5IBS4mQObmrNul2HUleeavSKw==}
+ '@barbapapazes/[email protected]':
+ resolution: {integrity: sha512-su3ut2STFDV+pVCRd0SbCYCA31YWqqEk0Z4/vDMeGvqLMw5hJaQt2mXxbbokIzXTnjODDTeCA/m+TjkHRTWBEg==}
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
@@ -1301,8 +1301,8 @@ packages:
resolution: {integrity: sha512-VHnnjFTTep2oC5++61WY06y4c/h943NyHQh1CRUJQvjsdbGSMX3WQjMGk+X05a3pyPFN70aq0YbgtsEoEoTEjQ==}
engines: {node: ^14.16.0 || >=16.11.0}
- '@nuxtjs/[email protected]':
- resolution: {integrity: sha512-2K0/AbPJAEr3yMA8oDD0I6WB+SXs/YlF297azjR5eSZVQjuimDAwLf4bEXk9ilbrzoMFmm0Tpzn4CC6f0rISBA==}
+ '@nuxtjs/[email protected]':
+ resolution: {integrity: sha512-AT5GoVddqgvbp39OY1/DtWHUgjn+6LGjJXB75imdEUxPok2uAVGtr3oZ0F7merC9T3y0rIqZx8HzpUmCcipBnQ==}
'@nuxtjs/[email protected]':
resolution: {integrity: sha512-7hpAbSXjrzZNZ2vvzJf5E9H8+yVxJlPNY5wP/MSOWlw3pEJzTJQilAFsJj+jofocGj9y3iNDeqv/a5v/Lz8ppg==}
@@ -7116,7 +7116,7 @@ snapshots:
'@babel/helper-validator-identifier': 7.24.7
to-fast-properties: 2.0.0
- '@barbapapazes/[email protected]': {}
+ '@barbapapazes/[email protected]': {}
'@bcoe/[email protected]': {}
@@ -7975,9 +7975,9 @@ snapshots:
- vue
- vue-i18n-bridge
dependencies:
- '@barbapapazes/plausible-tracker': 0.4.0
+ '@barbapapazes/plausible-tracker': 0.5.2
'@nuxt/kit': 3.12.4([email protected])([email protected])
defu: 6.1.4
transitivePeerDependencies: