e38c135000
- routers/web/tinqs_pages.go: TinqsDocsHandler serves Docusaurus build output from custom/public/docs/ with SPA fallback for client-side routing - routers/web/web.go: /docs and /docs/* routes - docs/docusaurus.config.js: url → tinqs.com, baseUrl → /docs/, added Blog + Wiki navbar links, fixed logo path - deploy-docs.yml: rsync to custom/public/docs/ instead of S3 bucket - templates: docs_placeholder.tmpl, Docs link in navbar URL map: tinqs.com/docs (SEO), tinqs.com/blog (SEO), tinqs.com/*/wiki (Gitea built-in, internal). One domain, zero subdomains. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
460 lines
11 KiB
JavaScript
460 lines
11 KiB
JavaScript
// @ts-check
|
|
// Note: type annotations allow type checking and IDEs autocompletion
|
|
|
|
import { themes as prismThemes } from "prism-react-renderer";
|
|
|
|
const lightCodeTheme = prismThemes.github;
|
|
const darkCodeTheme = prismThemes.dracula;
|
|
|
|
// order usage directory by type first
|
|
function sortItemsByCategory(items) {
|
|
// type with "category" (directory) first
|
|
const sortedItems = items.sort(function (a, b) {
|
|
return a.type.localeCompare(b.type);
|
|
});
|
|
return sortedItems;
|
|
}
|
|
|
|
const renderApiSSR = process.env.API_SSR !== "false";
|
|
|
|
const apiConfig = [
|
|
"redocusaurus",
|
|
{
|
|
// Plugin Options for loading OpenAPI files
|
|
specs: renderApiSSR
|
|
? [
|
|
{
|
|
route: "/api/next/",
|
|
spec: "static/swagger-latest.json",
|
|
},
|
|
{
|
|
route: "/api/",
|
|
spec: "static/swagger-26.json",
|
|
},
|
|
{
|
|
route: "/api/1.26/",
|
|
spec: "static/swagger-26.json",
|
|
},
|
|
{
|
|
route: "/api/1.25/",
|
|
spec: "static/swagger-25.json",
|
|
},
|
|
{
|
|
route: "/api/1.24/",
|
|
spec: "static/swagger-24.json",
|
|
},
|
|
{
|
|
route: "/api/1.23/",
|
|
spec: "static/swagger-23.json",
|
|
},
|
|
{
|
|
route: "/api/1.22/",
|
|
spec: "static/swagger-22.json",
|
|
},
|
|
]
|
|
: [],
|
|
// Theme Options for modifying how redoc renders them
|
|
theme: {
|
|
// Change with your site colors
|
|
primaryColor: "#1890ff",
|
|
},
|
|
},
|
|
];
|
|
|
|
const pageConfig = renderApiSSR
|
|
? {
|
|
exclude: ["api/**"],
|
|
}
|
|
: {};
|
|
|
|
const globalVariables = {
|
|
"current": {
|
|
goVersion: "1.26",
|
|
minGoVersion: "1.26",
|
|
minNodeVersion: "22",
|
|
version: "main-nightly",
|
|
sourceVersion: "main",
|
|
sourceBranch: "main",
|
|
dockerVersion: "nightly",
|
|
displayVersion: "1.27-dev",
|
|
},
|
|
"1.26": {
|
|
goVersion: "1.26",
|
|
minGoVersion: "1.26",
|
|
minNodeVersion: "22",
|
|
version: "1.26.2",
|
|
sourceVersion: "v1.26.2",
|
|
sourceBranch: "release/v1.26",
|
|
dockerVersion: "1.26.2",
|
|
displayVersion: "1.26.2",
|
|
},
|
|
"1.25": {
|
|
goVersion: "1.25",
|
|
minGoVersion: "1.25",
|
|
minNodeVersion: "22",
|
|
version: "1.25.5",
|
|
sourceVersion: "v1.25.0",
|
|
sourceBranch: "release/v1.25",
|
|
dockerVersion: "1.25.5",
|
|
displayVersion: "1.25.5",
|
|
},
|
|
"1.24": {
|
|
goVersion: "1.24",
|
|
minGoVersion: "1.24",
|
|
minNodeVersion: "22",
|
|
version: "1.24.7",
|
|
sourceVersion: "v1.24.0",
|
|
sourceBranch: "release/v1.24",
|
|
dockerVersion: "1.24.7",
|
|
displayVersion: "1.24.7",
|
|
},
|
|
"1.23": {
|
|
goVersion: "1.23",
|
|
minGoVersion: "1.22",
|
|
minNodeVersion: "18",
|
|
version: "1.23.8",
|
|
sourceVersion: "v1.23.8",
|
|
sourceBranch: "release/v1.23",
|
|
dockerVersion: "1.23.8",
|
|
displayVersion: "1.23.8",
|
|
},
|
|
"1.22": {
|
|
goVersion: "1.22",
|
|
minGoVersion: "1.22",
|
|
minNodeVersion: "18",
|
|
version: "1.22.6",
|
|
sourceVersion: "v1.22.6",
|
|
sourceBranch: "release/v1.22",
|
|
dockerVersion: "1.22.6",
|
|
displayVersion: "1.22.6",
|
|
},
|
|
};
|
|
|
|
const versions = {
|
|
"current": {
|
|
label: globalVariables["current"].displayVersion, // path is kept as next for dev (so users can always find "nightly" docs)
|
|
banner: "unreleased",
|
|
},
|
|
"1.26": {
|
|
label: globalVariables["1.26"].displayVersion,
|
|
},
|
|
"1.25": {
|
|
label: globalVariables["1.25"].displayVersion,
|
|
},
|
|
"1.24": {
|
|
label: globalVariables["1.24"].displayVersion,
|
|
},
|
|
"1.23": {
|
|
label: globalVariables["1.23"].displayVersion,
|
|
},
|
|
"1.22": {
|
|
label: globalVariables["1.22"].displayVersion,
|
|
},
|
|
};
|
|
|
|
/** @type {import('@docusaurus/types').Config} */
|
|
const config = {
|
|
title: "Tinqs Studio",
|
|
tagline: "The platform for agentic game development",
|
|
url: "https://tinqs.com",
|
|
baseUrl: "/docs/",
|
|
onBrokenLinks: "warn",
|
|
favicon: "img/favicon.png",
|
|
future: {
|
|
faster: true,
|
|
v4: true
|
|
},
|
|
plugins: [
|
|
[
|
|
"docusaurus-plugin-plausible",
|
|
{
|
|
domain: "tinqs.com",
|
|
},
|
|
],
|
|
|
|
// for runner documentations
|
|
[
|
|
"@docusaurus/plugin-content-docs",
|
|
{
|
|
id: "runner-docs",
|
|
path: "runner-docs",
|
|
routeBasePath: "runner",
|
|
//sidebarPath: './runner/sidebars.js',
|
|
versions: {
|
|
current: {
|
|
label: "main",
|
|
banner: "unreleased",
|
|
},
|
|
"0.2.11": {
|
|
path: "0.2.11",
|
|
label: "0.2.11",
|
|
},
|
|
},
|
|
lastVersion: "0.2.11",
|
|
editUrl: ({
|
|
versionDocsDirPath,
|
|
docPath,
|
|
locale,
|
|
version,
|
|
permalink,
|
|
}) => {
|
|
return `https://gitea.com/gitea/docs/src/branch/main/${
|
|
version === "current"
|
|
? "runner-docs"
|
|
: `runner-docs_versioned_docs/version-${version}`
|
|
}/${docPath}`;
|
|
},
|
|
async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
|
|
const { item } = args;
|
|
// Use the provided data to generate a custom sidebar slice
|
|
const sidebarItems = await defaultSidebarItemsGenerator(args);
|
|
if (item.dirName !== "usage") {
|
|
return sidebarItems;
|
|
} else {
|
|
return sortItemsByCategory(sidebarItems);
|
|
}
|
|
},
|
|
},
|
|
],
|
|
],
|
|
|
|
i18n: {
|
|
defaultLocale: "en-us",
|
|
locales: ["en-us", "zh-cn", "zh-tw"],
|
|
localeConfigs: {
|
|
"en-us": {
|
|
label: "English",
|
|
},
|
|
"zh-cn": {
|
|
label: "简体中文",
|
|
},
|
|
"zh-tw": {
|
|
label: "繁體中文",
|
|
},
|
|
},
|
|
},
|
|
|
|
presets: [
|
|
[
|
|
"@docusaurus/preset-classic",
|
|
//'classic',
|
|
/** @type {import('@docusaurus/preset-classic').Options} */
|
|
({
|
|
docs: {
|
|
sidebarPath: require.resolve("./sidebars.js"),
|
|
routeBasePath: "/", // Serve the docs at the site's root
|
|
editUrl: ({
|
|
versionDocsDirPath,
|
|
docPath,
|
|
locale,
|
|
version,
|
|
permalink,
|
|
}) => {
|
|
// Special case for awesome page
|
|
if (docPath.includes("awesome.md")) {
|
|
return `https://gitea.com/gitea/awesome-gitea/src/branch/main/README.md`;
|
|
}
|
|
if (locale === "en-us") {
|
|
return `https://gitea.com/gitea/docs/src/branch/main/${
|
|
version === "current"
|
|
? "docs"
|
|
: `versioned_docs/version-${version}`
|
|
}/${docPath}`;
|
|
}
|
|
return `https://gitea.com/gitea/docs/src/branch/main/i18n/${locale}/docusaurus-plugin-content-docs/${
|
|
version === "current" ? "current" : `version-${version}`
|
|
}/${docPath}`;
|
|
},
|
|
versions: versions,
|
|
lastVersion: "1.26",
|
|
async sidebarItemsGenerator({
|
|
defaultSidebarItemsGenerator,
|
|
...args
|
|
}) {
|
|
const { item } = args;
|
|
// Use the provided data to generate a custom sidebar slice
|
|
const sidebarItems = await defaultSidebarItemsGenerator(args);
|
|
if (item.dirName !== "usage") {
|
|
return sidebarItems;
|
|
} else {
|
|
return sortItemsByCategory(sidebarItems);
|
|
}
|
|
},
|
|
},
|
|
blog: false,
|
|
theme: {
|
|
customCss: require.resolve("./src/css/custom.css"),
|
|
},
|
|
pages: pageConfig,
|
|
gtag: {
|
|
trackingID: "G-KHM0KYT506",
|
|
},
|
|
}),
|
|
],
|
|
apiConfig,
|
|
],
|
|
markdown: {
|
|
hooks: {
|
|
onBrokenMarkdownLinks: "warn",
|
|
},
|
|
preprocessor: ({ filePath, fileContent }) => {
|
|
var key = "";
|
|
var found = false;
|
|
for (key in globalVariables) {
|
|
let folderName = key == "current" ? "current" : `version-${key}`;
|
|
if (filePath.includes(`/${folderName}/`)) {
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
if (key == "" || !found) {
|
|
key = "current";
|
|
}
|
|
|
|
let content = fileContent;
|
|
for (const variable in globalVariables[key]) {
|
|
content = content.replaceAll(
|
|
"@" + variable + "@",
|
|
globalVariables[key][variable]
|
|
);
|
|
}
|
|
|
|
return content;
|
|
},
|
|
},
|
|
themes: [
|
|
[
|
|
"@easyops-cn/docusaurus-search-local",
|
|
{
|
|
hashed: false,
|
|
language: ["en", "zh"],
|
|
highlightSearchTermsOnTargetPage: true,
|
|
explicitSearchResultPath: true,
|
|
indexBlog: false,
|
|
docsRouteBasePath: "/",
|
|
},
|
|
],
|
|
],
|
|
|
|
themeConfig:
|
|
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
|
({
|
|
image: '/img/gitea.svg',
|
|
metadata: [
|
|
{
|
|
name: "keywords",
|
|
content: "tinqs, studio, git, game development, ai, agents, cli, ci/cd",
|
|
},
|
|
],
|
|
colorMode: {
|
|
defaultMode: "dark",
|
|
disableSwitch: false,
|
|
respectPrefersColorScheme: true,
|
|
},
|
|
navbar: {
|
|
title: "Tinqs Studio",
|
|
logo: {
|
|
alt: "Tinqs Logo",
|
|
src: "img/logo.svg",
|
|
href: "https://tinqs.com",
|
|
target: "_self",
|
|
},
|
|
items: [
|
|
{
|
|
type: "doc",
|
|
docId: "index",
|
|
position: "left",
|
|
label: "Docs",
|
|
},
|
|
{
|
|
to: "/api/1.26/",
|
|
label: "API",
|
|
position: "left",
|
|
activeBaseRegex: "api/(1.22|1.23|1.24|1.25|1.26|next)/",
|
|
},
|
|
{
|
|
to: "/tinqs/cli",
|
|
label: "CLI",
|
|
position: "left",
|
|
},
|
|
{
|
|
to: "/runner/0.2.11/",
|
|
label: "Runner",
|
|
position: "left",
|
|
activeBaseRegex: "runner/(0.2.11|next)/",
|
|
},
|
|
{
|
|
type: "search",
|
|
position: "right",
|
|
},
|
|
{
|
|
type: "docsVersionDropdown",
|
|
position: "right",
|
|
dropdownActiveClassDisabled: true,
|
|
},
|
|
{
|
|
href: "https://tinqs.com/blog",
|
|
label: "Blog",
|
|
position: "right",
|
|
},
|
|
{
|
|
href: "https://tinqs.com/tinqs/studio/wiki",
|
|
label: "Wiki",
|
|
position: "right",
|
|
},
|
|
{
|
|
href: "https://tinqs.com",
|
|
label: "Platform",
|
|
position: "right",
|
|
},
|
|
{
|
|
href: "https://tinqs.com/user/login",
|
|
label: "Sign In",
|
|
position: "right",
|
|
className: "internal-href signin-button",
|
|
target: "_self",
|
|
},
|
|
],
|
|
},
|
|
footer: {
|
|
style: "dark",
|
|
links: [
|
|
{
|
|
title: "Tinqs",
|
|
items: [
|
|
{
|
|
label: "Platform",
|
|
href: "https://tinqs.com",
|
|
},
|
|
{
|
|
label: "Ariki Game",
|
|
href: "https://arikigame.com",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Resources",
|
|
items: [
|
|
{
|
|
label: "CLI Downloads",
|
|
href: "https://tinqs-cli-releases.s3.eu-west-1.amazonaws.com/tstudio/latest/",
|
|
},
|
|
{
|
|
label: "API",
|
|
href: "https://tinqs.com/api/swagger",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
copyright: `Copyright ${new Date().getFullYear()} Tinqs Ltd.`,
|
|
},
|
|
prism: {
|
|
theme: lightCodeTheme,
|
|
darkTheme: darkCodeTheme,
|
|
additionalLanguages: ["ini", "diff", "json", "http", "docker", "php"],
|
|
},
|
|
}),
|
|
};
|
|
|
|
module.exports = config;
|