mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2025-02-05 16:44:43 +00:00
Adding multiple versions os API docs at /api/next, and /api/latest .
- Fixes #452
This commit is contained in:
parent
42f40a9d19
commit
1e8223f777
2 changed files with 38 additions and 7 deletions
22
Dockerfile
22
Dockerfile
|
@ -15,9 +15,20 @@ COPY lemmy-docs ./lemmy-docs
|
||||||
RUN ./mdbook build lemmy-docs -d ../docs
|
RUN ./mdbook build lemmy-docs -d ../docs
|
||||||
|
|
||||||
# Build the typedoc lemmy-js-client docs, and swagger.json
|
# Build the typedoc lemmy-js-client docs, and swagger.json
|
||||||
FROM node:20-alpine AS api
|
FROM node:20-alpine AS api_latest
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY lemmy-js-client lemmy-js-client
|
COPY lemmy-js-client-latest lemmy-js-client
|
||||||
|
WORKDIR /app/lemmy-js-client
|
||||||
|
RUN corepack enable pnpm
|
||||||
|
RUN pnpm i
|
||||||
|
RUN pnpm run docs
|
||||||
|
# TODO OpenAPI isn't currently working for the latest docs. This can be changed after the next release.
|
||||||
|
# RUN pnpm tsoa
|
||||||
|
|
||||||
|
# Do the same for the api docs, but next
|
||||||
|
FROM node:20-alpine AS api_next
|
||||||
|
WORKDIR /app
|
||||||
|
COPY lemmy-js-client-next lemmy-js-client
|
||||||
WORKDIR /app/lemmy-js-client
|
WORKDIR /app/lemmy-js-client
|
||||||
RUN corepack enable pnpm
|
RUN corepack enable pnpm
|
||||||
RUN pnpm i
|
RUN pnpm i
|
||||||
|
@ -51,8 +62,11 @@ COPY src src
|
||||||
|
|
||||||
# Copy the rust docs, lemmy-js-client docs, and OpenAPI docs.
|
# 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/lemmy-js-client-docs
|
COPY --from=api_latest /app/lemmy-js-client/docs ./src/assets/lemmy-js-client-latest-docs
|
||||||
COPY --from=api /app/lemmy-js-client/redoc-static.html ./src/assets/api.html
|
# TODO OpenAPI isn't currently working for the latest docs. This can be changed after the next release.
|
||||||
|
# COPY --from=api_latest /app/lemmy-js-client/redoc-static.html ./src/assets/api_latest.html
|
||||||
|
COPY --from=api_next /app/lemmy-js-client/docs ./src/assets/lemmy-js-client-next-docs
|
||||||
|
COPY --from=api_next /app/lemmy-js-client/redoc-static.html ./src/assets/api_next.html
|
||||||
|
|
||||||
RUN pnpm i
|
RUN pnpm i
|
||||||
RUN pnpm prebuild:prod
|
RUN pnpm prebuild:prod
|
||||||
|
|
|
@ -26,10 +26,27 @@ 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.html")));
|
|
||||||
|
// The latest release docs
|
||||||
|
// TODO OpenAPI isn't currently working for the latest docs. This can be changed after the next release.
|
||||||
|
// server.use("/api/latest", express.static(path.resolve("./dist/assets/api_latest.html")));
|
||||||
server.use(
|
server.use(
|
||||||
"/lemmy-js-client-docs",
|
"/api/latest",
|
||||||
express.static(path.resolve("./dist/assets/lemmy-js-client-docs")),
|
express.static(path.resolve("./dist/assets/lemmy-js-client-latest-docs")),
|
||||||
|
);
|
||||||
|
server.use(
|
||||||
|
"/lemmy-js-client-docs/latest",
|
||||||
|
express.static(path.resolve("./dist/assets/lemmy-js-client-latest-docs")),
|
||||||
|
);
|
||||||
|
|
||||||
|
// The Next release docs
|
||||||
|
server.use(
|
||||||
|
"/api/next",
|
||||||
|
express.static(path.resolve("./dist/assets/api_next.html")),
|
||||||
|
);
|
||||||
|
server.use(
|
||||||
|
"/lemmy-js-client-docs/next",
|
||||||
|
express.static(path.resolve("./dist/assets/lemmy-js-client-next-docs")),
|
||||||
);
|
);
|
||||||
server.use(
|
server.use(
|
||||||
"/context.json",
|
"/context.json",
|
||||||
|
|
Loading…
Reference in a new issue