From a9e1d20458d1533939dc31467e212483bbb66214 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Thu, 30 May 2024 08:06:29 +0200 Subject: [PATCH] fix(ci): validate and correct internal links --- docs/astro.config.mjs | 4 ++ docs/package.json | 1 + docs/src/content/docs/configuration.md | 28 ++++----- .../docs/deployment/local-test-server.md | 6 +- docs/src/content/docs/getting-started.md | 2 +- docs/yarn.lock | 58 +++++++++++++------ 6 files changed, 65 insertions(+), 34 deletions(-) diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 5e6002d..a45817d 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -1,5 +1,6 @@ import { defineConfig } from 'astro/config'; import starlight from '@astrojs/starlight'; +import starlightLinksValidator from 'starlight-links-validator' import starlightOpenAPI, { openAPISidebarGroups } from 'starlight-openapi'; @@ -46,6 +47,9 @@ export default defineConfig({ collapsed: false, }, ]), + // Validate internal links + // Ocumentation: https://starlight-links-validator.vercel.app/getting-started/ + starlightLinksValidator(), ], sidebar: [ { label: 'Introduction', link: '/' }, diff --git a/docs/package.json b/docs/package.json index 5867402..3bfca51 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,6 +13,7 @@ "@astrojs/starlight": "^0.23.1", "astro": "^4.8.6", "sharp": "^0.32.5", + "starlight-links-validator": "^0.9.0", "starlight-openapi": "^0.6.3" } } diff --git a/docs/src/content/docs/configuration.md b/docs/src/content/docs/configuration.md index 28865a8..05fc6dc 100644 --- a/docs/src/content/docs/configuration.md +++ b/docs/src/content/docs/configuration.md @@ -4,17 +4,17 @@ title: Configuration The following settings are available: -| **Environment Variable Name** | **Description** | **Required** | **Default** | **Example** | -| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | -| `DWS_OWNER` | DID of the server's owner | **yes** | | `did:key:z6MkrAvU5DpYtUjpJpohoKyKvWdbrQ1yyZcgM5TodLowsahP` | -| `DWS_ADDRESS` | Address that the service listens at | no | `127.0.0.1` | `0.0.0.0` | -| `DWS_BACKEND_FILE_STORE` | Path to the directory that holds the JSON DID files | no | `$PWD/did_store` | `/usr/web-id/did_store` | -| `DWS_BACKEND` | Storage backend, currently `mem` and `file` are implemented | no | `mem` | `file` | -| `DWS_EXTERNAL_HOSTNAME` | External DNS domain name that the server can be reached at | no | `localhost` | `example.com` | -| `DWS_EXTERNAL_PATH` | External path that the DIDs shall be served at | no | `/` | `/dids` | -| `DWS_EXTERNAL_PORT` | External port that the server can be reached at | no | `$DWS_PORT` if `$HOSTNAME == "localhost"`, otherwise `443` as required by the [specifiction](https://w3c-ccg.github.io/did-method-web/) | `3000` | -| `DWS_PORT` | Port that the service listens at | no | `3000` | `3000` | -| `DWS_RESOLVER_OVERRIDE` | DID HTTP Resolver compatible with [https://w3c-ccg.github.io/did-resolution/]() that's used as the first resolver, before the built-in resolver | no | | `http://uni-resolver-web:8080/1.0/identifiers/` | -| `DWS_RESOLVER` | DID HTTP Resolver compatible with [https://w3c-ccg.github.io/did-resolution/]() that's used after the built-in resovler | no | | `http://uni-resolver-web:8080/1.0/identifiers/` | -| `DWS_TLS` | Key and certificate for serving a HTTPS/TLS secured service | no | | `{certs="my.crt", key="private.key"}` | -| `DWS_` | Rocket offers more configuration settings, see [https://rocket.rs/v0.5-rc/guide/configuration/#environment-variables]() - prefix is `DWS_` | no | | | +| **Environment Variable Name** | **Description** | **Required** | **Default** | **Example** | +| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | +| `DWS_OWNER` | DID of the server's owner | **yes** | | `did:key:z6MkrAvU5DpYtUjpJpohoKyKvWdbrQ1yyZcgM5TodLowsahP` | +| `DWS_ADDRESS` | Address that the service listens at | no | `127.0.0.1` | `0.0.0.0` | +| `DWS_BACKEND_FILE_STORE` | Path to the directory that holds the JSON DID files | no | `$PWD/did_store` | `/usr/web-id/did_store` | +| `DWS_BACKEND` | Storage backend, currently `mem` and `file` are implemented | no | `mem` | `file` | +| `DWS_EXTERNAL_HOSTNAME` | External DNS domain name that the server can be reached at | no | `localhost` | `example.com` | +| `DWS_EXTERNAL_PATH` | External path that the DIDs shall be served at | no | `/` | `/dids` | +| `DWS_EXTERNAL_PORT` | External port that the server can be reached at | no | `$DWS_PORT` if `$HOSTNAME == "localhost"`, otherwise `443` as required by the [specifiction](https://w3c-ccg.github.io/did-method-web/) | `3000` | +| `DWS_PORT` | Port that the service listens at | no | `3000` | `3000` | +| `DWS_RESOLVER_OVERRIDE` | DID HTTP Resolver compatible with [https://w3c-ccg.github.io/did-resolution/](https://w3c-ccg.github.io/did-resolution/) that's used as the first resolver, before the built-in resolver | no | | `http://uni-resolver-web:8080/1.0/identifiers/` | +| `DWS_RESOLVER` | DID HTTP Resolver compatible with [https://w3c-ccg.github.io/did-resolution/](https://w3c-ccg.github.io/did-resolution/) that's used after the built-in resovler | no | | `http://uni-resolver-web:8080/1.0/identifiers/` | +| `DWS_TLS` | Key and certificate for serving a HTTPS/TLS secured service | no | | `{certs="my.crt", key="private.key"}` | +| `DWS_` | Rocket offers more configuration settings, see [https://rocket.rs/v0.5-rc/guide/configuration/#environment-variables](https://rocket.rs/v0.5-rc/guide/configuration/#environment-variables) - prefix is `DWS_` | no | | | diff --git a/docs/src/content/docs/deployment/local-test-server.md b/docs/src/content/docs/deployment/local-test-server.md index f6dda50..9a0138c 100644 --- a/docs/src/content/docs/deployment/local-test-server.md +++ b/docs/src/content/docs/deployment/local-test-server.md @@ -22,7 +22,8 @@ issue a valid certificate that can be used by the test server. The excellent [mkcert](https://github.com/FiloSottile/mkcert) tool simplifies the creation and operating system integration of a local Certificate Authority. Follow these steps to set up the Certificate Authority: -1. Install mkcert following the instructions on [https://github.com/FiloSottile/mkcert]() +1. Install mkcert following the instructions on + [https://github.com/FiloSottile/mkcert](https://github.com/FiloSottile/mkcert) 2. Setup and install local CA: ```bash @@ -69,7 +70,8 @@ docker run -it --rm -p 3000 --env-file .env -u "$(id -u):$(id -g)" -v "$PWD:/ser ### Test functionality The validity of the test server's certificate can be tested by either visiting -[https://localhost:3000/person1/did.json]() in the browser or running the following command: +[https://localhost:3000/person1/did.json](https://localhost:3000/person1/did.json) in the browser or running the +following command: ```bash curl -f https://localhost:3000/person1/did.json diff --git a/docs/src/content/docs/getting-started.md b/docs/src/content/docs/getting-started.md index 2555a99..4b06459 100644 --- a/docs/src/content/docs/getting-started.md +++ b/docs/src/content/docs/getting-started.md @@ -201,4 +201,4 @@ curl -f http://localhost:3000/person1/did.json | jq Congratulations, you've registered the first DID! 🎉 To make the server fully operational, a TLS certificate is required. The steps for adding a valid TLS certificate to this server are described in the -[deployment guide for a local test server](/deployment/test-server). +[deployment guide for a local test server](/deployment/local-test-server). diff --git a/docs/yarn.lock b/docs/yarn.lock index da7581a..361a28d 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -2084,7 +2084,7 @@ hast-util-embedded@^3.0.0: "@types/hast" "^3.0.0" hast-util-is-element "^3.0.0" -hast-util-from-html@^2.0.0, hast-util-from-html@^2.0.1: +hast-util-from-html@2.0.1, hast-util-from-html@^2.0.0, hast-util-from-html@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/hast-util-from-html/-/hast-util-from-html-2.0.1.tgz#9cd38ee81bf40b2607368b92a04b0905fa987488" integrity sha512-RXQBLMl9kjKVNkJTIO6bZyb2n+cUH8LFaSSzo82jiLT6Tfc+Pt7VQCS+/h3YwG4jaNE2TA2sdJisGWR+aJrp0g== @@ -2110,7 +2110,7 @@ hast-util-from-parse5@^8.0.0: vfile-location "^5.0.0" web-namespaces "^2.0.0" -hast-util-has-property@^3.0.0: +hast-util-has-property@3.0.0, hast-util-has-property@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/hast-util-has-property/-/hast-util-has-property-3.0.0.tgz#4e595e3cddb8ce530ea92f6fc4111a818d8e7f93" integrity sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA== @@ -2365,6 +2365,11 @@ inline-style-parser@0.2.3: resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.2.3.tgz#e35c5fb45f3a83ed7849fe487336eb7efa25971c" integrity sha512-qlD8YNDqyTKTyuITrDOffsl6Tdhv+UC4hcdAVuQsK4IMQ99nSgd1MIA/Q+jQYoh9r3hVUXhYh7urSRmXPkW04g== +is-absolute-url@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-absolute-url/-/is-absolute-url-4.0.1.tgz#16e4d487d4fded05cfe0685e53ec86804a5e94dc" + integrity sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A== + is-alphabetical@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-alphabetical/-/is-alphabetical-2.0.1.tgz#01072053ea7c1036df3c7d19a6daaec7f19e789b" @@ -2548,16 +2553,16 @@ kind-of@^6.0.0, kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +kleur@4.1.5, kleur@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.5.tgz#95106101795f7050c6c650f350c683febddb1780" + integrity sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ== + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== -kleur@^4.1.5: - version "4.1.5" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.5.tgz#95106101795f7050c6c650f350c683febddb1780" - integrity sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ== - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -2831,7 +2836,7 @@ mdast-util-to-markdown@^2.0.0, mdast-util-to-markdown@^2.1.0: unist-util-visit "^5.0.0" zwitch "^2.0.0" -mdast-util-to-string@^4.0.0: +mdast-util-to-string@4.0.0, mdast-util-to-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz#7a5121475556a04e7eddeb67b264aae79d312814" integrity sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg== @@ -3517,6 +3522,11 @@ picocolors@^1.0.0, picocolors@^1.0.1: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== +picomatch@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" + integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== + picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -4097,6 +4107,20 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== +starlight-links-validator@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/starlight-links-validator/-/starlight-links-validator-0.9.0.tgz#e03ae8e9d25d3a95fc37620437390f572bb6b16a" + integrity sha512-DJQDncEJBuuguPHJKP/SMmYdToWCFeEpZuRV5z9Qqgif3njJiF7dBRDAFdNIM2TCNADAZdseMOcR0iUpnvvjLQ== + dependencies: + github-slugger "2.0.0" + hast-util-from-html "2.0.1" + hast-util-has-property "3.0.0" + is-absolute-url "4.0.1" + kleur "4.1.5" + mdast-util-to-string "4.0.0" + picomatch "4.0.2" + unist-util-visit "5.0.0" + starlight-openapi@^0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/starlight-openapi/-/starlight-openapi-0.6.3.tgz#c1e90c243f98b66368b726930c0ad4e3a6ae8cfa" @@ -4459,6 +4483,15 @@ unist-util-visit-parents@^6.0.0, unist-util-visit-parents@^6.0.1: "@types/unist" "^3.0.0" unist-util-is "^6.0.0" +unist-util-visit@5.0.0, unist-util-visit@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-5.0.0.tgz#a7de1f31f72ffd3519ea71814cccf5fd6a9217d6" + integrity sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg== + dependencies: + "@types/unist" "^3.0.0" + unist-util-is "^6.0.0" + unist-util-visit-parents "^6.0.0" + unist-util-visit@^4.0.0: version "4.1.2" resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-4.1.2.tgz#125a42d1eb876283715a3cb5cceaa531828c72e2" @@ -4468,15 +4501,6 @@ unist-util-visit@^4.0.0: unist-util-is "^5.0.0" unist-util-visit-parents "^5.1.1" -unist-util-visit@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-5.0.0.tgz#a7de1f31f72ffd3519ea71814cccf5fd6a9217d6" - integrity sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg== - dependencies: - "@types/unist" "^3.0.0" - unist-util-is "^6.0.0" - unist-util-visit-parents "^6.0.0" - update-browserslist-db@^1.0.13: version "1.0.16" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz#f6d489ed90fb2f07d67784eb3f53d7891f736356"