From c886fcfc67de4c5ae4150602b840954730dc04e1 Mon Sep 17 00:00:00 2001 From: Jeff Sagal Date: Fri, 16 Dec 2022 11:21:58 -0800 Subject: [PATCH] docs(1731): remove GA & allow deploy previews (#1732) --- docs/.vuepress/config/plugins.js | 6 ------ docs/.vuepress/github/clientDynamicModules.js | 9 +++++++++ docs/package.json | 3 +-- docs/yarn.lock | 5 ----- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/docs/.vuepress/config/plugins.js b/docs/.vuepress/config/plugins.js index aa3d259..ace3887 100644 --- a/docs/.vuepress/config/plugins.js +++ b/docs/.vuepress/config/plugins.js @@ -1,12 +1,6 @@ const isDeployPreview = require('./isDeployPreview') module.exports = [ - [ - '@vuepress/google-analytics', - { - ga: isDeployPreview ? '' : 'UA-12818324-8', - }, - ], [ '@vuepress/pwa', { diff --git a/docs/.vuepress/github/clientDynamicModules.js b/docs/.vuepress/github/clientDynamicModules.js index 55fdfe6..c1e842b 100644 --- a/docs/.vuepress/github/clientDynamicModules.js +++ b/docs/.vuepress/github/clientDynamicModules.js @@ -27,6 +27,15 @@ async function getContributors() { * @return {Promise<*[]|ProfileNode[]|postcss.ChildNode[]|Array|[]>} */ async function getSponsors() { + /** + * Deploy previews don't have access to secrets. + * Return early since we don't have a token. + */ + if (process.env['DEPLOY_PREVIEW']) { + console.log('Skipping sponsors because this is a deploy preview.') + return [] + } + const query = ` { user(login: "sagalbot") { diff --git a/docs/package.json b/docs/package.json index 4b676a7..8411f80 100644 --- a/docs/package.json +++ b/docs/package.json @@ -5,13 +5,12 @@ "scripts": { "serve": "vuepress dev", "build": "vuepress build", - "build:preview": "cross-env DEPLOY_PREVIEW=true vuepress build" + "build:preview": "cross-env DEPLOY_PREVIEW=1 vuepress build" }, "devDependencies": { "@octokit/graphql": "^4.3.1", "@popperjs/core": "^2.1.0", "@vuepress/plugin-active-header-links": "^1.4.0", - "@vuepress/plugin-google-analytics": "^1.4.0", "@vuepress/plugin-nprogress": "^1.4.0", "@vuepress/plugin-pwa": "^1.4.0", "@vuepress/plugin-register-components": "^1.4.0", diff --git a/docs/yarn.lock b/docs/yarn.lock index ae06560..9287709 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -1113,11 +1113,6 @@ dependencies: lodash.debounce "^4.0.8" -"@vuepress/plugin-google-analytics@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@vuepress/plugin-google-analytics/-/plugin-google-analytics-1.4.0.tgz#0243da6ff80e47b1d41d0227cb8bcb040ebba90f" - integrity sha512-Q3jTyNovy81vlqfCQ5MewYU2K/brn0DfhAlJJnelXdbYH7XRe1IA3hZCcQQO73rzIMA/HxIsMBWevs8jTQF3QA== - "@vuepress/plugin-last-updated@^1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@vuepress/plugin-last-updated/-/plugin-last-updated-1.4.0.tgz#1657eee410ff5a7431b2a8e88d19e7e44bdc3951"