Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
node-version: "lts/*"
- name: Use corepack
run: corepack enable
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: yarn install --immutable
- name: Fetch SDK packages
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/static_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
node-version: "lts/*"
- name: Use corepack
run: corepack enable
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Run prepare
run: scripts/prepare.sh
- name: Install node dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,6 @@ build
docs/api/mobile/**
docs/api/web/**
docs/api/server/**
docs/api/server-python/**

.cursor/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
[submodule "api/room-manager"]
path = api/room-manager
url = git@github.com:fishjam-cloud/room-manager.git
[submodule "packages/python-server-sdk"]
path = packages/python-server-sdk
url = https://github.com/fishjam-cloud/python-server-sdk.git
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/*
packages/*
api/**
versioned_docs/*/api/**
docs/api/server-python/*
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ The Documentation explains how Fishjam works and how it can be integrated in you

### Local Development

#### Python

`python-server-sdk` requires [uv](https://docs.astral.sh/uv/). Make sure to have it installed first.

#### yarn

Get all dependencies

```
Expand Down
87 changes: 59 additions & 28 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import {
import { rendererClassic, transformerTwoslash } from "@shikijs/twoslash";
import {
NormalizedSidebar,
NormalizedSidebarItem,
SidebarItemsGeneratorVersion,
SidebarItemCategory,
} from "@docusaurus/plugin-content-docs/src/sidebars/types.js";

function isErrorFromVersionedDocs(options: { meta?: { __raw?: string } }) {
Expand Down Expand Up @@ -56,45 +58,74 @@ const rehypeShikiPlugin = [
} satisfies RehypeShikiOptions,
] satisfies MDXPlugin;

type CustomInjectedCategory = Omit<SidebarItemCategory, "items"> & {
items: any;
};

function injectTypeDocSidebar(
version: SidebarItemsGeneratorVersion,
items: NormalizedSidebar,
): NormalizedSidebar {
console.log(version.versionName);
Comment thread
p1003 marked this conversation as resolved.
const docs_without_python_reference = ["0.20.0", "0.21.0", "0.22.0"];

const exclude_python = docs_without_python_reference.includes(
version.versionName,
);

return items.map((item) => {
if (item.customProps?.id === "generated-api" && item.type === "category") {
const injectedItems: (CustomInjectedCategory | NormalizedSidebarItem)[] =
[
{
type: "category",
label: "React Native SDK",
link: { type: "doc", id: "api/mobile/index" },
items: require(
`${version.contentPath}/api/mobile/typedoc-sidebar.cjs`,
),
},
{
type: "category",
label: "React SDK",
link: { type: "doc", id: "api/web/index" },
items: require(
`${version.contentPath}/api/web/typedoc-sidebar.cjs`,
),
},
{
type: "category",
label: "Server SDK for JS",
link: { type: "doc", id: "api/server/index" },
items: require(
`${version.contentPath}/api/server/typedoc-sidebar.cjs`,
),
},
];

if (!exclude_python) {
injectedItems.push({
type: "category",
label: "Server SDK for Python",
link: { type: "doc", id: "api/server-python/fishjam" },
items: [
{
type: "autogenerated",
dirName: "api/server-python",
},
],
});
}

return {
...item,
items: [
...([
{
type: "category",
label: "React Native SDK",
link: { type: "doc", id: "api/mobile/index" },
items: require(
`${version.contentPath}/api/mobile/typedoc-sidebar.cjs`,
),
},
{
type: "category",
label: "React SDK",
link: { type: "doc", id: "api/web/index" },
items: require(
`${version.contentPath}/api/web/typedoc-sidebar.cjs`,
),
},
{
type: "category",
label: "Server SDK for JS",
link: { type: "doc", id: "api/server/index" },
items: require(
`${version.contentPath}/api/server/typedoc-sidebar.cjs`,
),
},
] as const),
...item.items.filter((element) => element.type == "doc"),
],
...injectedItems,
...item.items.filter((element) => element.type === "doc"),
] as NormalizedSidebar,
};
}

return item;
});
}
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"generate:python:docs": "sh ./scripts/generate_python_docs.sh",
"start": "npm run generate:python:docs && docusaurus start",
"build": "npm run generate:python:docs && docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
Expand Down
1 change: 1 addition & 0 deletions packages/python-server-sdk
Submodule python-server-sdk added at 5544a5
15 changes: 15 additions & 0 deletions scripts/generate_python_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -e

ROOTDIR=$(dirname $(dirname "$(readlink -f $0)"))
echo $ROOTDIR
cd $ROOTDIR

cd packages/python-server-sdk
uv sync --all-packages
uv run generate_docusaurus
cd $ROOTDIR

rm -rf docs/api/server-python
cp -r packages/python-server-sdk/docusaurus docs/api/server-python
Loading