-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathdocusaurus.config.ts
205 lines (192 loc) · 6.1 KB
/
docusaurus.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import { themes as prismThemes } from 'prism-react-renderer';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
require('dotenv').config();
const DOCS_SERVER_ROOT_URLS = {
development: 'localhost:8000',
production: 'website-api.hasura.io',
staging: 'website-api.stage.hasura.io',
};
const DOCS_SERVER_URLS = {
development: `http://${DOCS_SERVER_ROOT_URLS.development}`,
production: `https://${DOCS_SERVER_ROOT_URLS.production}`,
staging: `https://${DOCS_SERVER_ROOT_URLS.staging}`,
};
const BOT_ROUTES = {
development: `ws://${DOCS_SERVER_ROOT_URLS.development}/bot/query`,
production: `wss://${DOCS_SERVER_ROOT_URLS.production}/docs-services/docs-server/bot/query`,
staging: `wss://${DOCS_SERVER_ROOT_URLS.staging}/docs-services/docs-server/bot/query`,
};
const config: Config = {
title: 'Hasura DDN Docs',
tagline: 'Instant GraphQL on all your data',
favicon: 'img/favicon.png',
// Set the production url of your site here
url: 'https://hasura.io',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: process.env.CF_PAGES === '1' ? '/' : '/docs/3.0',
trailingSlash: true,
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'hasura', // Usually your GitHub org/user name.
projectName: 'docusaurus', // Usually your repo name.
staticDirectories: ['static', 'public'],
onBrokenLinks: 'throw',
onBrokenAnchors: 'throw',
onBrokenMarkdownLinks: 'throw',
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
customFields: {
docsBotEndpointURL: (() => {
if (process.env.CF_PAGES === '1') {
return BOT_ROUTES.staging; // if we're on CF pages, use the staging environment
} else {
const mode = process.env.release_mode;
if (mode === 'staging') {
return BOT_ROUTES.production; // use production route for staging
}
return BOT_ROUTES[mode ?? 'development'];
}
})(),
docsServerURL: (() => {
if (process.env.CF_PAGES === '1') {
return DOCS_SERVER_URLS.staging; // if we're on CF pages, use the staging environment
} else {
const mode = process.env.release_mode;
if (mode === 'staging') {
return DOCS_SERVER_URLS.production; // use production route for staging
}
return DOCS_SERVER_URLS[mode ?? 'development'];
}
})(),
hasuraVersion: 3,
DEV_TOKEN: process.env.DEV_TOKEN,
openReplayIngestPoint: 'https://analytics-openreplay.hasura-app.io/ingest',
openReplayProjectKey: 'x5WnKn7RdPjizi93Vp5I',
},
presets: [
[
'classic',
{
docs: {
routeBasePath: '/',
editUrl: ({ docPath }) => `https://github.com/hasura/ddn-docs/edit/main/docs/${docPath}`,
breadcrumbs: true,
// showLastUpdateAuthor: true,
// showLastUpdateTime: true,
lastVersion: 'current',
versions: {
current: {
label: 'v3.x (DDN)',
badge: true,
},
},
sidebarCollapsible: true,
sidebarPath: './sidebars.ts',
},
blog: false,
googleTagManager: {
containerId: 'GTM-PF5MQ2Z',
},
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
plugins: [
[
'@docusaurus/plugin-content-docs',
{
id: 'wiki',
path: 'wiki',
routeBasePath: 'wiki',
exclude: ['**/*.wip'],
// sidebarPath: './sidebarsCommunity.js',
// ... other options
},
],
async function tailwind(context, options) {
return {
name: 'docusaurus-tailwindcss',
configurePostCss(postcssOptions) {
// Appends TailwindCSS and AutoPrefixer.
postcssOptions.plugins.push(require('tailwindcss'));
postcssOptions.plugins.push(require('autoprefixer'));
return postcssOptions;
},
};
},
],
themeConfig: {
// Replace with your project's social card
image: 'img/og-social-card.jpg',
algolia: {
appId: '7M3BTIV34B',
// Public API key: it is safe to commit it
apiKey: '10f3d9d2cd836eec903fcabbd6d50139',
indexName: 'hasura',
},
announcementBar: {
id: 'announcementBar-5', // Increment on change
content: `This is the documentation for Hasura DDN, the future of data delivery. <a target="_blank" rel="noopener noreferrer" href="https://hasura.io/docs/latest/index/">Click here for the Hasura v2.x docs</a>.`,
},
navbar: {
title: '',
hideOnScroll: true,
logo: {
alt: 'Hasura Logo',
src: 'img/logo-dark.svg',
href: '/index',
srcDark: '/img/logo-light.svg',
},
items: [
{
type: 'docsVersionDropdown',
position: 'left',
dropdownActiveClassDisabled: true,
dropdownItemsAfter: [
{
href: 'https://hasura.io/docs/2.0/index/',
label: 'v2.x',
},
{
href: 'https://hasura.io/docs/1.0/graphql/core/index.html',
label: 'v1.x',
},
],
},
// {
// type: 'search',
// position: 'left',
// },
{
to: 'https://hasura.io/',
label: 'Hasura.io',
position: 'right',
},
// {
// to: 'https://cloud.hasura.io/login',
// label: 'Log In',
// position: 'right',
// },
],
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: ['json', 'typescript', 'bash', 'yaml'],
},
} satisfies Preset.ThemeConfig,
markdown: {
mermaid: true,
},
themes: ['@docusaurus/theme-mermaid'],
};
export default config;