-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathdocusaurus.config.ts
250 lines (237 loc) · 7.92 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
import type * as Preset from '@docusaurus/preset-classic'
import type { Config, DocusaurusConfig } from '@docusaurus/types'
import { themes } from 'prism-react-renderer'
import autoImportTabs from './src/remark/auto-import-tabs'
import fileExtSwitcher from './src/remark/file-ext-switcher'
import searchAndReplace from './src/remark/search-and-replace'
const lightCodeTheme = themes.github
const includeCurrentVersion =
process.env.DOCS_INCLUDE_CURRENT_VERSION === 'true'
const isProduction = process.env.NODE_ENV === 'production'
const config: Config = {
title: 'Wasp',
tagline:
'A simple language for developing full-stack web apps with less code.',
// url, baseUrl, organizationName, projectName and trailingSlash are set according to the
// instructions in https://docusaurus.io/docs/deployment#deploying-to-github-pages .
url: 'https://wasp.sh',
baseUrl: '/', // Should be name of repo if hosted on Github Pages, but can be just '/' if custom domain is used.
organizationName: 'wasp-lang', // Should be GitHub org/user name if hosted on Github Pages.
projectName: 'wasp', // Should be repo name if hosted on Github Pages.
trailingSlash: false,
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
themeConfig: {
announcementBar: {
id: 'LW7',
content:
'<b>Have a Wasp app in production?</b> 🐝 <a href="https://e44cy1h4s0q.typeform.com/to/EPJCwsMi">We\'ll send you some swag! 👕</a>',
backgroundColor: '#eab307',
textColor: '#fff',
isCloseable: false,
},
imageZoom: {
// CSS selector to apply the plugin to, defaults to '.markdown img'
//selector: '.markdown img',
// Optional medium-zoom options
// see: https://www.npmjs.com/package/medium-zoom#options
options: {
/*
margin: 24,
background: '#BADA55',
scrollOffset: 0,
container: '#zoom-container',
template: '#zoom-template',
*/
},
},
navbar: {
title: '.wasp (beta)',
logo: {
alt: 'Wasp logo',
src: 'img/wasp-logo-eqpar-circle.png',
href: 'https://wasp.sh/',
target: '_self',
},
items: [
{
type: 'docsVersion',
position: 'left',
label: 'Docs',
className: 'navbar-item-docs navbar-item-outside',
},
{
type: 'docsVersionDropdown',
position: 'left',
className: 'navbar-item-docs-version-dropdown',
},
{
to: 'blog',
label: 'Blog',
position: 'left',
},
{
href: 'https://github.com/wasp-lang/wasp',
className: 'navbar-item-github',
position: 'right',
},
{
href: 'https://twitter.com/WaspLang',
className: 'navbar-item-twitter',
position: 'right',
},
{
href: 'https://discord.gg/rzdnErX',
className: 'navbar-item-discord',
position: 'right',
},
],
},
prism: {
additionalLanguages: ['shell-session', 'haskell'],
theme: lightCodeTheme,
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Getting started',
to: 'docs',
},
{
label: 'Todo app tutorial',
to: 'docs/tutorial/create',
},
],
},
{
title: 'Community',
items: [
{
label: 'Discord',
href: 'https://discord.gg/rzdnErX',
},
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/wasp-lang/wasp',
},
{
label: 'Contact',
to: 'docs/contact',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Wasp.`,
},
algolia: {
appId: '2EJBEYUJK0',
apiKey: 'b90c50ab126398470abd0efa5d397870',
indexName: 'wasp',
// ContextualSearch is useful when you are doing versioning,
// it searches only in v1 docs if you are searching from v1 docs.
// Therefore we have it enabled, since we have multiple doc versions.
contextualSearch: true,
},
image: 'img/wasp_twitter_cover.png',
metadata: [{ name: 'twitter:card', content: 'summary_large_image' }],
} as Preset.ThemeConfig,
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
sidebarPath: './sidebars.ts',
sidebarCollapsible: true,
editUrl: 'https://github.com/wasp-lang/wasp/edit/release/web',
remarkPlugins: [autoImportTabs, fileExtSwitcher, searchAndReplace],
// ------ Configuration for multiple docs versions ------ //
// "current" docs (under /docs) are in-progress docs, so we show them only in development.
includeCurrentVersion,
// In development, we want "current" docs to be the default docs (served at /docs),
// to make it easier for us a bit. Otherwise, by default, the latest versioned docs
// will be served under /docs.
lastVersion: includeCurrentVersion ? 'current' : undefined,
// Uncomment line below to build and show only current docs, for faster build times
// during development, if/when needed.
// onlyIncludeVersions: includeCurrentVersion ? ["current"] : undefined,
// "versions" option here enables us to customize each version of docs individually,
// and there are also other options if we ever need to customize versioned docs further.
versions: {
// We provide config for `current` only during development because otherwise
// we don't even build them (due to includeCurrentVersion above), so this config
// would cause error in that case.
...(includeCurrentVersion
? {
current: {
label: 'Next', // Label shown in the documentation to address this version of docs.
noIndex: true, // these are un-released docs, we don't want search engines indexing them.
},
}
: {}),
// Configuration example:
// "0.11.1": {
// path: "0.11.1", // default, but can be anything.
// label: "0.11.1", // default, but can be anything.
// banner: "unmaintained"
// // and more!
// },
},
// ------------------------------------------------------ //
},
blog: {
showReadingTime: true,
blogSidebarCount: 'ALL',
blogSidebarTitle: 'All our posts',
postsPerPage: 'ALL',
editUrl: 'https://github.com/wasp-lang/wasp/edit/release/web',
onUntruncatedBlogPosts: 'log',
},
theme: {
customCss: ['./src/css/custom.css'],
},
} as Preset.Options,
],
],
scripts: getScripts(),
plugins: [
'plugin-image-zoom',
async function myPlugin(context, options) {
return {
name: 'docusaurus-tailwindcss',
configurePostCss(postcssOptions) {
// Appends TailwindCSS and AutoPrefixer.
postcssOptions.plugins.push(require('tailwindcss'))
postcssOptions.plugins.push(require('autoprefixer'))
return postcssOptions
},
}
},
],
}
function getScripts() {
const scripts: DocusaurusConfig['scripts'] = [
'/scripts/posthog.js',
'/js/fix-multiple-trailing-slashes.js',
]
if (isProduction) {
// Using Cloudflare Workers to proxy the analytics script
scripts.push({
src: '/waspara/wasp/script.js',
defer: true,
'data-domain': 'wasp.sh',
'data-api': '/waspara/wasp/event',
})
}
return scripts
}
export default config