Skip to content

Commit

Permalink
Rewrite references to internal repo for P4K to public docs
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-heyer committed Aug 23, 2023
1 parent 890b732 commit 89878ce
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scripts/fileProcessor/processors/cnp/replace-github-urls.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Replace URLs beginning with the following patterns...
// - https://github.com/EnterpriseDB/cloud-native-postgres/tree/main/docs/
// - https://raw.githubusercontent.com/EnterpriseDB/cloud-native-postgres/main/docs/src/
// ...with equivalent URLs referencing postgres for kubernetes in the public EDB Docs repo

const replacements = [
{pattern: /https:\/\/github\.com\/EnterpriseDB\/cloud-native-postgres\/tree\/main\/docs\//g, replacement: "https://github.com/EnterpriseDB/docs/tree/main/product_docs/docs/postgres-for-kubernetes/latest/"},
{pattern: /https:\/\/github\.com\/EnterpriseDB\/cloud-native-postgres\/blob\/main\/docs\//g, replacement: "https://github.com/EnterpriseDB/docs/blob/main/product_docs/docs/postgres-for-kubernetes/latest/"},
{pattern: /https:\/\/raw\.githubusercontent\.com\/EnterpriseDB\/cloud-native-postgres\/main\/docs\/src\//g, replacement: "https://raw.githubusercontent.com/EnterpriseDB/docs/main/product_docs/docs/postgres-for-kubernetes/latest/"},
];

export const process = (filename, content) => {
for (const r of replacements)
content = content.replace(r.pattern, r.replacement);

return {
newFilename: filename,
newContent: content,
};
};
1 change: 1 addition & 0 deletions scripts/source/process-cnp-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ node $DESTINATION_CHECKOUT/scripts/fileProcessor/main.mjs \

node $DESTINATION_CHECKOUT/scripts/fileProcessor/main.mjs \
-f "src/**/*.md" \
-p "cnp/replace-github-urls" \
-p "cnp/update-yaml-links" \
-p "cnp/add-frontmatters" \
-p "cnp/rename-to-mdx"
Expand Down
1 change: 1 addition & 0 deletions scripts/source/process-pgd4k-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cd $SOURCE_CHECKOUT/docs

node $DESTINATION_CHECKOUT/scripts/fileProcessor/main.mjs \
-f "src/**/*.md" \
-p "cnp/replace-github-urls" \
-p "cnp/update-yaml-links" \
-p "cnp/add-frontmatters" \
-p "cnp/rename-to-mdx"
Expand Down

0 comments on commit 89878ce

Please sign in to comment.