-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6abfd7d
commit f918859
Showing
16 changed files
with
3,164 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
import remarkMdx from "remark-mdx"; | ||
import remarkParse from "remark-parse"; | ||
import { unified } from "unified"; | ||
import { visit } from "unist-util-visit"; | ||
|
||
const validateInternalLinks = () => { | ||
return async function transformer(tree, file) { | ||
const fileDir = path.dirname(file.path); | ||
|
||
const resolveFilePath = (basePath) => | ||
basePath.startsWith("/") | ||
? path.resolve(process.cwd(), "pages", `${basePath.slice(1)}.mdx`) | ||
: path.resolve(fileDir, `${basePath}.mdx`); | ||
|
||
const hasValidFragment = (ast, fragment) => { | ||
const isHeadingNode = (node) => node.type === "heading"; | ||
const isTextNode = (child) => child.type === "text"; | ||
const normalizeText = (text) => | ||
text.trim().replace(/\s+/g, "-").toLowerCase(); | ||
|
||
return ast.children?.some((node) => { | ||
if (isHeadingNode(node)) | ||
return node.children?.some( | ||
(child) => | ||
isTextNode(child) && normalizeText(child.value) === fragment, | ||
); | ||
return false; | ||
}); | ||
}; | ||
|
||
const validateLink = async (url) => { | ||
if (url.startsWith("http://") || url.startsWith("https://")) return; | ||
|
||
const [basePath, fragment] = url.split("#"); | ||
const resolvedPath = resolveFilePath(basePath); | ||
|
||
if (!fs.existsSync(resolvedPath)) | ||
throw new Error(`File not found for ${basePath}. URL: ${url}`); | ||
|
||
if (!fragment) return; | ||
|
||
const fileContent = fs.readFileSync(resolvedPath, "utf-8"); | ||
const ast = await unified() | ||
.use(remarkParse) | ||
.use(remarkMdx) | ||
.parse(fileContent); | ||
|
||
if (!hasValidFragment(ast, fragment)) | ||
throw new Error(`Fragment "${fragment}" not found in ${url}`); | ||
}; | ||
|
||
visit(tree, "link", (node) => validateLink(node.url)); | ||
|
||
visit(tree, "mdxJsxFlowElement", (node) => { | ||
const hrefAttr = node.attributes?.find((attr) => attr.name === "href"); | ||
if (hrefAttr?.value) validateLink(hrefAttr.value); | ||
}); | ||
}; | ||
}; | ||
|
||
export default { | ||
plugins: [ | ||
"remark-preset-lint-recommended", | ||
"remark-frontmatter", | ||
"remark-lint", | ||
"remark-mdx", | ||
"remark-lint-are-links-valid", | ||
"remark-lint-no-dead-urls", | ||
"remark-lint-no-undefined-references", | ||
validateInternalLinks, | ||
], | ||
settings: { | ||
atxHeadingWithMarker: false, | ||
headingStyle: "atx", | ||
}, | ||
}; |
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
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
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: Integrations Overview | ||
--- | ||
|
||
# Integrations Overview | ||
|
||
Integrations allow you to connect Ctrlplane with various services, enhancing | ||
your deployment capabilities and workflows. Below are the available integrations | ||
you can set up. | ||
|
||
## Available Integrations | ||
|
||
import { Cards } from "nextra/components"; | ||
import { SiGithub, SiGooglecloud, SiKubernetes } from "react-icons/si"; | ||
|
||
<Cards> | ||
<Cards.Card | ||
icon={<SiGithub className="h-8 w-8" />} | ||
title="GitHub" | ||
href="/integrations/github" | ||
/> | ||
<Cards.Card | ||
icon={<SiGooglecloud className="h-8 w-8" />} | ||
title="Google Cloud" | ||
href="/integrations/google-cloud/compute-scanner" | ||
/> | ||
<Cards.Card | ||
icon={<SiKubernetes className="h-8 w-8" />} | ||
title="Kubernetes" | ||
href="/integrations/kubernetes/jobs-agent" | ||
/> | ||
</Cards> | ||
|
||
## How to Set Up Integrations | ||
|
||
To set up an integration, follow the specific instructions provided in the | ||
respective integration documentation. Ensure you have the necessary permissions | ||
and configurations in place to connect Ctrlplane with the external service. | ||
|
||
For more detailed information on each integration, please refer to the links | ||
provided in the cards above. |
4 changes: 4 additions & 0 deletions
4
apps/docs/pages/self-hosted/overview.mdx → apps/docs/pages/self-hosted.mdx
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.