From 42e217ad90d47c982b4246a1264c621d887dc76e Mon Sep 17 00:00:00 2001
From: thatmattlove <matt@stunninglyclear.com>
Date: Tue, 28 May 2024 14:56:28 -0400
Subject: [PATCH] include changelog with docs

---
 CHANGELOG.md          | 90 +++++++++++++++++++++----------------------
 docs/.gitignore       |  1 +
 docs/next.config.js   | 13 +++++++
 docs/pages/_meta.json | 66 ++++++++++++++++---------------
 4 files changed, 94 insertions(+), 76 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c2a84743..783273fa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
-# 2.0.0 - 2024-05-28
+## 2.0.0 - 2024-05-28
 
 _v2.0.0 is a major release of hyperglass. Many things have changed, and it is likely best to redeploy hyperglass in a new environment to migrate to v2._
 
@@ -33,7 +33,7 @@ _v2.0.0 is a major release of hyperglass. Many things have changed, and it is li
 - [#178](https://github.com/thatmattlove/hyperglass/issues/178): Fixed an issue where parsing of Arista EOS routes failed if MED is unset.
 - [#145](https://github.com/thatmattlove/hyperglass/issues/145): Fixed an issue where menu links were improperly generated.
 
-# 1.0.4 - 2021-07-03
+## 1.0.4 - 2021-07-03
 
 ### Fixed
 - [#148](https://github.com/thatmattlove/hyperglass/issues/148): Update Debian/Ubuntu Python package name in installer and documentation.
@@ -43,21 +43,21 @@ _v2.0.0 is a major release of hyperglass. Many things have changed, and it is li
 - Improve handling of Junos XML errors. When a Junos device returns an error in the XML output, it will be displayed in the UI.
 - Improve `hyperglass system-info` output. NodeJS version is now included in the output.
 
-# 1.0.3 - 2021-06-23
+## 1.0.3 - 2021-06-23
 
 _1.0.3 is a cosmetic release to factor in code-level changes related to the repository name change from checktheroads to thatmattlove._
 
-# 1.0.2 - 2021-06-18
+## 1.0.2 - 2021-06-18
 
 ### Fixed
 - [#150](https://github.com/thatmattlove/hyperglass/issues/150): Fix handling of BIRD AS_PATH/Community targets.
 
-# 1.0.1 - 2021-06-17
+## 1.0.1 - 2021-06-17
 
 ### Fixed
 - UI: fix body overflow issue
 
-# 1.0.0 - 2021-05-30
+## 1.0.0 - 2021-05-30
 
 ### BREAKING CHANGES
 - The `external_link`, `help`, and `terms` parameters no longer exist and have been replaced with generic `links` and `menus` options.
@@ -72,7 +72,7 @@ _1.0.3 is a cosmetic release to factor in code-level changes related to the repo
 ### Added
 - [#140](https://github.com/thatmattlove/hyperglass/issues/140): Genericize links and menus so that multiple links and/or menus can be defined and fully customized.
 
-# 1.0.0-beta.82 - 2021-04-22
+## 1.0.0-beta.82 - 2021-04-22
 
 ### BREAKING CHANGE
 **NodeJS 14.15 or later is required**. See [the docs](https://hyperglass.dev/docs/getting-started) for installation instructions.
@@ -89,7 +89,7 @@ _1.0.3 is a cosmetic release to factor in code-level changes related to the repo
 ### Added
 - The driver for devices can now be overridden with the `driver` parameter.
 
-# 1.0.0-beta.81 - 2021-04-10
+## 1.0.0-beta.81 - 2021-04-10
 
 ### Fixed
 - [#124](https://github.com/thatmattlove/hyperglass/issues/124): Fix an issue where networks weren't always sorted alphabetically.
@@ -98,13 +98,13 @@ _1.0.3 is a cosmetic release to factor in code-level changes related to the repo
 - [#133](https://github.com/thatmattlove/hyperglass/issues/133): Use body styles for background/foreground color, allowing the user to override the `light` and `dark` colors per the docs.
 - Fix an issue with select menu list style.
 
-## 1.0.0-beta.80 - 2021-03-03
+### 1.0.0-beta.80 - 2021-03-03
 
 ### Fixed
 - Fix an issue where the UI did not properly filter and detect the correct Query VRF when only one was defined.
 - [#121](https://github.com/thatmattlove/hyperglass/issues/121): Fix issue with select menu styling in light mode.
 
-## 1.0.0-beta.79 - 2021-02-26
+### 1.0.0-beta.79 - 2021-02-26
 
 ### BREAKING CHANGE
 **Major changes have been made to how VRFs are defined and handled.** Previously, you would signal to hyperglass that a VRF was the "default" VRF (meaning, a VRF does not need to be specified in any commands) by setting `name: default` in the VRF block. This limitation meant that a VRF named `default` _had_ to be defined, and that any users who keep their global routing table in a non-default VRF must define it separately.
@@ -119,7 +119,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 - Migrate to palette-by-numbers for theming.
 - Update UI dependencies.
 
-## 1.0.0-beta.78 - 2021-02-12
+### 1.0.0-beta.78 - 2021-02-12
 
 ### Added
 - Experimental table output/structured data support for Arista EOS.
@@ -130,7 +130,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 ### Changed
 - Caught fetch errors now display the HTTP status text in the UI, instead of the caught error message.
 
-## 1.0.0-beta.77 - 2021-02-10
+### 1.0.0-beta.77 - 2021-02-10
 
 **POTENTIALLY BREAKING CHANGE**: The device `display_name` field is being deprecated, in favor of a single `name` field, which will be displayed to the end user. The `display_name` field still works, but you should migrate away from it as soon as possible.
 
@@ -140,7 +140,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 ### Changed
 - Removed `display_name` field from device model. The `name` field will be used in the UI. If a `display_name` is defined, it will be used, for backwards compatibility.
 
-## 1.0.0-beta.76 - 2021-02-06
+### 1.0.0-beta.76 - 2021-02-06
 
 **NOTICE**: *[hyperglass-agent](https://github.com/thatmattlove/hyperglass-agent) will be deprecated soon. Use `frr_ssh` or `bird_ssh` for SSH connectivity in the meantime.*
 
@@ -154,13 +154,13 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 - AS Path graph view now uses [dagre](https://github.com/dagrejs/dagre) to properly arrange each AS.
 - Added timeout argument to `hyperglass start --build` - fixes issue where running a UI build in this way failed due to a missing timeout argument error.
 
-## 1.0.0-beta.75 - 2021-01-28
+### 1.0.0-beta.75 - 2021-01-28
 
 ### Changed
 - Default UI build timeout is now 180 seconds.
 - The hyperglass `build-ui` CLI command now accepts a `--timeout` argument to override the UI build timeout.
 
-## 1.0.0-beta.74 - 2021-01-25
+### 1.0.0-beta.74 - 2021-01-25
 
 ### Changed
 - The Scrapli driver no longer specifically ignores the system's SSH config file.
@@ -169,7 +169,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 ### Fixed
 - [#109](https://github.com/thatmattlove/hyperglass/issues/109): Remove the custom error page, because it doesn't work and doesn't really add much.
 
-## 1.0.0-beta.73 - 2021-01-18
+### 1.0.0-beta.73 - 2021-01-18
 
 ### Added
 - [#106](https://github.com/thatmattlove/hyperglass/issues/106): Add built-in support for Nokia SR OS (thanks @paunadeu!).
@@ -181,7 +181,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 ### Fixed
 - [#107](https://github.com/thatmattlove/hyperglass/issues/107): Fix footer menu styling so it doesn't overflow the viewport, especially on mobile.
 
-## 1.0.0-beta.72 - 2021-01-16
+### 1.0.0-beta.72 - 2021-01-16
 
 ### Fixed
 - [#104](https://github.com/thatmattlove/hyperglass/issues/104): Handle the usage of `juniper_junos` as a NOS. `juniper_junos` will now automatically be mapped to `juniper`.
@@ -190,7 +190,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 ### Changed
 - **BREAKING**: The installer no longer generates a Systemd service file. While this was likely convenient for most, it introduced significant complexity and caused most installations using `~/hyperglass` as the app path to fail, with no clear way to resolve it. Further, while Systemd is arguably the most common, it is not the *only* process manager available. As such, the docs will be updated with a Systemd example, much like the current reverse proxy documentation.
 
-## 1.0.0-beta.71 - 2021-01-10
+### 1.0.0-beta.71 - 2021-01-10
 
 ### Added
 - Added Google Analytics Support. Use the `google_analytics` field for the tracking ID in `hyperglass.yaml`.
@@ -198,7 +198,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 ### Changed
 - Minor frontend code improvements.
 
-## 1.0.0-beta.70 - 2021-01-05
+### 1.0.0-beta.70 - 2021-01-05
 
 ### Fixed
 
@@ -207,7 +207,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 ### Changed
 - Query results now automatically cancel when each result panel unmounts (e.g. when one clicks the back button).
 
-## 1.0.0-beta.69 - 2021-01-03
+### 1.0.0-beta.69 - 2021-01-03
 
 ### Fixed
 
@@ -218,14 +218,14 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 
 - Setup no longer adds example files
 
-## 1.0.0-beta.67 - 2021-01-02
+### 1.0.0-beta.67 - 2021-01-02
 
 ### Fixed
 
 - Fix handling of `web.theme.default_color_mode`. Starting in 1.0.0-beta.65, it was completely ignored and used the library's default of `light`. Now, it's handled properly.
 - Fix table output layout issues, particularly on mobile.
 
-## 1.0.0-beta.66 - 2021-01-02
+### 1.0.0-beta.66 - 2021-01-02
 
 ### Fixed
 
@@ -236,7 +236,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 
 - `web.theme.colors.black` and `web.theme.colors.white` are now `web.theme.colors.dark` and `web.theme.colors.light respectively`
 
-## 1.0.0-beta.65 - 2021-01-01
+### 1.0.0-beta.65 - 2021-01-01
 
 ### Added
 
@@ -251,7 +251,7 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 - `web.text.title` and `web.text.subtitle` now carry a 32 character limit for simpler styling.
 - Various UI layout, styling improvements, and stability improvements.
 
-## 1.0.0-beta.63 - 2020-10-18
+### 1.0.0-beta.63 - 2020-10-18
 
 ### Added
 
@@ -261,13 +261,13 @@ Moving forward, the `name` field is only used to define the name of the VRF **as
 
 - Fix an issue causing hyperglass custom exceptions to not be properly raised, which caused more generic error messages in the UI/API.
 
-## 1.0.0-beta.62 - 2020-10-17
+### 1.0.0-beta.62 - 2020-10-17
 
 ### Fixed
 
 - Fix an issue causing exceptions not to be logged to the log file (but logged to stdout).
 
-## 1.0.0-beta.61 - 2020-10-11
+### 1.0.0-beta.61 - 2020-10-11
 
 ### POTENTIALLY BREAKING CHANGE
 
@@ -281,7 +281,7 @@ When hyperglass starts up, it will check to see if `~/hyperglass` or `/etc/hyper
 
 - [#81](https://github.com/thatmattlove/hyperglass/issues/81): Add support for SSH key authentication. See [the docs](https://hyperglass.dev/docs/adding-devices#credential) for more details.
 
-## 1.0.0-beta.60 - 2020-10-10
+### 1.0.0-beta.60 - 2020-10-10
 
 ### Fixed
 
@@ -303,7 +303,7 @@ This would correspond with the following stanza in the Redis configuration file:
 requirepass examplepassword
 ```
 
-## 1.0.0-beta.59 - 2020-10-05
+### 1.0.0-beta.59 - 2020-10-05
 
 ### Added
 
@@ -315,7 +315,7 @@ requirepass examplepassword
 - Improve output parsing scalability - parsers can now be defined on a per-NOS basis regardless of whether or not structured-data is used.
 - Restructure model locations & importing to remove some complexities.
 
-## 1.0.0-beta.58 - 2020-09-28
+### 1.0.0-beta.58 - 2020-09-28
 
 ### Changed
 
@@ -332,7 +332,7 @@ requirepass examplepassword
 - [#77](https://github.com/thatmattlove/hyperglass/issues/77): Allow dashes in FQDN validation pattern.
 - [#83](https://github.com/thatmattlove/hyperglass/issues/83): Fix lack of support for `protocol-nh` field in Juniper XML BGP table.
 
-## 1.0.0-beta.57 - 2020-07-30
+### 1.0.0-beta.57 - 2020-07-30
 
 ### BREAKING CHANGE
 
@@ -350,7 +350,7 @@ $ hyperglass-agent send-certificate
 - Refactored device, query, proxy models to no longer scrub unsupported characters from the device name for the purposes of Python class attribute accessing.
 - Updated hyperglass-agent docs.
 
-## 1.0.0-beta.56 - 2020-07-28
+### 1.0.0-beta.56 - 2020-07-28
 
 ### Changed
 
@@ -361,19 +361,19 @@ $ hyperglass-agent send-certificate
 
 - [#56](https://github.com/thatmattlove/hyperglass/issues/56): Fix a silent Redis connection error if the Redis server was anything other than `localhost`, preventing hyperglass from starting.
 
-## 1.0.0-beta.55 - 2020-07-27
+### 1.0.0-beta.55 - 2020-07-27
 
 ### Changed
 
 - Removed JS favicon build process in favor of native Python implementation ([favicons](https://github/thatmattlove/favicons))
 
-## 1.0.0-beta.54 - 2020-07-25
+### 1.0.0-beta.54 - 2020-07-25
 
 ### Fixed
 
 - Queries to hyperglass-agent devices failed due to the error `AttributeError: 'AgentConnection' object has no attribute 'collect'`
 
-## 1.0.0-beta.53 - 2020-07-23
+### 1.0.0-beta.53 - 2020-07-23
 
 ### Added
 
@@ -389,7 +389,7 @@ $ hyperglass-agent send-certificate
 
 - UI: Error messages couldn't be copied with the copy button
 
-## 1.0.0-beta.52 - 2020-07-19
+### 1.0.0-beta.52 - 2020-07-19
 
 ### Added
 
@@ -413,7 +413,7 @@ $ hyperglass-agent send-certificate
 - Improve command customization docs.
 - [#61](https://github.com/thatmattlove/hyperglass/issues/61): Fixed copy output for table data. Output is now a bulleted list of parsed data.
 
-## 1.0.0-beta.51 - 2020-07-13
+### 1.0.0-beta.51 - 2020-07-13
 
 ### Changed
 
@@ -425,7 +425,7 @@ $ hyperglass-agent send-certificate
 - [#54](https://github.com/thatmattlove/hyperglass/issues/54): A Junos parsing error caused routes with no communities to raise an error.
 - Pre-validated config files are no longer logged on startup unless debugging is enabled.
 
-## 1.0.0-beta.50 - 2020-07-12
+### 1.0.0-beta.50 - 2020-07-12
 
 ### Added
 
@@ -445,7 +445,7 @@ $ hyperglass-agent send-certificate
 - [#54](https://github.com/thatmattlove/hyperglass/issues/54): A Junos structured/table output parsing error caused routes with multiple next-hops to raise an error.
 - RPKI validation no longer occurs twice (once on serialization of the output, once on validation of the API response).
 
-## 1.0.0-beta.49 - 2020-07-05
+### 1.0.0-beta.49 - 2020-07-05
 
 ### Changed
 
@@ -457,7 +457,7 @@ $ hyperglass-agent send-certificate
 
 - Route lookups for private (RFC 1918) addresses failed due to an unnecessary lookup to [bgp.tools](https://bgp.tools)
 
-## 1.0.0-beta.48 - 2020-07-04
+### 1.0.0-beta.48 - 2020-07-04
 
 ### Added
 
@@ -469,7 +469,7 @@ $ hyperglass-agent send-certificate
 - When copying the opengraph image, the copied image was not deleted.
 - Default traceroute help link now _actually_ points to the new docs site.
 
-## 1.0.0-beta.47 - 2020-07-04
+### 1.0.0-beta.47 - 2020-07-04
 
 ### Added
 
@@ -490,13 +490,13 @@ $ hyperglass-agent send-certificate
 - Generated favicon manifest files now go to the correct directory.
 - Various docs site fixes
 
-## 1.0.0-beta.46 - 2020-06-28
+### 1.0.0-beta.46 - 2020-06-28
 
 ### Added
 
 - Support for hyperglass-agent [0.1.5](https://github.com/thatmattlove/hyperglass-agent)
 
-## 1.0.0-beta.45 - 2020-06-27
+### 1.0.0-beta.45 - 2020-06-27
 
 ### Changed
 
@@ -507,7 +507,7 @@ $ hyperglass-agent send-certificate
 - Webhook construction bugs that caused webhooks not to send
 - Empty response handling for table output
 
-## 1.0.0-beta.44 - 2020-06-26
+### 1.0.0-beta.44 - 2020-06-26
 
 ### Added
 
@@ -517,13 +517,13 @@ $ hyperglass-agent send-certificate
 
 - If webhooks were enabled, a hung test connection to RIPEStat would cause the query to time out
 
-## 1.0.0-beta.43 - 2020-06-22
+### 1.0.0-beta.43 - 2020-06-22
 
 ### Fixed
 
 - Logo path handling in UI
 
-## 1.0.0-beta.42 - 2020-06-21
+### 1.0.0-beta.42 - 2020-06-21
 
 ### Added
 
diff --git a/docs/.gitignore b/docs/.gitignore
index 8aad1110..8ade9b27 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -7,3 +7,4 @@ node_modules/
 fonts/
 .next
 out
+pages/changelog.mdx
diff --git a/docs/next.config.js b/docs/next.config.js
index 14bc30cd..18810619 100644
--- a/docs/next.config.js
+++ b/docs/next.config.js
@@ -1,3 +1,16 @@
+const fs = require("node:fs");
+const path = require("node:path");
+
+function copyChangelog() {
+    const src = path.resolve(__dirname, "..", "CHANGELOG.md");
+    const data = fs.readFileSync(src);
+    const replaced = data.toString().replace("# Changelog\n\n", "");
+    const dst = path.resolve(__dirname, "pages", "changelog.mdx");
+    fs.writeFileSync(dst, replaced);
+}
+
+copyChangelog();
+
 const withNextra = require("nextra")({
     theme: "nextra-theme-docs",
     themeConfig: "./theme.config.tsx",
diff --git a/docs/pages/_meta.json b/docs/pages/_meta.json
index b3b34cbb..a30ea5af 100644
--- a/docs/pages/_meta.json
+++ b/docs/pages/_meta.json
@@ -1,34 +1,38 @@
 {
-  "index": { "title": "Introduction", "theme": { "breadcrumb": false } },
-  "---": {
-    "type": "separator"
-  },
-  "installation": "Installation",
-  "configuration": "Configuration",
-  "platforms": "Platforms",
-  "plugins": "Plugins",
-  "documentation": {
-    "title": "Documentation",
-    "type": "menu",
-    "items": {
-      "installation": {
-        "title": "Installation",
-        "href": "/installation"
-      },
-      "configuration": {
-        "title": "Configuration",
-        "href": "/configuration"
-      },
-      "plugins": {
-        "title": "Plugins",
-        "href": "/plugins"
-      }
+    "index": { "title": "Introduction", "theme": { "breadcrumb": false } },
+    "---": {
+        "type": "separator"
+    },
+    "installation": "Installation",
+    "configuration": "Configuration",
+    "platforms": "Platforms",
+    "plugins": "Plugins",
+    "documentation": {
+        "title": "Documentation",
+        "type": "menu",
+        "items": {
+            "installation": {
+                "title": "Installation",
+                "href": "/installation"
+            },
+            "configuration": {
+                "title": "Configuration",
+                "href": "/configuration"
+            },
+            "plugins": {
+                "title": "Plugins",
+                "href": "/plugins"
+            },
+            "changelog": {
+                "title": "Changelog",
+                "href": "/changelog"
+            }
+        }
+    },
+    "demo": {
+        "title": "Demo",
+        "type": "page",
+        "href": "https://demo.hyperglass.dev",
+        "newWindow": true
     }
-  },
-  "demo": {
-    "title": "Demo",
-    "type": "page",
-    "href": "https://demo.hyperglass.dev",
-    "newWindow": true
-  }
 }