From 8b3e7e6f2ff0b94c2d58f86cbbaafd19ad6043db Mon Sep 17 00:00:00 2001 From: Zach Shilton <4624598+zchsh@users.noreply.github.com> Date: Thu, 18 Mar 2021 12:24:36 -0400 Subject: [PATCH] website: use revised remote-plugin-docs server implementation - also bumps to stable docs-page, and makes related api changes for intro and guides routes --- .../components/remote-plugin-docs/server.js | 49 +-- website/data/docs-remote-plugins.json | 3 +- website/package-lock.json | 402 ++++++------------ website/package.json | 6 +- website/pages/docs/[[...page]].jsx | 8 +- website/pages/guides/[[...page]].jsx | 17 +- website/pages/intro/[[...page]].jsx | 17 +- 7 files changed, 166 insertions(+), 336 deletions(-) diff --git a/website/components/remote-plugin-docs/server.js b/website/components/remote-plugin-docs/server.js index a7d699e57..9b00b6f92 100644 --- a/website/components/remote-plugin-docs/server.js +++ b/website/components/remote-plugin-docs/server.js @@ -3,13 +3,9 @@ import path from 'path' import { getNodeFromPath, getPathsFromNavData, - validateNavData, } from '@hashicorp/react-docs-page/server' import renderPageMdx from '@hashicorp/react-docs-page/render-page-mdx' -import fetchGithubFile from './utils/fetch-github-file' -import mergeRemotePlugins from './utils/merge-remote-plugins' - -const IS_DEV = process.env.VERCEL_ENV !== 'production' +import resolveNavData from './utils/resolve-nav-data' async function generateStaticPaths(navDataFile, contentDir, options = {}) { const navData = await resolveNavData(navDataFile, contentDir, options) @@ -21,7 +17,8 @@ async function generateStaticProps( navDataFile, localContentDir, params, - { productName, remotePluginsFile, additionalComponents } = {} + product, + { remotePluginsFile, additionalComponents, mainBranch = 'main' } = {} ) { const navData = await resolveNavData(navDataFile, localContentDir, { remotePluginsFile, @@ -30,12 +27,15 @@ async function generateStaticProps( const navNode = getNodeFromPath(pathToMatch, navData, localContentDir) const { filePath, remoteFile, pluginTier } = navNode // Fetch the MDX file content - const [err, mdxString] = filePath - ? // Read local content from the filesystem - [null, fs.readFileSync(path.join(process.cwd(), filePath), 'utf8')] - : // Fetch remote content using GitHub's API - await fetchGithubFile(remoteFile) - if (err) throw new Error(err) + const mdxString = remoteFile + ? remoteFile.fileString + : fs.readFileSync(path.join(process.cwd(), filePath), 'utf8') + // Construct the githubFileUrl, used for "Edit this page" link + // Note: for custom ".docs-artifacts" directories, the "Edit this page" + // link will lead to the artifact file rather than the "docs" source file + const githubFileUrl = remoteFile + ? remoteFile.sourceUrl + : `https://github.com/hashicorp/${product.slug}/blob/${mainBranch}/website/${filePath}` // For plugin pages, prefix the MDX content with a // label that reflects the plugin tier // (current options are "Official" or "Community") @@ -48,41 +48,22 @@ async function generateStaticProps( } const { mdxSource, frontMatter } = await renderPageMdx(mdxString, { additionalComponents, - productName, + productName: product.name, mdxContentHook, }) // Build the currentPath from page parameters const currentPath = !params.page ? '' : params.page.join('/') - // In development, set a flag if there is no GITHUB_API_TOKEN, - // as this means dev is seeing only local content, and we want to flag that - const isDevMissingRemotePlugins = IS_DEV && !process.env.GITHUB_API_TOKEN + return { currentPath, frontMatter, - isDevMissingRemotePlugins, mdxSource, mdxString, + githubFileUrl, navData, navNode, } } -async function resolveNavData(navDataFile, localContentDir, options = {}) { - const { remotePluginsFile } = options - // Read in files - const navDataPath = path.join(process.cwd(), navDataFile) - const navData = JSON.parse(fs.readFileSync(navDataPath, 'utf8')) - const remotePluginsPath = path.join(process.cwd(), remotePluginsFile) - const remotePlugins = JSON.parse(fs.readFileSync(remotePluginsPath, 'utf-8')) - // Resolve plugins, this yields branches with NavLeafRemote nodes - const withPlugins = await mergeRemotePlugins(remotePlugins, navData, IS_DEV) - // Resolve local filePaths for NavLeaf nodes - const withFilePaths = await validateNavData(withPlugins, localContentDir) - // Return the nav data with: - // 1. Plugins merged, transformed into navData structures with NavLeafRemote nodes - // 2. filePaths added to all local NavLeaf nodes - return withFilePaths -} - export default { generateStaticPaths, generateStaticProps } export { generateStaticPaths, generateStaticProps } diff --git a/website/data/docs-remote-plugins.json b/website/data/docs-remote-plugins.json index 8c247cfab..ab7aecb94 100644 --- a/website/data/docs-remote-plugins.json +++ b/website/data/docs-remote-plugins.json @@ -2,6 +2,7 @@ { "title": "Docker", "path": "docker", - "repo": "hashicorp/packer-plugin-docker" + "repo": "hashicorp/packer-plugin-docker", + "version": "v0.0.4" } ] diff --git a/website/package-lock.json b/website/package-lock.json index 1a542e882..e2585dfd9 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -5,118 +5,118 @@ "requires": true, "dependencies": { "@algolia/cache-browser-local-storage": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.8.3.tgz", - "integrity": "sha512-Cwc03hikHSUI+xvgUdN+H+f6jFyoDsC9fegzXzJ2nPn1YSN9EXzDMBnbrgl0sbl9iLGXe0EIGMYqR2giCv1wMQ==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.8.6.tgz", + "integrity": "sha512-Bam7otzjIEgrRXWmk0Amm1+B3ROI5dQnUfJEBjIy0YPM0kMahEoJXCw6160tGKxJLl1g6icoC953nGshQKO7cA==", "requires": { - "@algolia/cache-common": "4.8.3" + "@algolia/cache-common": "4.8.6" } }, "@algolia/cache-common": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.8.3.tgz", - "integrity": "sha512-Cf7zZ2i6H+tLSBTkFePHhYvlgc9fnMPKsF9qTmiU38kFIGORy/TN2Fx5n1GBuRLIzaSXvcf+oHv1HvU0u1gE1g==" + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.8.6.tgz", + "integrity": "sha512-eGQlsXU5G7n4RvV/K6qe6lRAeL6EKAYPT3yZDBjCW4pAh7JWta+77a7BwUQkTqXN1MEQWZXjex3E4z/vFpzNrg==" }, "@algolia/cache-in-memory": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.8.3.tgz", - "integrity": "sha512-+N7tkvmijXiDy2E7u1mM73AGEgGPWFmEmPeJS96oT46I98KXAwVPNYbcAqBE79YlixdXpkYJk41cFcORzNh+Iw==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.8.6.tgz", + "integrity": "sha512-kbJrvCFANxL/l5Pq1NFyHLRphKDwmqcD/OJga0IbNKEulRGDPkt1+pC7/q8d2ikP12adBjLLg2CVias9RJpIaw==", "requires": { - "@algolia/cache-common": "4.8.3" + "@algolia/cache-common": "4.8.6" } }, "@algolia/client-account": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.8.3.tgz", - "integrity": "sha512-Uku8LqnXBwfDCtsTCDYTUOz2/2oqcAQCKgaO0uGdIR8DTQENBXFQvzziambHdn9KuFuY+6Et9k1+cjpTPBDTBg==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.8.6.tgz", + "integrity": "sha512-FQVJE/BgCb78jtG7V0r30sMl9P5JKsrsOacGtGF2YebqI0YF25y8Z1nO39lbdjahxUS3QkDw2d0P2EVMj65g2Q==", "requires": { - "@algolia/client-common": "4.8.3", - "@algolia/client-search": "4.8.3", - "@algolia/transporter": "4.8.3" + "@algolia/client-common": "4.8.6", + "@algolia/client-search": "4.8.6", + "@algolia/transporter": "4.8.6" } }, "@algolia/client-analytics": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.8.3.tgz", - "integrity": "sha512-9ensIWmjYJprZ+YjAVSZdWUG05xEnbytENXp508X59tf34IMIX8BR2xl0RjAQODtxBdAteGxuKt5THX6U9tQLA==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.8.6.tgz", + "integrity": "sha512-ZBYFUlzNaWDFtt0rYHI7xbfVX0lPWU9lcEEXI/BlnkRgEkm247H503tNatPQFA1YGkob52EU18sV1eJ+OFRBLA==", "requires": { - "@algolia/client-common": "4.8.3", - "@algolia/client-search": "4.8.3", - "@algolia/requester-common": "4.8.3", - "@algolia/transporter": "4.8.3" + "@algolia/client-common": "4.8.6", + "@algolia/client-search": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" } }, "@algolia/client-common": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.8.3.tgz", - "integrity": "sha512-TU3623AEFAWUQlDTznkgAMSYo8lfS9pNs5QYDQzkvzWdqK0GBDWthwdRfo9iIsfxiR9qdCMHqwEu+AlZMVhNSA==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.8.6.tgz", + "integrity": "sha512-8dI+K3Nvbes2YRZm2LY7bdCUD05e60BhacrMLxFuKxnBGuNehME1wbxq/QxcG1iNFJlxLIze5TxIcNN3+pn76g==", "requires": { - "@algolia/requester-common": "4.8.3", - "@algolia/transporter": "4.8.3" + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" } }, "@algolia/client-recommendation": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/client-recommendation/-/client-recommendation-4.8.3.tgz", - "integrity": "sha512-qysGbmkcc6Agt29E38KWJq9JuxjGsyEYoKuX9K+P5HyQh08yR/BlRYrA8mB7vT/OIUHRGFToGO6Vq/rcg0NIOQ==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-recommendation/-/client-recommendation-4.8.6.tgz", + "integrity": "sha512-Kg8DpjwvaWWujNx6sAUrSL+NTHxFe/UNaliCcSKaMhd3+FiPXN+CrSkO0KWR7I+oK2qGBTG/2Y0BhFOJ5/B/RA==", "requires": { - "@algolia/client-common": "4.8.3", - "@algolia/requester-common": "4.8.3", - "@algolia/transporter": "4.8.3" + "@algolia/client-common": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" } }, "@algolia/client-search": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.8.3.tgz", - "integrity": "sha512-rAnvoy3GAhbzOQVniFcKVn1eM2NX77LearzYNCbtFrFYavG+hJI187bNVmajToiuGZ10FfJvK99X2OB1AzzezQ==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.8.6.tgz", + "integrity": "sha512-vXLS6umL/9G3bwqc6pkrS9K5/s8coq55mpfRARL+bs0NsToOf77WSTdwzlxv/KdbVF7dHjXgUpBvJ6RyR4ZdAw==", "requires": { - "@algolia/client-common": "4.8.3", - "@algolia/requester-common": "4.8.3", - "@algolia/transporter": "4.8.3" + "@algolia/client-common": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/transporter": "4.8.6" } }, "@algolia/logger-common": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.8.3.tgz", - "integrity": "sha512-03wksHRbhl2DouEKnqWuUb64s1lV6kDAAabMCQ2Du1fb8X/WhDmxHC4UXMzypeOGlH5BZBsgVwSB7vsZLP3MZg==" + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.8.6.tgz", + "integrity": "sha512-FMRxZGdDxSzd0/Mv0R1021FvUt0CcbsQLYeyckvSWX8w+Uk4o0lcV6UtZdERVR5XZsGOqoXLMIYDbR2vkbGbVw==" }, "@algolia/logger-console": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.8.3.tgz", - "integrity": "sha512-Npt+hI4UF8t3TLMluL5utr9Gc11BjL5kDnGZOhDOAz5jYiSO2nrHMFmnpLT4Cy/u7a5t7EB5dlypuC4/AGStkA==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.8.6.tgz", + "integrity": "sha512-TYw9lwUCjvApC6Z0zn36T6gkCl7hbfJmnU+Z/D8pFJ3Yp7lz06S3oWGjbdrULrYP1w1VOhjd0X7/yGNsMhzutQ==", "requires": { - "@algolia/logger-common": "4.8.3" + "@algolia/logger-common": "4.8.6" } }, "@algolia/requester-browser-xhr": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.8.3.tgz", - "integrity": "sha512-/LTTIpgEmEwkyhn8yXxDdBWqXqzlgw5w2PtTpIwkSlP2/jDwdR/9w1TkFzhNbJ81ki6LAEQM5mSwoTTnbIIecg==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.8.6.tgz", + "integrity": "sha512-omh6uJ3CJXOmcrU9M3/KfGg8XkUuGJGIMkqEbkFvIebpBJxfs6TVs0ziNeMFAcAfhi8/CGgpLbDSgJtWdGQa6w==", "requires": { - "@algolia/requester-common": "4.8.3" + "@algolia/requester-common": "4.8.6" } }, "@algolia/requester-common": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.8.3.tgz", - "integrity": "sha512-+Yo9vBkofoKR1SCqqtMnmnfq9yt/BiaDewY/6bYSMNxSYCnu2Fw1JKSIaf/4zos09PMSsxGpLohZwGas3+0GDQ==" + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.8.6.tgz", + "integrity": "sha512-r5xJqq/D9KACkI5DgRbrysVL5DUUagikpciH0k0zjBbm+cXiYfpmdflo/h6JnY6kmvWgjr/4DoeTjKYb/0deAQ==" }, "@algolia/requester-node-http": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.8.3.tgz", - "integrity": "sha512-k2fiKIeMIFqgC01FnzII6kqC2GQBAfbNaUX4k7QCPa6P8t4sp2xE6fImOUiztLnnL3C9X9ZX6Fw3L+cudi7jvQ==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.8.6.tgz", + "integrity": "sha512-TB36OqTVOKyHCOtdxhn/IJyI/NXi/BWy8IEbsiWwwZWlL79NWHbetj49jXWFolEYEuu8PgDjjZGpRhypSuO9XQ==", "requires": { - "@algolia/requester-common": "4.8.3" + "@algolia/requester-common": "4.8.6" } }, "@algolia/transporter": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.8.3.tgz", - "integrity": "sha512-nU7fy2iU8snxATlsks0MjMyv97QJWQmOVwTjDc+KZ4+nue8CLcgm4LA4dsTBqvxeCQIoEtt3n72GwXcaqiJSjQ==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.8.6.tgz", + "integrity": "sha512-NRb31J0TP7EPoVMpXZ4yAtr61d26R8KGaf6qdULknvq5sOVHuuH4PwmF08386ERfIsgnM/OBhl+uzwACdCIjSg==", "requires": { - "@algolia/cache-common": "4.8.3", - "@algolia/logger-common": "4.8.3", - "@algolia/requester-common": "4.8.3" + "@algolia/cache-common": "4.8.6", + "@algolia/logger-common": "4.8.6", + "@algolia/requester-common": "4.8.6" } }, "@ampproject/toolbox-core": { @@ -2854,12 +2854,12 @@ "integrity": "sha512-AYIe6tcOxlKPe5Sq89o/Vk0rGE6Z1dCzf+N3ynECTh5L2A1zusf9xeM659QEh/edE/Ll9EBBLmq49sQXLNDxTw==" }, "@hashicorp/react-docs-page": { - "version": "10.9.4-alpha.18", - "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-page/-/react-docs-page-10.9.4-alpha.18.tgz", - "integrity": "sha512-+eRKJ2PX9s4Is0ZT2O8ZBcBWuDt7OGxwBrqKF1ulo/DcZunj7pODCQQulb+jAtQyq7YzikWdFmQ/pcvwaVHK6Q==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-page/-/react-docs-page-11.0.1.tgz", + "integrity": "sha512-BZ746Qm97OQTyMPI7calYDb+LAQQZGTn/vZ8FaMXbVCF+X9Bvs1xYyWRDV6gV0mtgmlkCwYqIrmqneOZdd6PcA==", "requires": { "@hashicorp/react-content": "^6.3.0", - "@hashicorp/react-docs-sidenav": "6.1.1-alpha.16", + "@hashicorp/react-docs-sidenav": "^7.0.0", "@hashicorp/react-head": "^1.2.0", "@hashicorp/react-search": "^4.1.0", "fs-exists-sync": "0.1.0", @@ -2870,121 +2870,6 @@ "readdirp": "3.5.0" }, "dependencies": { - "@algolia/cache-browser-local-storage": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.8.5.tgz", - "integrity": "sha512-9rs/Yi82ilgifweJamOy4DlJ4xPGsCN/zg+RKy4vjytNhOrkEHLRQC8vPZ3OhD8KVlw9lRQIZTlgjgFl8iMeeA==", - "requires": { - "@algolia/cache-common": "4.8.5" - } - }, - "@algolia/cache-common": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.8.5.tgz", - "integrity": "sha512-4SvRWnagKtwBFAy8Rsfmv0/Uk53fZL+6dy2idwdx6SjMGKSs0y1Qv+thb4h/k/H5MONisAoT9C2rgZ/mqwh5yw==" - }, - "@algolia/cache-in-memory": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.8.5.tgz", - "integrity": "sha512-XBBfqs28FbjwLboY3sxvuzBgYsuXdFsj2mUvkgxfb0GVEzwW4I0NM7KzSPwT+iht55WS1PgIOnynjmhPsrubCw==", - "requires": { - "@algolia/cache-common": "4.8.5" - } - }, - "@algolia/client-account": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.8.5.tgz", - "integrity": "sha512-DjXMpeCdY4J4IDBfowiG6Xl9ec/FhG1NpPQM0Uv4xXsc/TeeZ1JgbgNDhWe9jW0jBEALy+a/RmPrZ0vsxcadsg==", - "requires": { - "@algolia/client-common": "4.8.5", - "@algolia/client-search": "4.8.5", - "@algolia/transporter": "4.8.5" - } - }, - "@algolia/client-analytics": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.8.5.tgz", - "integrity": "sha512-PQEY+chbHmZnRJdaWsvUYzDpEPr60az0EPUexdouvXGZId15/SnDaXjnf89F7tYmCzkHdUtG4bSvPzAupQ4AFA==", - "requires": { - "@algolia/client-common": "4.8.5", - "@algolia/client-search": "4.8.5", - "@algolia/requester-common": "4.8.5", - "@algolia/transporter": "4.8.5" - } - }, - "@algolia/client-common": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.8.5.tgz", - "integrity": "sha512-Dn8vog2VrGsJeOcBMcSAEIjBtPyogzUBGlh1DtVd0m8GN6q+cImCESl6DY846M2PTYWsLBKBksq37eUfSe9FxQ==", - "requires": { - "@algolia/requester-common": "4.8.5", - "@algolia/transporter": "4.8.5" - } - }, - "@algolia/client-recommendation": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/client-recommendation/-/client-recommendation-4.8.5.tgz", - "integrity": "sha512-ffawCC1C25rCa8/JU2niRZgwr8aV9b2qsLVMo73GXFzi2lceXPAe9K68mt/BGHU+w7PFUwVHsV2VmB+G/HQRVw==", - "requires": { - "@algolia/client-common": "4.8.5", - "@algolia/requester-common": "4.8.5", - "@algolia/transporter": "4.8.5" - } - }, - "@algolia/client-search": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.8.5.tgz", - "integrity": "sha512-Ru2MljGZWrSQ0CVsDla11oGEPL/RinmVkLJfBtQ+/pk1868VfpAQFGKtOS/b8/xLrMA0Vm4EfC3Mgclk/p3KJA==", - "requires": { - "@algolia/client-common": "4.8.5", - "@algolia/requester-common": "4.8.5", - "@algolia/transporter": "4.8.5" - } - }, - "@algolia/logger-common": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.8.5.tgz", - "integrity": "sha512-PS6NS6bpED0rAxgCPGhjZJg9why0PnoVEE7ZoCbPq6lsAOc6FPlQLri4OiLyU7wx8RWDoVtOadyzulqAAsfPSQ==" - }, - "@algolia/logger-console": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.8.5.tgz", - "integrity": "sha512-3+4gLSbwzuGmrb5go3IZNcFIYVMSbB4c8UMtWEJ/gDBtgGZIvT6f/KlvVSOHIhthSxaM3Y13V6Qile/SpGqc6A==", - "requires": { - "@algolia/logger-common": "4.8.5" - } - }, - "@algolia/requester-browser-xhr": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.8.5.tgz", - "integrity": "sha512-M/Gf2vv/fU4+CqDW+wok7HPpEcLym3NtDzU9zaPzGYI/9X7o36581oyfnzt2pNfsXSQVj5a2pZVUWC3Z4SO27w==", - "requires": { - "@algolia/requester-common": "4.8.5" - } - }, - "@algolia/requester-common": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.8.5.tgz", - "integrity": "sha512-OIhsdwIrJVAlVlP7cwlt+RoR5AmxAoTGrFokOY9imVmgqXUUljdKO/DjhRL8vwYGFEidZ9efIjAIQ2B3XOhT9A==" - }, - "@algolia/requester-node-http": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.8.5.tgz", - "integrity": "sha512-viHAjfo53A3VSE7Bb/nzgpSMZ3prPp2qti7Wg8w7qxhntppKp3Fln6t4Vp+BoPOqruLsj139xXhheAKeRcYa0w==", - "requires": { - "@algolia/requester-common": "4.8.5" - } - }, - "@algolia/transporter": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.8.5.tgz", - "integrity": "sha512-Rb3cMlh/GoJK0+g+49GNA3IvR/EXsDEBwpyM+FOotSwxgiGt1wGBHM0K2v0GHwIEcuww02pl6KMDVlilA+qh0g==", - "requires": { - "@algolia/cache-common": "4.8.5", - "@algolia/logger-common": "4.8.5", - "@algolia/requester-common": "4.8.5" - } - }, "@hashicorp/react-content": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/@hashicorp/react-content/-/react-content-6.3.0.tgz", @@ -3016,73 +2901,23 @@ "search-insights": "^1.6.0", "unist-util-visit": "^2.0.3" } - }, - "algoliasearch": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.8.5.tgz", - "integrity": "sha512-GjKjpeevpePEJYinGokASNtIkl1t5EseNMlqDNAc+sXE8+iyyeqTyiJsN7bwlRG2BIremuslE/NlwdEfUuBLJw==", - "requires": { - "@algolia/cache-browser-local-storage": "4.8.5", - "@algolia/cache-common": "4.8.5", - "@algolia/cache-in-memory": "4.8.5", - "@algolia/client-account": "4.8.5", - "@algolia/client-analytics": "4.8.5", - "@algolia/client-common": "4.8.5", - "@algolia/client-recommendation": "4.8.5", - "@algolia/client-search": "4.8.5", - "@algolia/logger-common": "4.8.5", - "@algolia/logger-console": "4.8.5", - "@algolia/requester-browser-xhr": "4.8.5", - "@algolia/requester-common": "4.8.5", - "@algolia/requester-node-http": "4.8.5", - "@algolia/transporter": "4.8.5" - } - }, - "algoliasearch-helper": { - "version": "3.4.4", - "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-3.4.4.tgz", - "integrity": "sha512-OjyVLjykaYKCMxxRMZNiwLp8CS310E0qAeIY2NaublcmLAh8/SL19+zYHp7XCLtMem2ZXwl3ywMiA32O9jszuw==", - "requires": { - "events": "^1.1.1" - } - }, - "events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" - }, - "react-instantsearch-core": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/react-instantsearch-core/-/react-instantsearch-core-6.10.0.tgz", - "integrity": "sha512-bn8rh/od4nw43caOiAsArA2Pw/JXX/7jL+nYe0n/Se66P7VR7UIA1i1ycthOrJzXCn9iNVFJFNMfyAN0HYVaWg==", - "requires": { - "@babel/runtime": "^7.1.2", - "algoliasearch-helper": "^3.4.3", - "prop-types": "^15.6.2", - "react-fast-compare": "^3.0.0" - } - }, - "react-instantsearch-dom": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/react-instantsearch-dom/-/react-instantsearch-dom-6.10.0.tgz", - "integrity": "sha512-t1IGn1i4btp9a8wNNV/OCYwfJwCx5CuCP6WNwBxYY1QeL27RKGaWPxvz6FjfRFCfrOvD2556STyvVriyGhDoeg==", - "requires": { - "@babel/runtime": "^7.1.2", - "algoliasearch-helper": "^3.4.3", - "classnames": "^2.2.5", - "prop-types": "^15.6.2", - "react-fast-compare": "^3.0.0", - "react-instantsearch-core": "^6.10.0" - } } } }, "@hashicorp/react-docs-sidenav": { - "version": "6.1.1-alpha.16", - "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-sidenav/-/react-docs-sidenav-6.1.1-alpha.16.tgz", - "integrity": "sha512-RpPjNwMNe5L2LA1vvgp496CauVJ8wLnKge1lPBZKL5931jR1SFEMwuWLB8R6Pe2HmkIC55nPB/c43GrmPN4FFw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-sidenav/-/react-docs-sidenav-7.0.0.tgz", + "integrity": "sha512-gzOEG4fwfdfdHvxMuRC73bZUIpUzSPrG826NIM4N0lqUPzsAkDsfEl2+Vg1ZVfgzy2+41E+lIpHW4ZmWc5OZ7A==", "requires": { + "@hashicorp/react-link-wrap": "^2.0.2", "fuzzysearch": "1.0.3" + }, + "dependencies": { + "@hashicorp/react-link-wrap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@hashicorp/react-link-wrap/-/react-link-wrap-2.0.2.tgz", + "integrity": "sha512-q8s2TTd9Uy3BSYyUe2TTr2Kbc0ViRc7XQga2fZI0bzlFqBTiMXtf6gh2cg3QvimHY42y4YtaO5C109V9ahMUpQ==" + } } }, "@hashicorp/react-enterprise-alert": { @@ -3183,17 +3018,17 @@ } }, "@hashicorp/react-search": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@hashicorp/react-search/-/react-search-3.0.0.tgz", - "integrity": "sha512-62ttyCxjVFSHz1aNbdjeOcqCezpk3dLhMWTXeQb9Zsi0JYaJdBzK1M9khW1bfozTzjTXXGd/B79orlHMj/Zo9A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@hashicorp/react-search/-/react-search-4.2.0.tgz", + "integrity": "sha512-ITj3UC06w+bZKrHv77kYdtWlEH9gbtk+pAzZ5ZRxt2GMnw8qMzWnXZKVf1yHvyKAKkHkGXA5s+uFElxRJj3AVQ==", "requires": { "@hashicorp/react-inline-svg": "^1.0.2", "@hashicorp/remark-plugins": "^3.0.0", - "algoliasearch": "^4.4.0", + "algoliasearch": "^4.8.4", "dotenv": "^8.2.0", "glob": "^7.1.6", "gray-matter": "^4.0.2", - "react-instantsearch-dom": "^6.7.0", + "react-instantsearch-dom": "^6.9.0", "remark": "^12.0.1", "search-insights": "^1.6.0", "unist-util-visit": "^2.0.3" @@ -3927,6 +3762,11 @@ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==" }, + "adm-zip": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.4.tgz", + "integrity": "sha512-GMQg1a1cAegh+/EgWbz+XHZrwB467iB/IgtToldvxs7Xa5Br8mPmvCeRfY/Un2fLzrlIPt6Yu7Cej+8Ut9TGPg==" + }, "agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -3973,30 +3813,30 @@ "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==" }, "algoliasearch": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.8.3.tgz", - "integrity": "sha512-pljX9jEE2TQ3i1JayhG8afNdE8UuJg3O9c7unW6QO67yRWCKr6b0t5aKC3hSVtjt7pA2TQXLKoAISb4SHx9ozQ==", + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.8.6.tgz", + "integrity": "sha512-G8IA3lcgaQB4r9HuQ4G+uSFjjz0Wv2OgEPiQ8emA+G2UUlroOfMl064j1bq/G+QTW0LmTQp9JwrFDRWxFM9J7w==", "requires": { - "@algolia/cache-browser-local-storage": "4.8.3", - "@algolia/cache-common": "4.8.3", - "@algolia/cache-in-memory": "4.8.3", - "@algolia/client-account": "4.8.3", - "@algolia/client-analytics": "4.8.3", - "@algolia/client-common": "4.8.3", - "@algolia/client-recommendation": "4.8.3", - "@algolia/client-search": "4.8.3", - "@algolia/logger-common": "4.8.3", - "@algolia/logger-console": "4.8.3", - "@algolia/requester-browser-xhr": "4.8.3", - "@algolia/requester-common": "4.8.3", - "@algolia/requester-node-http": "4.8.3", - "@algolia/transporter": "4.8.3" + "@algolia/cache-browser-local-storage": "4.8.6", + "@algolia/cache-common": "4.8.6", + "@algolia/cache-in-memory": "4.8.6", + "@algolia/client-account": "4.8.6", + "@algolia/client-analytics": "4.8.6", + "@algolia/client-common": "4.8.6", + "@algolia/client-recommendation": "4.8.6", + "@algolia/client-search": "4.8.6", + "@algolia/logger-common": "4.8.6", + "@algolia/logger-console": "4.8.6", + "@algolia/requester-browser-xhr": "4.8.6", + "@algolia/requester-common": "4.8.6", + "@algolia/requester-node-http": "4.8.6", + "@algolia/transporter": "4.8.6" } }, "algoliasearch-helper": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-3.3.4.tgz", - "integrity": "sha512-1Ts2XcgGdjGlDrp3v6zbY8VW+X9+jJ5rBmtPBmXOQLd4b5t/LpJlaBdxoAnlMfVFjywP7KSAdmyFUNNYVHDyRQ==", + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-3.4.4.tgz", + "integrity": "sha512-OjyVLjykaYKCMxxRMZNiwLp8CS310E0qAeIY2NaublcmLAh8/SL19+zYHp7XCLtMem2ZXwl3ywMiA32O9jszuw==", "requires": { "events": "^1.1.1" }, @@ -11653,27 +11493,27 @@ "integrity": "sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==" }, "react-instantsearch-core": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/react-instantsearch-core/-/react-instantsearch-core-6.8.2.tgz", - "integrity": "sha512-UdAjcNIXb2mSECEDS/2XuB4W6rcbnph1NjJBUpY5TLLzSCdKXNTzS2PxF5hkdeuY0L/m/hvDQX6YqxV28PqKLA==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/react-instantsearch-core/-/react-instantsearch-core-6.10.3.tgz", + "integrity": "sha512-7twp3OJrPGTFpyXwjJNeOTbQw7RTv+0cUyKkXR9njEyLdXKcPWfpeBirXfdQHjYIHEY2b0V2Vom1B9IHSDSUtQ==", "requires": { "@babel/runtime": "^7.1.2", - "algoliasearch-helper": "^3.1.0", - "prop-types": "^15.5.10", + "algoliasearch-helper": "^3.4.3", + "prop-types": "^15.6.2", "react-fast-compare": "^3.0.0" } }, "react-instantsearch-dom": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/react-instantsearch-dom/-/react-instantsearch-dom-6.8.2.tgz", - "integrity": "sha512-d6YBsjW/aF3qzul7qqUV/KuzEFPVxlAZm3QhREPqMvOyrPTnG5itZZBLe7sFm9OKJ/8shR4TyNp3hb94as7COg==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/react-instantsearch-dom/-/react-instantsearch-dom-6.10.3.tgz", + "integrity": "sha512-kxc6IEruxJrc7O9lsLV5o4YK/RkGt3l7D1Y51JfmYkgeLuQHApwgcy/TAIoSN7wfR/1DONFbX8Y5VhU9Wqh87Q==", "requires": { "@babel/runtime": "^7.1.2", - "algoliasearch-helper": "^3.1.0", + "algoliasearch-helper": "^3.4.3", "classnames": "^2.2.5", - "prop-types": "^15.5.10", + "prop-types": "^15.6.2", "react-fast-compare": "^3.0.0", - "react-instantsearch-core": "^6.8.2" + "react-instantsearch-core": "^6.10.3" } }, "react-is": { diff --git a/website/package.json b/website/package.json index 572621182..e1e2bd44d 100644 --- a/website/package.json +++ b/website/package.json @@ -7,16 +7,18 @@ "@hashicorp/mktg-global-styles": "2.1.0", "@hashicorp/nextjs-scripts": "16.2.0", "@hashicorp/react-button": "4.0.0", - "@hashicorp/react-docs-page": "10.9.4-alpha.18", + "@hashicorp/react-docs-page": "11.0.1", "@hashicorp/react-hashi-stack-menu": "^1.1.0", "@hashicorp/react-head": "1.1.6", "@hashicorp/react-inline-svg": "5.0.0", "@hashicorp/react-markdown-page": "^0.1.0", "@hashicorp/react-product-downloader": "4.0.2", - "@hashicorp/react-search": "^3.0.0", + "@hashicorp/react-search": "^4.2.0", "@hashicorp/react-section-header": "4.0.0", "@hashicorp/react-subnav": "7.1.0", "@hashicorp/react-vertical-text-block-list": "4.0.1", + "adm-zip": "^0.5.4", + "gray-matter": "^4.0.2", "next": "10.0.6", "next-mdx-remote": "1.0.1", "next-remote-watch": "0.3.0", diff --git a/website/pages/docs/[[...page]].jsx b/website/pages/docs/[[...page]].jsx index fe7d637f4..940086f9f 100644 --- a/website/pages/docs/[[...page]].jsx +++ b/website/pages/docs/[[...page]].jsx @@ -12,12 +12,12 @@ import { const BASE_ROUTE = 'docs' const NAV_DATA = 'data/docs-nav-data.json' const CONTENT_DIR = 'content/docs' -// override default "main" value for branch for "edit on this page" -const MAIN_BRANCH = 'master' +const PRODUCT = { name: productName, slug: productSlug } // add remote plugin docs loading const OPTIONS = { remotePluginsFile: 'data/docs-remote-plugins.json', additionalComponents: { PluginTierLabel }, + mainBranch: 'master', } function DocsLayout({ isDevMissingRemotePlugins, ...props }) { @@ -49,8 +49,7 @@ function DocsLayout({ isDevMissingRemotePlugins, ...props }) { @@ -67,6 +66,7 @@ export async function getStaticProps({ params }) { NAV_DATA, CONTENT_DIR, params, + PRODUCT, OPTIONS ) return { props } diff --git a/website/pages/guides/[[...page]].jsx b/website/pages/guides/[[...page]].jsx index 3eef1397e..3c90c1d45 100644 --- a/website/pages/guides/[[...page]].jsx +++ b/website/pages/guides/[[...page]].jsx @@ -10,15 +10,12 @@ import { const BASE_ROUTE = 'guides' const NAV_DATA = 'data/guides-nav-data.json' const CONTENT_DIR = 'content/guides' +const MAIN_BRANCH = 'master' +const PRODUCT = { name: productName, slug: productSlug } export default function GuidesLayout(props) { return ( - + ) } @@ -28,6 +25,12 @@ export async function getStaticPaths() { } export async function getStaticProps({ params }) { - const props = await generateStaticProps(NAV_DATA, CONTENT_DIR, params) + const props = await generateStaticProps( + NAV_DATA, + CONTENT_DIR, + params, + PRODUCT, + { mainBranch: MAIN_BRANCH } + ) return { props } } diff --git a/website/pages/intro/[[...page]].jsx b/website/pages/intro/[[...page]].jsx index 7d45b949a..7a3a65c33 100644 --- a/website/pages/intro/[[...page]].jsx +++ b/website/pages/intro/[[...page]].jsx @@ -10,15 +10,12 @@ import { const BASE_ROUTE = 'intro' const NAV_DATA = 'data/intro-nav-data.json' const CONTENT_DIR = 'content/intro' +const MAIN_BRANCH = 'master' +const PRODUCT = { name: productName, slug: productSlug } export default function IntroLayout(props) { return ( - + ) } @@ -28,6 +25,12 @@ export async function getStaticPaths() { } export async function getStaticProps({ params }) { - const props = await generateStaticProps(NAV_DATA, CONTENT_DIR, params) + const props = await generateStaticProps( + NAV_DATA, + CONTENT_DIR, + params, + PRODUCT, + { mainBranch: MAIN_BRANCH } + ) return { props } }