From fe044310707fd713663cfe1984c58724e9f99a0c Mon Sep 17 00:00:00 2001 From: jeremy brisson Date: Mon, 24 Feb 2025 09:00:04 +0100 Subject: [PATCH] refacto to work with infrahub-docs --- .github/workflows/sync-docs.yml | 21 ++----- docs/docs/{ => infrahubctl}/infrahubctl.mdx | 2 +- docs/docs/introduction.mdx | 24 -------- docs/docusaurus.config.ts | 38 +++++++++--- docs/sidebars-infrahubctl.ts | 35 +++++++++++ docs/sidebars-python-sdk.ts | 48 +++++++++++++++ docs/sidebars.ts | 66 --------------------- docs/src/pages/index.tsx | 2 +- 8 files changed, 120 insertions(+), 116 deletions(-) rename docs/docs/{ => infrahubctl}/infrahubctl.mdx (95%) delete mode 100644 docs/docs/introduction.mdx create mode 100644 docs/sidebars-infrahubctl.ts create mode 100644 docs/sidebars-python-sdk.ts delete mode 100644 docs/sidebars.ts diff --git a/.github/workflows/sync-docs.yml b/.github/workflows/sync-docs.yml index 6487471..ee8a74f 100644 --- a/.github/workflows/sync-docs.yml +++ b/.github/workflows/sync-docs.yml @@ -32,24 +32,11 @@ jobs: - name: Sync folders run: | rm -rf target-repo/docs/docs-python-sdk/* - rm -f target-repo/python_sdk/examples/* rm -f target-repo/docs/sidebars-python-sdk.ts - cp -r source-repo/docs/docs/python-sdk/* target-repo/docs/docs-python-sdk - cp -r source-repo/examples/* target-repo/python_sdk/examples/ - cp source-repo/docs/sidebars.ts target-repo/docs/sidebars-python-sdk.ts - sed -i 's/python-sdk\///g' target-repo/docs/sidebars-python-sdk.ts - - for entry in source-repo/docs/docs/*; do - name=$(basename "$entry") - if [ "$name" != "python-sdk" ]; then - if [ -d "$entry" ]; then - cp -r "$entry"/* "target-repo/docs/docs/$name/" - elif [ -f "$entry" ]; then - cp "$entry" "target-repo/docs/docs/" - fi - fi - done - + rm -f target-repo/docs/sidebars-infrahubctl.ts + cp -r source-repo/docs/docs/* target-repo/docs/docs-python-sdk/ + cp source-repo/docs/sidebars-infrahubctl.ts target-repo/docs/ + cp source-repo/docs/sidebars-python-sdk.ts target-repo/docs/ cd target-repo git config user.name github-actions git config user.email github-actions@github.com diff --git a/docs/docs/infrahubctl.mdx b/docs/docs/infrahubctl/infrahubctl.mdx similarity index 95% rename from docs/docs/infrahubctl.mdx rename to docs/docs/infrahubctl/infrahubctl.mdx index 5e11dcf..624c8ad 100644 --- a/docs/docs/infrahubctl.mdx +++ b/docs/docs/infrahubctl/infrahubctl.mdx @@ -18,7 +18,7 @@ It's meant to run on any laptop or server and it communicates with a remote Infr ## Installation -The `infrahubctl` command line utility is installed as a part of the [Infrahub SDK for Python]($(base_url)python-sdk/guides/installation#ctl). +The `infrahubctl` command line utility is installed as a part of the [Infrahub SDK for Python](../python-sdk/guides/installation#ctl). ## Configuration diff --git a/docs/docs/introduction.mdx b/docs/docs/introduction.mdx deleted file mode 100644 index a683ae5..0000000 --- a/docs/docs/introduction.mdx +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: Tools & SDKs ---- - -# Tools & SDKs - -Welcome to the Tools & SDKs section of our project. This section contains essential developer tools and software development kits that will help you interact with and extend our platform. - -## Contents - -This section includes: - -- **SDK (Software Development Kit)** - Our SDK provides a comprehensive set of development tools, libraries, documentation, code samples, and processes that allow you to create applications for our platform. - -- **infrahubctl (Command Line Interface)** - infrahubctl is our command-line interface tool that enables you to manage and interact with our infrastructure directly from your terminal. It provides a powerful and efficient way to automate tasks and integrate with your existing workflows. - -## Getting Started - -To begin using these tools, please refer to the specific documentation in each tool's directory: - -- [SDK Documentation](/python-sdk/introduction) -- [Infrahubctl Documentation](/infrahubctl) diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index 0c7ee24..977e3db 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -36,9 +36,10 @@ const config: Config = { // Please change this to your repo. // Remove this to remove the "edit this page" links. editUrl: "https://github.com/opsmill/infrahub-sdk-python/tree/stable/docs", - routeBasePath: "/", + path: 'docs/python-sdk', + routeBasePath: 'python-sdk', + sidebarPath: './sidebars-python-sdk.ts', sidebarCollapsed: true, - sidebarPath: "./sidebars.ts", }, blog: false, theme: { @@ -47,7 +48,18 @@ const config: Config = { } satisfies Preset.Options, ], ], - + plugins: [ + [ + '@docusaurus/plugin-content-docs', + { + id: 'infrahubctl', + path: 'docs/infrahubctl', + routeBasePath: 'infrahubctl', + sidebarCollapsed: false, + sidebarPath: './sidebars-infrahubctl.ts', + }, + ], + ], themeConfig: { // announcementBar: { // content: 'Welcome to our brand new docs!', @@ -61,10 +73,22 @@ const config: Config = { }, items: [ { - type: "docSidebar", - sidebarId: "ToolsSDKsSidebar", - position: "left", - label: "Tools & SDKs", + type: 'dropdown', + position: 'left', + label: 'Tools & SDKs', + items: [ + { + type: "docSidebar", + sidebarId: "pythonSdkSidebar", + label: "Python SDK", + }, + { + type: "docSidebar", + sidebarId: "infrahubctlSidebar", + label: "Infrahubctl", + docsPluginId: "infrahubctl", + }, + ], }, // { // type: "search", diff --git a/docs/sidebars-infrahubctl.ts b/docs/sidebars-infrahubctl.ts new file mode 100644 index 0000000..e0ae57b --- /dev/null +++ b/docs/sidebars-infrahubctl.ts @@ -0,0 +1,35 @@ +import type {SidebarsConfig} from '@docusaurus/plugin-content-docs'; + +const sidebars: SidebarsConfig = { + infrahubctlSidebar: [ + { + type: 'doc', + id: 'infrahubctl', + label: 'Infrahubctl', + }, + { + type: 'category', + label: 'Commands', + items: [ + 'infrahubctl-branch', + 'infrahubctl-check', + 'infrahubctl-dump', + 'infrahubctl-generator', + 'infrahubctl-info', + 'infrahubctl-load', + 'infrahubctl-menu', + 'infrahubctl-object', + 'infrahubctl-protocols', + 'infrahubctl-render', + 'infrahubctl-repository', + 'infrahubctl-run', + 'infrahubctl-schema', + 'infrahubctl-transform', + 'infrahubctl-validate', + 'infrahubctl-version' + ], + }, + ], +}; + +export default sidebars; \ No newline at end of file diff --git a/docs/sidebars-python-sdk.ts b/docs/sidebars-python-sdk.ts new file mode 100644 index 0000000..da5f722 --- /dev/null +++ b/docs/sidebars-python-sdk.ts @@ -0,0 +1,48 @@ +import type {SidebarsConfig} from '@docusaurus/plugin-content-docs'; + +const sidebars: SidebarsConfig = { + pythonSdkSidebar: [ + { + type: 'category', + label: 'Python SDK', + link: { + type: 'doc', + id: 'introduction', + }, + items: [ + { + type: 'category', + label: 'Guides', + items: [ + 'guides/installation', + 'guides/client', + 'guides/query_data', + 'guides/create_update_delete', + 'guides/branches', + 'guides/store', + 'guides/tracking', + 'guides/batch', + 'guides/object-storage', + 'guides/resource-manager', + ], + }, + { + type: 'category', + label: 'Topics', + items: [ + 'topics/tracking', + ], + }, + { + type: 'category', + label: 'Reference', + items: [ + 'reference/config', + ], + }, + ], + }, + ], +}; + +export default sidebars; \ No newline at end of file diff --git a/docs/sidebars.ts b/docs/sidebars.ts deleted file mode 100644 index cbbbe4d..0000000 --- a/docs/sidebars.ts +++ /dev/null @@ -1,66 +0,0 @@ -import type {SidebarsConfig} from '@docusaurus/plugin-content-docs'; - -const sidebars: SidebarsConfig = { - ToolsSDKsSidebar: [ - { - type: 'category', - label: 'Tools & SDKs', - link: { - type: 'doc', - id: 'introduction', - }, - items: [ - { - type: 'category', - label: 'Python SDK', - link: { - type: 'doc', - id: 'python-sdk/introduction', - }, - items: [ - { - type: 'category', - label: 'Guides', - items: [ - 'python-sdk/guides/installation', - 'python-sdk/guides/client', - 'python-sdk/guides/query_data', - 'python-sdk/guides/create_update_delete', - 'python-sdk/guides/branches', - 'python-sdk/guides/store', - 'python-sdk/guides/tracking', - 'python-sdk/guides/batch', - 'python-sdk/guides/object-storage', - 'python-sdk/guides/resource-manager', - ], - }, - { - type: 'category', - label: 'Topics', - items: [ - 'python-sdk/topics/tracking', - ], - }, - { - type: 'category', - label: 'Reference', - items: [ - 'python-sdk/reference/config', - ], - }, - ], - }, - { - type: 'category', - label: 'infrahubctl', - link: { type: 'doc', id: 'infrahubctl' }, - items: [ - { type: 'autogenerated', dirName: 'infrahubctl' } - ], - }, - ], - }, - ], -}; - -export default sidebars; diff --git a/docs/src/pages/index.tsx b/docs/src/pages/index.tsx index 132c21f..0918a39 100644 --- a/docs/src/pages/index.tsx +++ b/docs/src/pages/index.tsx @@ -11,7 +11,7 @@ export default function Home(): React.JSX.Element { >
-

Tools & SDK

+

Tools & SDKs