From 1e5a6e0fd0f4e5b4c7f9ba6ae7f67a6ceebbde19 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Thu, 13 Jan 2022 16:10:33 -0500 Subject: [PATCH] feat: versioned-docs (#11327) This PR introduces versioned docs --- website/next.config.js | 1 + website/package-lock.json | 474 +++++++++++++++++++++---- website/package.json | 2 +- website/pages/api-docs/[[...page]].jsx | 40 +-- website/pages/commands/[[...page]].jsx | 40 +-- website/pages/docs/[[...page]].jsx | 41 +-- 6 files changed, 467 insertions(+), 131 deletions(-) diff --git a/website/next.config.js b/website/next.config.js index 4989f0cf83..0ddf768220 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -23,6 +23,7 @@ module.exports = withHashicorp({ SEGMENT_WRITE_KEY: 'IyzLrqXkox5KJ8XL4fo8vTYNGfiKlTCm', BUGSNAG_CLIENT_KEY: '01625078d856ef022c88f0c78d2364f1', BUGSNAG_SERVER_KEY: 'be8ed0d0fc887d547284cce9e98e60e5', + ENABLE_VERSIONED_DOCS: process.env.ENABLE_VERSIONED_DOCS || false, }, images: { domains: ['www.datocms-assets.com'], diff --git a/website/package-lock.json b/website/package-lock.json index 34d0fbfd1b..0be3ad0716 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -24,7 +24,7 @@ "@hashicorp/react-code-block": "^4.1.5", "@hashicorp/react-consent-manager": "^7.1.0", "@hashicorp/react-content": "^8.0.2", - "@hashicorp/react-docs-page": "^14.4.2", + "@hashicorp/react-docs-page": "^14.14.0", "@hashicorp/react-enterprise-alert": "^6.0.1", "@hashicorp/react-featured-slider": "^5.0.1", "@hashicorp/react-hashi-stack-menu": "^2.1.2", @@ -1608,9 +1608,9 @@ } }, "node_modules/@hashicorp/react-alert": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@hashicorp/react-alert/-/react-alert-6.0.1.tgz", - "integrity": "sha512-4CSHoPD0D9oIMSxEV84b69QZK9LQFol4muinWyarWfv8oTfVmxe7bNRcCbOZ6o1C1AyURkgJvM4KZZ/8MA69Sg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@hashicorp/react-alert/-/react-alert-6.0.2.tgz", + "integrity": "sha512-8ePxXMYR6kU0cYb4T3WZ74bInPQdbzfM4B+ZWqmW+raEpVAS2MTqDFl7X55L0syWx6JDbBmrlhzYaRzTDf6qug==", "dependencies": { "@hashicorp/platform-product-meta": "^0.1.0", "classnames": "^2.3.1" @@ -1725,9 +1725,9 @@ } }, "node_modules/@hashicorp/react-content": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@hashicorp/react-content/-/react-content-8.0.2.tgz", - "integrity": "sha512-FNE1IiXizUDPL/rsvo37uYSBsAB8LhtCianMU/h3MIj8Khcwc/qC3pTabGs9Kv3ujA+fiIp/ImzWEGAhB22T7g==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@hashicorp/react-content/-/react-content-8.1.1.tgz", + "integrity": "sha512-NaUxDcXKacKleZjhMtjxjRaC/BqpAlWzla9P5dJJXFJHAlQJxjbpb1QmPTXOqMTJ3woSqA1+6l59w67BvAnN8g==", "dependencies": { "@hashicorp/platform-product-meta": "^0.1.0", "classnames": "^2.3.1" @@ -1738,26 +1738,27 @@ } }, "node_modules/@hashicorp/react-docs-page": { - "version": "14.4.2", - "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-page/-/react-docs-page-14.4.2.tgz", - "integrity": "sha512-K/KITJsAYA8sjxCy4JbAJKEgEKA924MNm4bd4SPniomzSYmsCNxeDaM/bSM/EpaGR7cX9r6htSyugKwo7V3QFQ==", + "version": "14.14.0", + "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-page/-/react-docs-page-14.14.0.tgz", + "integrity": "sha512-OwbBmbuE7U3nnF/TWeUKRW6MN0/KIgC8nxUJP3rbqANxZFchCjm/7JEG/owDZu41zJQUAa1ZKvmhI+OUfAAvwA==", "dependencies": { "@hashicorp/platform-docs-mdx": "^0.1.3", - "@hashicorp/platform-markdown-utils": "^0.1.3", - "@hashicorp/react-alert": "^6.0.0", - "@hashicorp/react-content": "^8.0.2", + "@hashicorp/platform-markdown-utils": "^0.2.0", + "@hashicorp/react-alert": "^6.0.2", + "@hashicorp/react-content": "^8.1.1", "@hashicorp/react-docs-sidenav": "^8.4.0", "@hashicorp/react-head": "^3.1.2", "@hashicorp/react-placeholder": "^0.1.0", - "@hashicorp/react-search": "^6.1.1", - "@hashicorp/react-version-select": "^0.2.0", + "@hashicorp/react-search": "^6.3.1", + "@hashicorp/react-version-select": "^0.3.0", "classnames": "^2.3.1", "fs-exists-sync": "^0.1.0", "gray-matter": "^4.0.3", "js-yaml": "^4.1.0", "line-reader": "^0.4.0", "moize": "^6.0.3", - "readdirp": "^3.6.0" + "readdirp": "^3.6.0", + "semver": "^7.3.5" }, "peerDependencies": { "@hashicorp/mktg-global-styles": ">=3.x", @@ -1765,6 +1766,60 @@ "react": ">=16.x" } }, + "node_modules/@hashicorp/react-docs-page/node_modules/@hashicorp/platform-markdown-utils": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@hashicorp/platform-markdown-utils/-/platform-markdown-utils-0.2.0.tgz", + "integrity": "sha512-xs/yiP/vcgvGX5wYggvYIhG4WTmTS3e5oUE7QuTtukOHcCN+HmN79z9xn8yCDnJ0GiAm51dv42lmCBiWj3JF6Q==", + "dependencies": { + "@hashicorp/platform-types": "^0.1.0", + "@hashicorp/remark-plugins": "^3.3.1", + "@mapbox/rehype-prism": "^0.6.0", + "@mdx-js/react": "1.6.22", + "rehype-katex": "^5.0.0", + "remark-math": "^4.0.0", + "remark-rehype": "^7.0.0" + }, + "peerDependencies": { + "react": ">= 16.x" + } + }, + "node_modules/@hashicorp/react-docs-page/node_modules/@hashicorp/remark-plugins": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@hashicorp/remark-plugins/-/remark-plugins-3.3.1.tgz", + "integrity": "sha512-7xThpsBFWasdC/E+E/BAjHxMYqyCcQFiTVspvhBzN51meiQIacVCnyAox/lyvwWiP4N3Yj/ruH4UsR2ifskNeA==", + "dependencies": { + "@mdx-js/util": "1.6.22", + "github-slugger": "^1.3.0", + "remark": "12.0.1", + "remark-mdx": "1.6.22", + "to-vfile": "^6.1.0", + "unist-util-flatmap": "^1.0.0", + "unist-util-is": "^4.0.2", + "unist-util-map": "^2.0.1", + "unist-util-visit": "^2.0.3" + } + }, + "node_modules/@hashicorp/react-docs-page/node_modules/@mapbox/rehype-prism": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@mapbox/rehype-prism/-/rehype-prism-0.6.0.tgz", + "integrity": "sha512-/0Ev/PB4fXdKPT6VDzVpnAPxGpWFIc4Yz3mf/DzLEMxlpIPZpZlCzaFk4V4NGFofQXPc41+GpEcZtWP3VuFWVA==", + "dependencies": { + "hast-util-to-string": "^1.0.4", + "refractor": "^3.3.1", + "unist-util-visit": "^2.0.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@hashicorp/react-docs-page/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, "node_modules/@hashicorp/react-docs-page/node_modules/gray-matter": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", @@ -1807,6 +1862,52 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, + "node_modules/@hashicorp/react-docs-page/node_modules/katex": { + "version": "0.13.24", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.13.24.tgz", + "integrity": "sha512-jZxYuKCma3VS5UuxOx/rFV1QyGSl3Uy/i0kTJF3HgQ5xMinCQVF8Zd4bMY/9aI9b9A2pjIBOsjSSm68ykTAr8w==", + "funding": [ + "https://opencollective.com/katex", + "https://github.com/sponsors/katex" + ], + "dependencies": { + "commander": "^8.0.0" + }, + "bin": { + "katex": "cli.js" + } + }, + "node_modules/@hashicorp/react-docs-page/node_modules/mdast-util-definitions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-3.0.1.tgz", + "integrity": "sha512-BAv2iUm/e6IK/b2/t+Fx69EL/AGcq/IG2S+HxHjDJGfLJtd6i9SZUS76aC9cig+IEucsqxKTR0ot3m933R3iuA==", + "dependencies": { + "unist-util-visit": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@hashicorp/react-docs-page/node_modules/mdast-util-to-hast": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-9.1.2.tgz", + "integrity": "sha512-OpkFLBC2VnNAb2FNKcKWu9FMbJhQKog+FCT8nuKmQNIKXyT1n3SIskE7uWDep6x+cA20QXlK5AETHQtYmQmxtQ==", + "dependencies": { + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "mdast-util-definitions": "^3.0.0", + "mdurl": "^1.0.0", + "unist-builder": "^2.0.0", + "unist-util-generated": "^1.0.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/@hashicorp/react-docs-page/node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -1818,10 +1919,105 @@ "node": ">=8.10.0" } }, + "node_modules/@hashicorp/react-docs-page/node_modules/rehype-katex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/rehype-katex/-/rehype-katex-5.0.0.tgz", + "integrity": "sha512-ksSuEKCql/IiIadOHiKRMjypva9BLhuwQNascMqaoGLDVd0k2NlE2wMvgZ3rpItzRKCd6vs8s7MFbb8pcR0AEg==", + "dependencies": { + "@types/katex": "^0.11.0", + "hast-util-to-text": "^2.0.0", + "katex": "^0.13.0", + "rehype-parse": "^7.0.0", + "unified": "^9.0.0", + "unist-util-visit": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@hashicorp/react-docs-page/node_modules/remark": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/remark/-/remark-12.0.1.tgz", + "integrity": "sha512-gS7HDonkdIaHmmP/+shCPejCEEW+liMp/t/QwmF0Xt47Rpuhl32lLtDV1uKWvGoq+kxr5jSgg5oAIpGuyULjUw==", + "dependencies": { + "remark-parse": "^8.0.0", + "remark-stringify": "^8.0.0", + "unified": "^9.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@hashicorp/react-docs-page/node_modules/remark-parse": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-8.0.3.tgz", + "integrity": "sha512-E1K9+QLGgggHxCQtLt++uXltxEprmWzNfg+MxpfHsZlrddKzZ/hZyWHDbK3/Ap8HJQqYJRXP+jHczdL6q6i85Q==", + "dependencies": { + "ccount": "^1.0.0", + "collapse-white-space": "^1.0.2", + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "is-word-character": "^1.0.0", + "markdown-escapes": "^1.0.0", + "parse-entities": "^2.0.0", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "trim": "0.0.1", + "trim-trailing-lines": "^1.0.0", + "unherit": "^1.0.4", + "unist-util-remove-position": "^2.0.0", + "vfile-location": "^3.0.0", + "xtend": "^4.0.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@hashicorp/react-docs-page/node_modules/remark-rehype": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-7.0.0.tgz", + "integrity": "sha512-uqQ/VbaTdxyu/da6npHAso6hA00cMqhA3a59RziQdOLN2KEIkPykAVy52IcmZEVTuauXO0VtpxkyCey4phtHzQ==", + "dependencies": { + "mdast-util-to-hast": "^9.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@hashicorp/react-docs-page/node_modules/remark-stringify": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-8.1.1.tgz", + "integrity": "sha512-q4EyPZT3PcA3Eq7vPpT6bIdokXzFGp9i85igjmhRyXWmPs0Y6/d2FYwUNotKAWyLch7g0ASZJn/KHHcHZQ163A==", + "dependencies": { + "ccount": "^1.0.0", + "is-alphanumeric": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "longest-streak": "^2.0.1", + "markdown-escapes": "^1.0.0", + "markdown-table": "^2.0.0", + "mdast-util-compact": "^2.0.0", + "parse-entities": "^2.0.0", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "stringify-entities": "^3.0.0", + "unherit": "^1.0.4", + "xtend": "^4.0.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/@hashicorp/react-docs-sidenav": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-sidenav/-/react-docs-sidenav-8.4.0.tgz", - "integrity": "sha512-r2yFLuAD4+9RbPvBzWwcv7b9wrk1MooUJJMdLFP6WUUPYxt3r0Jju6/y4CubVUwtDnNCe3iqo3KoRmWrfNSS0Q==", + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-sidenav/-/react-docs-sidenav-8.4.1.tgz", + "integrity": "sha512-X7J19jCrcYiZEa7/ApMn6R5LFmDymJC1/sHSXpaMcXDIW5DD+H0DRYwJKVUPgdJDWhjZ5PXXWeDJTOKcQWBNog==", "dependencies": { "@hashicorp/platform-product-meta": "^0.1.0", "@hashicorp/react-link-wrap": "^3.0.3", @@ -2013,9 +2209,9 @@ } }, "node_modules/@hashicorp/react-search": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@hashicorp/react-search/-/react-search-6.1.1.tgz", - "integrity": "sha512-azaXjFP/om+DN6InI/WD+qH9jmLE3/9pqIc2Dp4rYY/tn1KuWyJ5MefvcsbYxIFUVX/wiT2n+8HZFwRfxhdA+w==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@hashicorp/react-search/-/react-search-6.4.0.tgz", + "integrity": "sha512-ITAvD5QEc+B79VTYC27kdx0P1ynGFPUwed1ttUxlAIhvzasWjKeM6sS1rT8oFF+QcUZqoE7rKq7Y8k53sAB2Lw==", "dependencies": { "@hashicorp/react-inline-svg": "^6.0.1", "@hashicorp/remark-plugins": "^3.1.1", @@ -2062,11 +2258,11 @@ } }, "node_modules/@hashicorp/react-select-input": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@hashicorp/react-select-input/-/react-select-input-4.0.3.tgz", - "integrity": "sha512-HN7uy2acXOCNE2cz844da0V8JHesnCLjKXis7/n+PB9O6wLfSYblWYPoPLEPx83Ph0dQfAtUT8dsJ9v6S2TSiw==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@hashicorp/react-select-input/-/react-select-input-4.0.5.tgz", + "integrity": "sha512-iN7iq7HZTQh3sa3LViuXbS84Si5hL6eWOqXd4DHfWYcZuuwping88l8SwwPWtqr+HVDcFsRixpVuvOCwgQSX0Q==", "dependencies": { - "classnames": "^2.2.6", + "classnames": "^2.3.1", "downshift": "3.1.5" }, "peerDependencies": { @@ -2240,9 +2436,9 @@ } }, "node_modules/@hashicorp/react-version-select": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@hashicorp/react-version-select/-/react-version-select-0.2.1.tgz", - "integrity": "sha512-E7BW4FotIYq1S5d/GrUPH2NvXmzYmeNpM01wNThDEbes47RfT8nzN3dg64QOUdCvWoUcUaOlGMQHNychBTif2g==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@hashicorp/react-version-select/-/react-version-select-0.3.0.tgz", + "integrity": "sha512-wd708z+ftdUkK+jKBLFHdHE3U4a0g37LTOxH9X68LzFDWPUT9gTAI5dPEfT0Os/DeJxWcRvUoaS8Fbtd7SQPmg==", "dependencies": { "@hashicorp/react-select-input": ">=4.x" }, @@ -8082,9 +8278,9 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==" }, "node_modules/fast-equals": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-2.0.3.tgz", - "integrity": "sha512-0EMw4TTUxsMDpDkCg0rXor2gsg+npVrMIHbEhvD0HZyIhUX6AktC/yasm+qKwfyswd06Qy95ZKk8p2crTo0iPA==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-2.0.4.tgz", + "integrity": "sha512-caj/ZmjHljPrZtbzJ3kfH5ia/k4mTJe/qSiXAGzxZWRZgsgDV0cvNaQULqUX8t0/JVlzzEdYOwCN5DmzTxoD4w==" }, "node_modules/fast-glob": { "version": "3.2.7", @@ -21212,9 +21408,9 @@ } }, "@hashicorp/react-alert": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@hashicorp/react-alert/-/react-alert-6.0.1.tgz", - "integrity": "sha512-4CSHoPD0D9oIMSxEV84b69QZK9LQFol4muinWyarWfv8oTfVmxe7bNRcCbOZ6o1C1AyURkgJvM4KZZ/8MA69Sg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@hashicorp/react-alert/-/react-alert-6.0.2.tgz", + "integrity": "sha512-8ePxXMYR6kU0cYb4T3WZ74bInPQdbzfM4B+ZWqmW+raEpVAS2MTqDFl7X55L0syWx6JDbBmrlhzYaRzTDf6qug==", "requires": { "@hashicorp/platform-product-meta": "^0.1.0", "classnames": "^2.3.1" @@ -21298,37 +21494,83 @@ } }, "@hashicorp/react-content": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@hashicorp/react-content/-/react-content-8.0.2.tgz", - "integrity": "sha512-FNE1IiXizUDPL/rsvo37uYSBsAB8LhtCianMU/h3MIj8Khcwc/qC3pTabGs9Kv3ujA+fiIp/ImzWEGAhB22T7g==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@hashicorp/react-content/-/react-content-8.1.1.tgz", + "integrity": "sha512-NaUxDcXKacKleZjhMtjxjRaC/BqpAlWzla9P5dJJXFJHAlQJxjbpb1QmPTXOqMTJ3woSqA1+6l59w67BvAnN8g==", "requires": { "@hashicorp/platform-product-meta": "^0.1.0", "classnames": "^2.3.1" } }, "@hashicorp/react-docs-page": { - "version": "14.4.2", - "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-page/-/react-docs-page-14.4.2.tgz", - "integrity": "sha512-K/KITJsAYA8sjxCy4JbAJKEgEKA924MNm4bd4SPniomzSYmsCNxeDaM/bSM/EpaGR7cX9r6htSyugKwo7V3QFQ==", + "version": "14.14.0", + "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-page/-/react-docs-page-14.14.0.tgz", + "integrity": "sha512-OwbBmbuE7U3nnF/TWeUKRW6MN0/KIgC8nxUJP3rbqANxZFchCjm/7JEG/owDZu41zJQUAa1ZKvmhI+OUfAAvwA==", "requires": { "@hashicorp/platform-docs-mdx": "^0.1.3", - "@hashicorp/platform-markdown-utils": "^0.1.3", - "@hashicorp/react-alert": "^6.0.0", - "@hashicorp/react-content": "^8.0.2", + "@hashicorp/platform-markdown-utils": "^0.2.0", + "@hashicorp/react-alert": "^6.0.2", + "@hashicorp/react-content": "^8.1.1", "@hashicorp/react-docs-sidenav": "^8.4.0", "@hashicorp/react-head": "^3.1.2", "@hashicorp/react-placeholder": "^0.1.0", - "@hashicorp/react-search": "^6.1.1", - "@hashicorp/react-version-select": "^0.2.0", + "@hashicorp/react-search": "^6.3.1", + "@hashicorp/react-version-select": "^0.3.0", "classnames": "^2.3.1", "fs-exists-sync": "^0.1.0", "gray-matter": "^4.0.3", "js-yaml": "^4.1.0", "line-reader": "^0.4.0", "moize": "^6.0.3", - "readdirp": "^3.6.0" + "readdirp": "^3.6.0", + "semver": "^7.3.5" }, "dependencies": { + "@hashicorp/platform-markdown-utils": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@hashicorp/platform-markdown-utils/-/platform-markdown-utils-0.2.0.tgz", + "integrity": "sha512-xs/yiP/vcgvGX5wYggvYIhG4WTmTS3e5oUE7QuTtukOHcCN+HmN79z9xn8yCDnJ0GiAm51dv42lmCBiWj3JF6Q==", + "requires": { + "@hashicorp/platform-types": "^0.1.0", + "@hashicorp/remark-plugins": "^3.3.1", + "@mapbox/rehype-prism": "^0.6.0", + "@mdx-js/react": "1.6.22", + "rehype-katex": "^5.0.0", + "remark-math": "^4.0.0", + "remark-rehype": "^7.0.0" + } + }, + "@hashicorp/remark-plugins": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@hashicorp/remark-plugins/-/remark-plugins-3.3.1.tgz", + "integrity": "sha512-7xThpsBFWasdC/E+E/BAjHxMYqyCcQFiTVspvhBzN51meiQIacVCnyAox/lyvwWiP4N3Yj/ruH4UsR2ifskNeA==", + "requires": { + "@mdx-js/util": "1.6.22", + "github-slugger": "^1.3.0", + "remark": "12.0.1", + "remark-mdx": "1.6.22", + "to-vfile": "^6.1.0", + "unist-util-flatmap": "^1.0.0", + "unist-util-is": "^4.0.2", + "unist-util-map": "^2.0.1", + "unist-util-visit": "^2.0.3" + } + }, + "@mapbox/rehype-prism": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@mapbox/rehype-prism/-/rehype-prism-0.6.0.tgz", + "integrity": "sha512-/0Ev/PB4fXdKPT6VDzVpnAPxGpWFIc4Yz3mf/DzLEMxlpIPZpZlCzaFk4V4NGFofQXPc41+GpEcZtWP3VuFWVA==", + "requires": { + "hast-util-to-string": "^1.0.4", + "refractor": "^3.3.1", + "unist-util-visit": "^2.0.3" + } + }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + }, "gray-matter": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", @@ -21366,6 +21608,37 @@ } } }, + "katex": { + "version": "0.13.24", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.13.24.tgz", + "integrity": "sha512-jZxYuKCma3VS5UuxOx/rFV1QyGSl3Uy/i0kTJF3HgQ5xMinCQVF8Zd4bMY/9aI9b9A2pjIBOsjSSm68ykTAr8w==", + "requires": { + "commander": "^8.0.0" + } + }, + "mdast-util-definitions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-3.0.1.tgz", + "integrity": "sha512-BAv2iUm/e6IK/b2/t+Fx69EL/AGcq/IG2S+HxHjDJGfLJtd6i9SZUS76aC9cig+IEucsqxKTR0ot3m933R3iuA==", + "requires": { + "unist-util-visit": "^2.0.0" + } + }, + "mdast-util-to-hast": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-9.1.2.tgz", + "integrity": "sha512-OpkFLBC2VnNAb2FNKcKWu9FMbJhQKog+FCT8nuKmQNIKXyT1n3SIskE7uWDep6x+cA20QXlK5AETHQtYmQmxtQ==", + "requires": { + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "mdast-util-definitions": "^3.0.0", + "mdurl": "^1.0.0", + "unist-builder": "^2.0.0", + "unist-util-generated": "^1.0.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + } + }, "readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -21373,13 +21646,88 @@ "requires": { "picomatch": "^2.2.1" } + }, + "rehype-katex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/rehype-katex/-/rehype-katex-5.0.0.tgz", + "integrity": "sha512-ksSuEKCql/IiIadOHiKRMjypva9BLhuwQNascMqaoGLDVd0k2NlE2wMvgZ3rpItzRKCd6vs8s7MFbb8pcR0AEg==", + "requires": { + "@types/katex": "^0.11.0", + "hast-util-to-text": "^2.0.0", + "katex": "^0.13.0", + "rehype-parse": "^7.0.0", + "unified": "^9.0.0", + "unist-util-visit": "^2.0.0" + } + }, + "remark": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/remark/-/remark-12.0.1.tgz", + "integrity": "sha512-gS7HDonkdIaHmmP/+shCPejCEEW+liMp/t/QwmF0Xt47Rpuhl32lLtDV1uKWvGoq+kxr5jSgg5oAIpGuyULjUw==", + "requires": { + "remark-parse": "^8.0.0", + "remark-stringify": "^8.0.0", + "unified": "^9.0.0" + } + }, + "remark-parse": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-8.0.3.tgz", + "integrity": "sha512-E1K9+QLGgggHxCQtLt++uXltxEprmWzNfg+MxpfHsZlrddKzZ/hZyWHDbK3/Ap8HJQqYJRXP+jHczdL6q6i85Q==", + "requires": { + "ccount": "^1.0.0", + "collapse-white-space": "^1.0.2", + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "is-word-character": "^1.0.0", + "markdown-escapes": "^1.0.0", + "parse-entities": "^2.0.0", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "trim": "0.0.1", + "trim-trailing-lines": "^1.0.0", + "unherit": "^1.0.4", + "unist-util-remove-position": "^2.0.0", + "vfile-location": "^3.0.0", + "xtend": "^4.0.1" + } + }, + "remark-rehype": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-7.0.0.tgz", + "integrity": "sha512-uqQ/VbaTdxyu/da6npHAso6hA00cMqhA3a59RziQdOLN2KEIkPykAVy52IcmZEVTuauXO0VtpxkyCey4phtHzQ==", + "requires": { + "mdast-util-to-hast": "^9.1.0" + } + }, + "remark-stringify": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-8.1.1.tgz", + "integrity": "sha512-q4EyPZT3PcA3Eq7vPpT6bIdokXzFGp9i85igjmhRyXWmPs0Y6/d2FYwUNotKAWyLch7g0ASZJn/KHHcHZQ163A==", + "requires": { + "ccount": "^1.0.0", + "is-alphanumeric": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "longest-streak": "^2.0.1", + "markdown-escapes": "^1.0.0", + "markdown-table": "^2.0.0", + "mdast-util-compact": "^2.0.0", + "parse-entities": "^2.0.0", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "stringify-entities": "^3.0.0", + "unherit": "^1.0.4", + "xtend": "^4.0.1" + } } } }, "@hashicorp/react-docs-sidenav": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-sidenav/-/react-docs-sidenav-8.4.0.tgz", - "integrity": "sha512-r2yFLuAD4+9RbPvBzWwcv7b9wrk1MooUJJMdLFP6WUUPYxt3r0Jju6/y4CubVUwtDnNCe3iqo3KoRmWrfNSS0Q==", + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@hashicorp/react-docs-sidenav/-/react-docs-sidenav-8.4.1.tgz", + "integrity": "sha512-X7J19jCrcYiZEa7/ApMn6R5LFmDymJC1/sHSXpaMcXDIW5DD+H0DRYwJKVUPgdJDWhjZ5PXXWeDJTOKcQWBNog==", "requires": { "@hashicorp/platform-product-meta": "^0.1.0", "@hashicorp/react-link-wrap": "^3.0.3", @@ -21516,9 +21864,9 @@ } }, "@hashicorp/react-search": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@hashicorp/react-search/-/react-search-6.1.1.tgz", - "integrity": "sha512-azaXjFP/om+DN6InI/WD+qH9jmLE3/9pqIc2Dp4rYY/tn1KuWyJ5MefvcsbYxIFUVX/wiT2n+8HZFwRfxhdA+w==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@hashicorp/react-search/-/react-search-6.4.0.tgz", + "integrity": "sha512-ITAvD5QEc+B79VTYC27kdx0P1ynGFPUwed1ttUxlAIhvzasWjKeM6sS1rT8oFF+QcUZqoE7rKq7Y8k53sAB2Lw==", "requires": { "@hashicorp/react-inline-svg": "^6.0.1", "@hashicorp/remark-plugins": "^3.1.1", @@ -21556,11 +21904,11 @@ } }, "@hashicorp/react-select-input": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@hashicorp/react-select-input/-/react-select-input-4.0.3.tgz", - "integrity": "sha512-HN7uy2acXOCNE2cz844da0V8JHesnCLjKXis7/n+PB9O6wLfSYblWYPoPLEPx83Ph0dQfAtUT8dsJ9v6S2TSiw==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@hashicorp/react-select-input/-/react-select-input-4.0.5.tgz", + "integrity": "sha512-iN7iq7HZTQh3sa3LViuXbS84Si5hL6eWOqXd4DHfWYcZuuwping88l8SwwPWtqr+HVDcFsRixpVuvOCwgQSX0Q==", "requires": { - "classnames": "^2.2.6", + "classnames": "^2.3.1", "downshift": "3.1.5" } }, @@ -21688,9 +22036,9 @@ } }, "@hashicorp/react-version-select": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@hashicorp/react-version-select/-/react-version-select-0.2.1.tgz", - "integrity": "sha512-E7BW4FotIYq1S5d/GrUPH2NvXmzYmeNpM01wNThDEbes47RfT8nzN3dg64QOUdCvWoUcUaOlGMQHNychBTif2g==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@hashicorp/react-version-select/-/react-version-select-0.3.0.tgz", + "integrity": "sha512-wd708z+ftdUkK+jKBLFHdHE3U4a0g37LTOxH9X68LzFDWPUT9gTAI5dPEfT0Os/DeJxWcRvUoaS8Fbtd7SQPmg==", "requires": { "@hashicorp/react-select-input": ">=4.x" } @@ -26202,9 +26550,9 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==" }, "fast-equals": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-2.0.3.tgz", - "integrity": "sha512-0EMw4TTUxsMDpDkCg0rXor2gsg+npVrMIHbEhvD0HZyIhUX6AktC/yasm+qKwfyswd06Qy95ZKk8p2crTo0iPA==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-2.0.4.tgz", + "integrity": "sha512-caj/ZmjHljPrZtbzJ3kfH5ia/k4mTJe/qSiXAGzxZWRZgsgDV0cvNaQULqUX8t0/JVlzzEdYOwCN5DmzTxoD4w==" }, "fast-glob": { "version": "3.2.7", diff --git a/website/package.json b/website/package.json index 82540f4351..92669dd65f 100644 --- a/website/package.json +++ b/website/package.json @@ -20,7 +20,7 @@ "@hashicorp/react-code-block": "^4.1.5", "@hashicorp/react-consent-manager": "^7.1.0", "@hashicorp/react-content": "^8.0.2", - "@hashicorp/react-docs-page": "^14.4.2", + "@hashicorp/react-docs-page": "^14.14.0", "@hashicorp/react-enterprise-alert": "^6.0.1", "@hashicorp/react-featured-slider": "^5.0.1", "@hashicorp/react-hashi-stack-menu": "^2.1.2", diff --git a/website/pages/api-docs/[[...page]].jsx b/website/pages/api-docs/[[...page]].jsx index 1f40bb82f8..0055285d9d 100644 --- a/website/pages/api-docs/[[...page]].jsx +++ b/website/pages/api-docs/[[...page]].jsx @@ -1,16 +1,12 @@ import { productName, productSlug } from 'data/metadata' import DocsPage from '@hashicorp/react-docs-page' // Imports below are only used server-side -import { - generateStaticPaths, - generateStaticProps, -} from '@hashicorp/react-docs-page/server' +import { getStaticGenerationFunctions } from '@hashicorp/react-docs-page/server' // Configure the docs path const baseRoute = 'api-docs' const navDataFile = `data/${baseRoute}-nav-data.json` const localContentDir = `content/${baseRoute}` -const mainBranch = 'main' const product = { name: productName, slug: productSlug } export default function ApiDocsLayout(props) { @@ -19,21 +15,21 @@ export default function ApiDocsLayout(props) { ) } -export async function getStaticPaths() { - const paths = await generateStaticPaths({ - localContentDir, - navDataFile, - }) - return { paths, fallback: false } -} +const { getStaticPaths, getStaticProps } = getStaticGenerationFunctions( + process.env.ENABLE_VERSIONED_DOCS === 'true' + ? { + strategy: 'remote', + basePath: baseRoute, + fallback: 'blocking', + revalidate: 360, // 1 hour + product: productSlug, + } + : { + strategy: 'fs', + localContentDir: localContentDir, + navDataFile: navDataFile, + product: productSlug, + } +) -export async function getStaticProps({ params }) { - const props = await generateStaticProps({ - localContentDir, - mainBranch, - navDataFile, - params, - product, - }) - return { props } -} +export { getStaticPaths, getStaticProps } diff --git a/website/pages/commands/[[...page]].jsx b/website/pages/commands/[[...page]].jsx index e76ccb3719..0572b361ae 100644 --- a/website/pages/commands/[[...page]].jsx +++ b/website/pages/commands/[[...page]].jsx @@ -1,16 +1,12 @@ import { productName, productSlug } from 'data/metadata' import DocsPage from '@hashicorp/react-docs-page' // Imports below are only used server-side -import { - generateStaticPaths, - generateStaticProps, -} from '@hashicorp/react-docs-page/server' +import { getStaticGenerationFunctions } from '@hashicorp/react-docs-page/server' // Configure the docs path const baseRoute = 'commands' const navDataFile = `data/${baseRoute}-nav-data.json` const localContentDir = `content/${baseRoute}` -const mainBranch = 'main' const product = { name: productName, slug: productSlug } export default function CommandsLayout(props) { @@ -19,21 +15,21 @@ export default function CommandsLayout(props) { ) } -export async function getStaticPaths() { - const paths = await generateStaticPaths({ - localContentDir, - navDataFile, - }) - return { paths, fallback: false } -} +const { getStaticPaths, getStaticProps } = getStaticGenerationFunctions( + process.env.ENABLE_VERSIONED_DOCS === 'true' + ? { + strategy: 'remote', + basePath: baseRoute, + fallback: 'blocking', + revalidate: 360, // 1 hour + product: productSlug, + } + : { + strategy: 'fs', + localContentDir: localContentDir, + navDataFile: navDataFile, + product: productSlug, + } +) -export async function getStaticProps({ params }) { - const props = await generateStaticProps({ - localContentDir, - mainBranch, - navDataFile, - params, - product, - }) - return { props } -} +export { getStaticPaths, getStaticProps } diff --git a/website/pages/docs/[[...page]].jsx b/website/pages/docs/[[...page]].jsx index 2976490a9f..f6971e6b18 100644 --- a/website/pages/docs/[[...page]].jsx +++ b/website/pages/docs/[[...page]].jsx @@ -2,17 +2,13 @@ import { productName, productSlug } from 'data/metadata' import DocsPage from '@hashicorp/react-docs-page' import ConfigEntryReference from 'components/config-entry-reference' // Imports below are only used server-side -import { - generateStaticPaths, - generateStaticProps, -} from '@hashicorp/react-docs-page/server' +import { getStaticGenerationFunctions } from '@hashicorp/react-docs-page/server' // Configure the docs path const additionalComponents = { ConfigEntryReference } const baseRoute = 'docs' const navDataFile = `data/${baseRoute}-nav-data.json` const localContentDir = `content/${baseRoute}` -const mainBranch = 'main' const product = { name: productName, slug: productSlug } export default function DocsLayout(props) { @@ -26,22 +22,21 @@ export default function DocsLayout(props) { ) } -export async function getStaticPaths() { - const paths = await generateStaticPaths({ - localContentDir, - navDataFile, - }) - return { paths, fallback: false } -} +const { getStaticPaths, getStaticProps } = getStaticGenerationFunctions( + process.env.ENABLE_VERSIONED_DOCS === 'true' + ? { + strategy: 'remote', + basePath: baseRoute, + fallback: 'blocking', + revalidate: 360, // 1 hour + product: productSlug, + } + : { + strategy: 'fs', + localContentDir: localContentDir, + navDataFile: navDataFile, + product: productSlug, + } +) -export async function getStaticProps({ params }) { - const props = await generateStaticProps({ - additionalComponents, - localContentDir, - mainBranch, - navDataFile, - params, - product, - }) - return { props } -} +export { getStaticPaths, getStaticProps }