From 9473e7e0b9c5b5c4fc3e112188c2f0dc428e442a Mon Sep 17 00:00:00 2001 From: Emeke Ajeh Date: Thu, 21 Nov 2024 12:33:16 +0100 Subject: [PATCH] chore: add GA plugin --- docs/.vuepress/config.js | 17 +++++++++++++++-- package.json | 1 + pnpm-lock.yaml | 12 ++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 65556f3c..f939ae3d 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,17 +1,30 @@ import { viteBundler } from '@vuepress/bundler-vite' import { defaultTheme } from '@vuepress/theme-default' import { defineUserConfig } from 'vuepress' -import {shikiPlugin} from "@vuepress/plugin-shiki"; +import { shikiPlugin } from "@vuepress/plugin-shiki"; +import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics' // import { mdEnhancePlugin } from "vuepress-plugin-md-enhance"; // Ref (default theme): https://ecosystem.vuejs.press/themes/default/markdown.html +const isProd = process.env.NODE_ENV === 'production' + +const prodOnlyPlugins = [] +if (isProd) { + prodOnlyPlugins.push( + googleAnalyticsPlugin({ + id: 'G-77TKFH0GYP', + }) + ) +} + export default defineUserConfig({ title: 'Vuejs Dialog (Vue3)', description: 'A lightweight, promise based alert, prompt and confirm dialog', - base: process.env.NODE_ENV === 'production' ? '/vuejs-dialog/' : '/', + base: isProd ? '/vuejs-dialog/' : '/', bundler: viteBundler(), plugins: [ + ...prodOnlyPlugins, // https://ecosystem.vuejs.press/plugins/markdown/prismjs.html // https://ecosystem.vuejs.press/plugins/markdown/shiki.html shikiPlugin({ diff --git a/package.json b/package.json index 36ed0231..2f8e7bbf 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "@vue/test-utils": "^2.4.5", "@vue/tsconfig": "^0.5.1", "@vuepress/bundler-vite": "^2.0.0-rc.15", + "@vuepress/plugin-google-analytics": "2.0.0-rc.54", "@vuepress/plugin-shiki": "^2.0.0-rc.42", "@vuepress/theme-default": "^2.0.0-rc.42", "eslint": "^8.49.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6cfcedb8..e08cc606 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,6 +42,9 @@ importers: '@vuepress/bundler-vite': specifier: ^2.0.0-rc.15 version: 2.0.0-rc.15(@types/node@20.16.5)(sass@1.78.0)(typescript@5.4.5) + '@vuepress/plugin-google-analytics': + specifier: 2.0.0-rc.54 + version: 2.0.0-rc.54(vuepress@2.0.0-rc.15(@vuepress/bundler-vite@2.0.0-rc.15(@types/node@20.16.5)(sass@1.78.0)(typescript@5.4.5))(typescript@5.4.5)(vue@3.5.3(typescript@5.4.5))) '@vuepress/plugin-shiki': specifier: ^2.0.0-rc.42 version: 2.0.0-rc.42(typescript@5.4.5)(vuepress@2.0.0-rc.15(@vuepress/bundler-vite@2.0.0-rc.15(@types/node@20.16.5)(sass@1.78.0)(typescript@5.4.5))(typescript@5.4.5)(vue@3.5.3(typescript@5.4.5))) @@ -970,6 +973,11 @@ packages: peerDependencies: vuepress: 2.0.0-rc.15 + '@vuepress/plugin-google-analytics@2.0.0-rc.54': + resolution: {integrity: sha512-sp9xPpHDHvT8xVrkyn+LCra4VrPJciwC/xL7hMOfKdrkCYlXXGUTz9UXlRWjco3BJunfbxWZECC0Yfolu5qwOw==} + peerDependencies: + vuepress: 2.0.0-rc.18 + '@vuepress/plugin-links-check@2.0.0-rc.42': resolution: {integrity: sha512-nytHpytb7Ytwnp5UrspmOGnp/htKX5xyfYN2FuAEYxXUW5Ysmv5s+urQowO5E/XmcPCL4EnxNMEl3fDjmBLg9Q==} peerDependencies: @@ -3919,6 +3927,10 @@ snapshots: execa: 9.3.1 vuepress: 2.0.0-rc.15(@vuepress/bundler-vite@2.0.0-rc.15(@types/node@20.16.5)(sass@1.78.0)(typescript@5.4.5))(typescript@5.4.5)(vue@3.5.3(typescript@5.4.5)) + '@vuepress/plugin-google-analytics@2.0.0-rc.54(vuepress@2.0.0-rc.15(@vuepress/bundler-vite@2.0.0-rc.15(@types/node@20.16.5)(sass@1.78.0)(typescript@5.4.5))(typescript@5.4.5)(vue@3.5.3(typescript@5.4.5)))': + dependencies: + vuepress: 2.0.0-rc.15(@vuepress/bundler-vite@2.0.0-rc.15(@types/node@20.16.5)(sass@1.78.0)(typescript@5.4.5))(typescript@5.4.5)(vue@3.5.3(typescript@5.4.5)) + '@vuepress/plugin-links-check@2.0.0-rc.42(typescript@5.4.5)(vuepress@2.0.0-rc.15(@vuepress/bundler-vite@2.0.0-rc.15(@types/node@20.16.5)(sass@1.78.0)(typescript@5.4.5))(typescript@5.4.5)(vue@3.5.3(typescript@5.4.5)))': dependencies: '@vuepress/helper': 2.0.0-rc.42(typescript@5.4.5)(vuepress@2.0.0-rc.15(@vuepress/bundler-vite@2.0.0-rc.15(@types/node@20.16.5)(sass@1.78.0)(typescript@5.4.5))(typescript@5.4.5)(vue@3.5.3(typescript@5.4.5)))