Skip to content

Commit

Permalink
fix(docs): product relative links (#3401)
Browse files Browse the repository at this point in the history
      Closes #2816

- fix(docs): Add override to ensure function bindings docs don't have
relative links without the terraform product prefix in them
- fix(docs): update API docs
  • Loading branch information
ansgarm authored Jan 10, 2024
1 parent 610a4f9 commit 703bb69
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tools/generate-function-bindings/scripts/fetch-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,21 @@ async function fetchMetadata() {
`${TERRAFORM_BINARY_NAME} metadata functions -json`
).toString();
const out = path.join(__dirname, FUNCTIONS_METADATA_FILE);
await fs.writeFile(out, prettier.format(json, { parser: "json" }));

const fixed = fixProductRelativeLinks(json);

await fs.writeFile(out, prettier.format(fixed, { parser: "json" }));
}

/**
* There are some relative links in the functions definitions that have the format
* /language/xy
* whereas the developer portal expects them to be
* /terraform/language/xy
* Until this is fixed in the terraform codebase, we need to fix this manually here.
*/
function fixProductRelativeLinks(content: string): string {
return content.replace(/\(\/language\//g, "(/terraform/language/");
}

fetchMetadata();

0 comments on commit 703bb69

Please sign in to comment.