Skip to content

Commit

Permalink
refacto to work with infrahub-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wartraxx51 committed Feb 24, 2025
1 parent f97452f commit fe04431
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 116 deletions.
21 changes: 4 additions & 17 deletions .github/workflows/sync-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 0 additions & 24 deletions docs/docs/introduction.mdx

This file was deleted.

38 changes: 31 additions & 7 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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!',
Expand All @@ -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",
Expand Down
35 changes: 35 additions & 0 deletions docs/sidebars-infrahubctl.ts
Original file line number Diff line number Diff line change
@@ -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;
48 changes: 48 additions & 0 deletions docs/sidebars-python-sdk.ts
Original file line number Diff line number Diff line change
@@ -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;
66 changes: 0 additions & 66 deletions docs/sidebars.ts

This file was deleted.

2 changes: 1 addition & 1 deletion docs/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function Home(): React.JSX.Element {
>
<main>
<div className="container margin-top--lg">
<h1>Tools & SDK</h1>
<h1>Tools & SDKs</h1>
</div>
</main>
</Layout>
Expand Down

0 comments on commit fe04431

Please sign in to comment.