-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(deps): update dependency pdf-merger-js to v5 (#6707)
* Update dependency pdf-merger-js to v5 * Update PDF generation to use ESM modules * Fix PDF build workflow --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Heap <[email protected]>
- Loading branch information
1 parent
c8cf081
commit 9b4a7bb
Showing
8 changed files
with
129 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
const yaml = require('js-yaml') | ||
const fs = require('fs') | ||
import { load } from "js-yaml"; | ||
import { readFileSync } from "fs"; | ||
|
||
function extractUrls (input) { | ||
function extractUrls(input) { | ||
return input.flatMap((item) => { | ||
if (item.items) { | ||
return extractUrls(item.items) | ||
return extractUrls(item.items); | ||
} | ||
return item | ||
}) | ||
return item; | ||
}); | ||
} | ||
|
||
module.exports = function (input) { | ||
let nav = yaml.load(fs.readFileSync(input.path, 'utf8')) | ||
export default function (input) { | ||
let nav = load(readFileSync(input.path, "utf8")); | ||
|
||
// If it's single sourced, the nav is under nav.items | ||
if (nav.product && nav.items) { | ||
nav = nav.items; | ||
} | ||
|
||
let urls = extractUrls(nav) | ||
const urlVersion = input.version ? `/${input.version}` : '' | ||
let urls = extractUrls(nav); | ||
const urlVersion = input.version ? `/${input.version}` : ""; | ||
|
||
// Build a full URL if absolute_url isn't set | ||
urls = urls.map((url) => { | ||
if (url.absolute_url) { | ||
return url.url | ||
return url.url; | ||
} | ||
return `/${input.type}${urlVersion}${url.url}` | ||
}) | ||
return `/${input.type}${urlVersion}${url.url}`; | ||
}); | ||
|
||
// Normalise URLs to remove fragments + add trailing slash | ||
urls = urls.map((url) => { | ||
return url.split('#')[0].replace(/\/$/, '') + '/' | ||
}) | ||
return url.split("#")[0].replace(/\/$/, "") + "/"; | ||
}); | ||
|
||
// Unique list of URLs | ||
urls = [...new Set(urls)] | ||
urls = [...new Set(urls)]; | ||
|
||
// Remove any non-relative URLs | ||
urls = urls.filter((url) => { | ||
return !(url.includes('http://') || url.includes('https://')) | ||
}) | ||
return !(url.includes("http://") || url.includes("https://")); | ||
}); | ||
|
||
// Build full URLs | ||
urls = urls.map((x) => { | ||
return `http://localhost:8888${x}` | ||
}) | ||
return `http://localhost:8888${x}`; | ||
}); | ||
|
||
return urls | ||
return urls; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
const fg = require('fast-glob') | ||
import fg from "fast-glob"; | ||
|
||
module.exports = async function (plugin, version) { | ||
plugin = plugin || '*' | ||
version = version || '_index' | ||
let files = await fg(`../app/_hub/kong-inc/${plugin}/${version}.md`) | ||
export default async function (plugin, version) { | ||
plugin = plugin || "*"; | ||
version = version || "_index"; | ||
let files = await fg(`../app/_hub/kong-inc/${plugin}/${version}.md`); | ||
files = files.map((f) => { | ||
return f.replace('../app/_hub/', '/hub/').replace(/\.md$/, '.html').replace("_index", 'index') | ||
}) | ||
return f | ||
.replace("../app/_hub/", "/hub/") | ||
.replace(/\.md$/, ".html") | ||
.replace("_index", "index"); | ||
}); | ||
|
||
// Prefix with URL | ||
files = files.map((f) => { | ||
return `http://localhost:3000${f}` | ||
}) | ||
return `http://localhost:3000${f}`; | ||
}); | ||
|
||
return files | ||
return files; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,35 @@ | ||
const fg = require('fast-glob') | ||
module.exports = async function (path) { | ||
path = path || '*' | ||
import fg from "fast-glob"; | ||
export default async function (path) { | ||
path = path || "*"; | ||
const lookup = { | ||
deck: 'deck', | ||
kic: 'kubernetes-ingress-controller', | ||
konnect: 'konnect', | ||
mesh: 'mesh', | ||
gateway: 'gateway' | ||
} | ||
let files = await fg(`../app/_data/docs_nav_${path}.yml`) | ||
deck: "deck", | ||
kic: "kubernetes-ingress-controller", | ||
konnect: "konnect", | ||
mesh: "mesh", | ||
gateway: "gateway", | ||
}; | ||
let files = await fg(`../app/_data/docs_nav_${path}.yml`); | ||
files = files | ||
.map((f) => { | ||
if (f.includes('docs_nav_contributing')) { | ||
return | ||
if (f.includes("docs_nav_contributing")) { | ||
return; | ||
} | ||
const item = { path: f } | ||
const info = f.replace('../app/_data/docs_nav_', '').replace(/\.yml$/, '') | ||
const item = { path: f }; | ||
const info = f | ||
.replace("../app/_data/docs_nav_", "") | ||
.replace(/\.yml$/, ""); | ||
|
||
const x = info.split('_') | ||
item.type = lookup[x[0]] | ||
item.version = x[1] | ||
const x = info.split("_"); | ||
item.type = lookup[x[0]]; | ||
item.version = x[1]; | ||
|
||
return item | ||
return item; | ||
}) | ||
.filter((n) => n) | ||
.filter((n) => n); | ||
|
||
if (!files.length) { | ||
throw new Error(`No matching version found for '${path}'`) | ||
throw new Error(`No matching version found for '${path}'`); | ||
} | ||
|
||
return files | ||
return files; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.