diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5fefb84..501b7ec 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,7 +26,6 @@ jobs: - name: Build run: | - pnpm run fetch-json-schema-docs pnpm run build - name: Deploy to GitHub Pages diff --git a/package.json b/package.json index 3b1ea91..241d1ec 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "fetch-json-schema-docs": "node scripts/fetch_json_schema_docs.js", "lint": "prettier --plugin-search-dir . --check . && eslint .", "format": "prettier --plugin-search-dir . --write .", "make-guide-images": "vite-node scripts/make_guide_images.ts" diff --git a/scripts/fetch_json_schema_docs.js b/scripts/fetch_json_schema_docs.js deleted file mode 100644 index f41af99..0000000 --- a/scripts/fetch_json_schema_docs.js +++ /dev/null @@ -1,64 +0,0 @@ -import { JSDOM } from "jsdom" -import { writeFileSync } from "fs" - -const baseURL = "https://well-known-docs.sandbox.ioxio-dataspace.com" -const files = [ - "consent-configuration.html", - "consent-request-token.html", - "consent-token.html", - "dataspace-configuration.html", - "party-configuration.html", -] - -async function loadFile(filename) { - const sourceUrl = `${baseURL}/${filename}` - const result = await fetch(sourceUrl) - return await result.text() -} - -async function processFile(srcHtml, dstPath) { - const dom = new JSDOM(srcHtml) - const body = dom.window.document.body - - // Unnecessary elements - body.querySelector(".breadcrumbs").remove() - body.querySelector("footer").remove() - - // Downgrade h1 -> h2 - const h1 = body.querySelector("h1") - const h2 = dom.window.document.createElement("h2") - h2.innerHTML = h1.innerHTML - h1.replaceWith(h2) - - // A few minor corrections - const links = body.querySelectorAll("a") - for (let link of links) { - const href = link.href - if (href.startsWith("http:") || href.startsWith("https://")) { - // External links should have target=_blank rel=noreferrer - link.target = "_blank" - link.rel = "noreferrer" - console.log(`Set to open in new tab: ${href}`) - } else if (href.endsWith(".html")) { - // Local relative .html link is pointing to schema documentation - // It should so point to `/schema/{schema}`, which matches the filename without .html extension - const schema = href.replace(/\.html$/, "") - const target = `/schemas/${schema}/` - link.href = target - console.log(`Rewriting ${href} -> ${target}`) - } - } - - writeFileSync(dstPath, body.innerHTML, { encoding: "utf-8", flag: "w" }) -} - -async function run() { - for (let filename of files) { - const dstPath = `static/assets/${filename}` - const srcHtml = await loadFile(filename) - await processFile(srcHtml, dstPath) - } -} - -// eslint-disable-next-line @typescript-eslint/no-empty-function -run().then(() => {})