Adding redoc / tsoa generated API docs.

This commit is contained in:
Dessalines 2025-01-22 11:06:07 -05:00
parent 38ad15408d
commit 12496167dd
4 changed files with 12 additions and 6 deletions

2
.gitmodules vendored
View file

@ -13,7 +13,7 @@
[submodule "lemmy-js-client"] [submodule "lemmy-js-client"]
path = lemmy-js-client path = lemmy-js-client
url = https://github.com/LemmyNet/lemmy-js-client url = https://github.com/LemmyNet/lemmy-js-client
branch = release/v0.19 branch = tsoa_1
[submodule "lemmy-stats-crawler"] [submodule "lemmy-stats-crawler"]
path = lemmy-stats-crawler path = lemmy-stats-crawler
url = https://github.com/LemmyNet/lemmy-stats-crawler.git url = https://github.com/LemmyNet/lemmy-stats-crawler.git

View file

@ -14,7 +14,7 @@ RUN tar -xzf mdbook.tar.gz
COPY lemmy-docs ./lemmy-docs COPY lemmy-docs ./lemmy-docs
RUN ./mdbook build lemmy-docs -d ../docs RUN ./mdbook build lemmy-docs -d ../docs
# Build the typedoc API docs # Build the typedoc lemmy-js-client docs, and swagger.json
FROM node:20-alpine AS api FROM node:20-alpine AS api
WORKDIR /app WORKDIR /app
COPY lemmy-js-client lemmy-js-client COPY lemmy-js-client lemmy-js-client
@ -22,6 +22,7 @@ WORKDIR /app/lemmy-js-client
RUN corepack enable pnpm RUN corepack enable pnpm
RUN pnpm i RUN pnpm i
RUN pnpm run docs RUN pnpm run docs
RUN pnpm tsoa
# Build the isomorphic app # Build the isomorphic app
FROM node:20-alpine AS builder FROM node:20-alpine AS builder
@ -48,9 +49,10 @@ COPY joinlemmy-translations joinlemmy-translations
COPY lemmy-translations lemmy-translations COPY lemmy-translations lemmy-translations
COPY src src COPY src src
# Copy the docs and API # Copy the rust docs, lemmy-js-client docs, and OpenAPI docs.
COPY --from=docs /app/docs ./src/assets/docs COPY --from=docs /app/docs ./src/assets/docs
COPY --from=api /app/lemmy-js-client/docs ./src/assets/api COPY --from=api /app/lemmy-js-client/docs ./src/assets/lemmy-js-client-docs
COPY --from=api /app/lemmy-js-client/redoc-static.html ./src/assets/api.html
RUN pnpm i RUN pnpm i
RUN pnpm prebuild:prod RUN pnpm prebuild:prod

@ -1 +1 @@
Subproject commit 5b3c7ebcfa7bc9598254999b72b9ec89007bd51e Subproject commit 2b7ef3dc1c82ddcebbae3b9247cfd76166a61f80

View file

@ -26,7 +26,11 @@ server.use(express.json() as RequestHandler);
server.use(express.urlencoded({ extended: false }) as RequestHandler); server.use(express.urlencoded({ extended: false }) as RequestHandler);
server.use("/static", express.static(path.resolve("./dist"))); server.use("/static", express.static(path.resolve("./dist")));
server.use("/docs", express.static(path.resolve("./dist/assets/docs"))); server.use("/docs", express.static(path.resolve("./dist/assets/docs")));
server.use("/api", express.static(path.resolve("./dist/assets/api"))); server.use("/api", express.static(path.resolve("./dist/assets/api.html")));
server.use(
"/lemmy-js-client-docs",
express.static(path.resolve("./dist/assets/lemmy-js-client-docs")),
);
server.use( server.use(
"/context.json", "/context.json",
cors, cors,