diff --git a/gatsby-config.js b/gatsby-config.js index e2bc232c9..debafcad1 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -18,6 +18,21 @@ module.exports = { contentPadding: '2rem', maxWidth: '1700px', }, + splitio: { + core: { + authorizationKey: process.env.SPLITIO_AUTH_KEY, + }, + env: { + development: { + features: { + 'developer-website_global-header-gh-buttons': 'on', + }, + core: { + authorizationKey: process.env.SPLITIO_AUTH_KEY || 'localhost', + }, + }, + }, + }, newrelic: { configs: { production: { diff --git a/gatsby-node.js b/gatsby-node.js index 5d4fc0ed9..ce260ae87 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -94,8 +94,14 @@ exports.onCreateNode = ({ node, actions }) => { } }; -exports.onCreateWebpackConfig = ({ actions }) => { +exports.onCreateWebpackConfig = ({ actions, plugins }) => { actions.setWebpackConfig({ + // The `debug` library is causing issues when building the site by including + // invalid JS. This ensures the module resolves to the browser-capatible + // source instead of the node source. See the following issue for this + // recommendation: + // https://github.com/escaladesports/legacy-gatsby-plugin-prefetch-google-fonts/issues/18 + plugins: [plugins.normalModuleReplacement(/^\.\/node\.js/, './browser.js')], externals: { tessen: 'Tessen', }, diff --git a/package-lock.json b/package-lock.json index 2f0e6f492..9974cfb10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4122,9 +4122,9 @@ } }, "@newrelic/gatsby-theme-newrelic": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/@newrelic/gatsby-theme-newrelic/-/gatsby-theme-newrelic-1.7.3.tgz", - "integrity": "sha512-ByE9wPwzlhQNjR2fzYAsYnvmGT1edZ440J7AnvakwzEn/UBVwyTuAAHXu/p7zdt/myqSZ9e3xKSWHD71nSH+Fg==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@newrelic/gatsby-theme-newrelic/-/gatsby-theme-newrelic-1.8.1.tgz", + "integrity": "sha512-FrJHO1XNOiQZeS3IxWWs43wsamFfbQGH65jjs5NspJN6MNm4rmICV0WF4WQXaRG1B3WSquLvImyo8RuKXYDhnQ==", "requires": { "@elastic/react-search-ui": "^1.4.1", "@elastic/react-search-ui-views": "^1.4.1", @@ -4140,6 +4140,7 @@ "gatsby-plugin-use-dark-mode": "^1.1.2", "gatsby-source-filesystem": "^2.3.19", "gatsby-transformer-sharp": "^2.5.11", + "lodash": "^4.17.20", "polished": "^3.6.5", "prism-react-renderer": "^1.1.1", "prismjs": "^1.20.0", @@ -4148,16 +4149,14 @@ "react-simple-code-editor": "^0.11.0", "react-spring": "^8.0.27", "use-dark-mode": "^2.3.1", - "use-media": "^1.4.0" + "use-media": "^1.4.0", + "use-persisted-state": "^0.3.0" }, "dependencies": { - "gatsby-plugin-newrelic": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/gatsby-plugin-newrelic/-/gatsby-plugin-newrelic-1.0.2.tgz", - "integrity": "sha512-TWVysdMSuSRbzAAdHK+aZYxmMPQJDygvT1sKApApJBhVQ79ElBRiBnqIE5vDU26WH6sjqaxf8RlZFzmNWZ6n+A==", - "requires": { - "@babel/runtime": "^7.0.0" - } + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" } } }, @@ -4448,6 +4447,53 @@ "@sinonjs/commons": "^1.7.0" } }, + "@splitsoftware/splitio": { + "version": "10.14.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.14.1.tgz", + "integrity": "sha512-cIjRxl3aIBbMPsmAlOPP/et0sB6byV6inL4xPYjq89WQE7rzA7PcZrue33FlwS2l1M6lDlHlWOq/chNKTCUFzg==", + "requires": { + "@babel/runtime": "^7.10.2", + "@types/google.analytics": "0.0.40", + "@types/node": "^13.9.1", + "events": "3.1.0", + "eventsource": "^1.0.7", + "ioredis": "^4.14.1", + "ip": "1.1.5", + "js-yaml": "3.13.1", + "node-fetch": "^2.6.0", + "object-assign": "^4.1.1", + "unfetch": "^4.1.0", + "utfx": "1.0.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz", + "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "eventsource": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz", + "integrity": "sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==", + "optional": true, + "requires": { + "original": "^1.0.0" + } + } + } + }, + "@splitsoftware/splitio-react": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-react/-/splitio-react-1.2.0.tgz", + "integrity": "sha512-s283fyrefKjIn1Pz1r0pe51I22ioMiQzvKwNPtRR8cFws3I2uhBlhjvR+ArTjDiYfLxaShfjRmTAmjewlZWmKQ==", + "requires": { + "@splitsoftware/splitio": "^10.13.0", + "shallowequal": "^1.1.0" + } + }, "@szmarczak/http-timer": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", @@ -4676,6 +4722,11 @@ "@types/node": "*" } }, + "@types/google.analytics": { + "version": "0.0.40", + "resolved": "https://registry.npmjs.org/@types/google.analytics/-/google.analytics-0.0.40.tgz", + "integrity": "sha512-R3HpnLkqmKxhUAf8kIVvDVGJqPtaaZlW4yowNwjOZUTmYUQEgHh8Nh5wkSXKMroNAuQM8gbXJHmNbbgA8tdb7Q==" + }, "@types/graceful-fs": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.3.tgz", @@ -7656,6 +7707,11 @@ "mimic-response": "^1.0.0" } }, + "cluster-key-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.0.tgz", + "integrity": "sha512-2Nii8p3RwAPiFwsnZvukotvow2rIHM+yQ6ZcBXGHdniadkYGZYiGmkHJIbZPIV9nfv7m/U1IPMVVcAhoWFeklw==" + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -7841,9 +7897,9 @@ } }, "compute-scroll-into-view": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.14.tgz", - "integrity": "sha512-mKDjINe3tc6hGelUMNDzuhorIUZ7kS7BwyY0r2wQd2HOH2tRuJykiC06iSEX8y1TuhNzvz4GcJnK16mM2J1NMQ==" + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.16.tgz", + "integrity": "sha512-a85LHKY81oQnikatZYA90pufpZ6sQx++BoCxOEMsjpZx+ZnaKGQnCyCehTRr/1p9GBIAHTjcU9k71kSYWloLiQ==" }, "concat-map": { "version": "0.0.1", @@ -9039,6 +9095,11 @@ "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" }, + "denque": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz", + "integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ==" + }, "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", @@ -18304,6 +18365,32 @@ "loose-envify": "^1.0.0" } }, + "ioredis": { + "version": "4.17.3", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-4.17.3.tgz", + "integrity": "sha512-iRvq4BOYzNFkDnSyhx7cmJNOi1x/HWYe+A4VXHBu4qpwJaGT1Mp+D2bVGJntH9K/Z/GeOM/Nprb8gB3bmitz1Q==", + "requires": { + "cluster-key-slot": "^1.1.0", + "debug": "^4.1.1", + "denque": "^1.1.0", + "lodash.defaults": "^4.2.0", + "lodash.flatten": "^4.4.0", + "redis-commands": "1.5.0", + "redis-errors": "^1.2.0", + "redis-parser": "^3.0.0", + "standard-as-callback": "^2.0.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + } + } + }, "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -24537,9 +24624,9 @@ } }, "polished": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/polished/-/polished-3.6.5.tgz", - "integrity": "sha512-VwhC9MlhW7O5dg/z7k32dabcAFW1VI2+7fSe8cE/kXcfL7mVdoa5UxciYGW2sJU78ldDLT6+ROEKIZKFNTnUXQ==", + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/polished/-/polished-3.6.6.tgz", + "integrity": "sha512-yiB2ims2DZPem0kCD6V0wnhcVGFEhNh0Iw0axNpKU+oSAgFt6yx6HxIT23Qg0WWvgS379cS35zT4AOyZZRzpQQ==", "requires": { "@babel/runtime": "^7.9.2" } @@ -26383,6 +26470,24 @@ } } }, + "redis-commands": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.5.0.tgz", + "integrity": "sha512-6KxamqpZ468MeQC3bkWmCB1fp56XL64D4Kf0zJSwDZbVLLm7KFkoIcHrgRvQ+sk8dnhySs7+yBg94yIkAK7aJg==" + }, + "redis-errors": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", + "integrity": "sha1-62LSrbFeTq9GEMBK/hUpOEJQq60=" + }, + "redis-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz", + "integrity": "sha1-tm2CjNyv5rS4pCin3vTGvKwxyLQ=", + "requires": { + "redis-errors": "^1.0.0" + } + }, "redux": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/redux/-/redux-4.0.5.tgz", @@ -28466,6 +28571,11 @@ "stacktrace-gps": "^3.0.4" } }, + "standard-as-callback": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.0.1.tgz", + "integrity": "sha512-NQOxSeB8gOI5WjSaxjBgog2QFw55FV8TkS6Y07BiB3VJ8xNTvUYm0wl0s8ObgQ5NhdpnNfigMIKjgPESzgr4tg==" + }, "state-toggle": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.3.tgz", @@ -29668,6 +29778,11 @@ } } }, + "unfetch": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.1.0.tgz", + "integrity": "sha512-crP/n3eAPUJxZXM9T80/yv0YhkTEx2K1D3h7D1AJM6fzsWZrxdyRuLN0JH/dkZh1LNH8LxCnBzoPFCPbb2iGpg==" + }, "unherit": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz", @@ -30299,6 +30414,11 @@ "@use-it/event-listener": "^0.1.2" } }, + "utfx": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utfx/-/utfx-1.0.1.tgz", + "integrity": "sha1-1Ssv1jKpnsqNnUo57s4BSmorAEg=" + }, "utif": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", diff --git a/package.json b/package.json index 14cdc8286..7218fba6c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "@emotion/styled": "^10.0.27", "@mdx-js/mdx": "^1.6.16", "@mdx-js/react": "^1.6.16", - "@newrelic/gatsby-theme-newrelic": "^1.7.3", + "@newrelic/gatsby-theme-newrelic": "^1.8.1", + "@splitsoftware/splitio-react": "^1.2.0", "classnames": "^2.2.6", "date-fns": "^2.15.0", "eslint-plugin-react-hooks": "^4.0.8", diff --git a/src/layouts/MainLayout.js b/src/layouts/MainLayout.js index 24aa6034a..b5ec18484 100644 --- a/src/layouts/MainLayout.js +++ b/src/layouts/MainLayout.js @@ -11,6 +11,7 @@ import MobileHeader from '../components/MobileHeader'; import Sidebar from '../components/Sidebar'; import CookieApprovalDialog from '../components/CookieApprovalDialog'; import '../components/styles.scss'; +import usePageContext from '../hooks/usePageContext'; import { useLocation } from '@reach/router'; const gaTrackingId = 'UA-3047412-33'; @@ -18,7 +19,7 @@ const gdprConsentCookieName = 'newrelic-gdpr-consent'; const MainLayout = ({ children }) => { const { - site: { layout }, + site: { layout, siteMetadata }, } = useStaticQuery(graphql` query { site { @@ -26,13 +27,23 @@ const MainLayout = ({ children }) => { contentPadding maxWidth } + siteMetadata { + repository + } } } `); const location = useLocation(); + const { fileRelativePath } = usePageContext(); const [cookieConsent, setCookieConsent] = useState(false); const [isMobileNavOpen, setIsMobileNavOpen] = useState(false); + const isComponentDoc = fileRelativePath.includes( + 'src/markdown-pages/components' + ); + const editUrl = isComponentDoc + ? null + : `${siteMetadata.repository}/blob/main/${fileRelativePath}`; useEffect(() => { const consentValue = Cookies.get(gdprConsentCookieName) === 'true'; @@ -68,7 +79,7 @@ const MainLayout = ({ children }) => { ) : null} - +