forked from MetaMask/metamask-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docusaurus.config.js
364 lines (348 loc) · 10.7 KB
/
docusaurus.config.js
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const codeTheme = require("prism-react-renderer/themes/dracula");
const remarkCodesandbox = require("remark-codesandbox");
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "MetaMask developer documentation",
// tagline: '',
url: "https://docs.metamask.io",
baseUrl: process.env.DEST || "/", // overwritten in github action for staging / latest
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/metamask-fox.svg",
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "metamask", // Usually your GitHub org/user name.
projectName: "metamask-docs", // Usually your repo name.
// Even if you don't use internalization, 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"],
},
trailingSlash: true,
scripts: [
{ src: "https://plausible.io/js/script.js", defer: true, "data-domain": "docs.metamask.io" },
],
presets: [
[
"@metamask/docusaurus-openrpc/dist/preset",
/** @type {import('@metamask/docusaurus-openrpc/dist/preset').Options} */
({
docs: {
path: "wallet",
routeBasePath: "wallet",
sidebarPath: require.resolve("./wallet-sidebar.js"),
breadcrumbs: false,
editUrl: "https://github.com/MetaMask/metamask-docs/edit/main/",
remarkPlugins: [
require("remark-docusaurus-tabs"),
[remarkCodesandbox, {
mode: "iframe",
autoDeploy: process.env.NODE_ENV === "production",
}],
],
openrpc: {
openrpcDocument: "https://metamask.github.io/api-specs/latest/openrpc.json",
path: "reference",
sidebarLabel: "API Playground",
},
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
],
plugins: [
[
"@docusaurus/plugin-content-docs",
({
id: "snaps",
path: "snaps",
routeBasePath: "snaps",
editUrl: "https://github.com/MetaMask/metamask-docs/edit/main/",
sidebarPath: require.resolve("./snaps-sidebar.js"),
breadcrumbs: false,
remarkPlugins: [
require("remark-docusaurus-tabs"),
],
}),
],
[
"@docusaurus/plugin-client-redirects",
{
fromExtensions: ["html", "htm"],
redirects: [
{
from: "/guide/",
to: "/wallet/",
},
{
from: "/guide/getting-started",
to: "/wallet/get-started/set-up-dev-environment",
},
{
from: "/guide/common-terms",
to: "/wallet/",
},
{
from: "/guide/initializing-dapps",
to: "/wallet/how-to/interact-with-smart-contracts",
},
{
from: "/guide/accessing-accounts",
to: "/wallet/get-started/access-accounts",
},
{
from: "/guide/sending-transactions",
to: "/wallet/how-to/send-transactions",
},
{
from: "/guide/ethereum-provider",
to: "/wallet/reference/provider-api",
},
{
from: "/guide/provider-migration",
to: "/wallet/how-to/migrate-api",
},
{
from: "/guide/rpc-api",
to: "/wallet/reference/rpc-api",
},
{
from: "/guide/signing-data",
to: "/wallet/how-to/sign-data",
},
{
from: "/guide/registering-function-names",
to: "/wallet/how-to/register-method-names",
},
{
from: "/guide/registering-your-token",
to: "/wallet/how-to/register-token",
},
{
from: "/guide/defining-your-icon",
to: "/wallet/how-to/set-icon",
},
{
from: "/guide/onboarding-library",
to: "/wallet/how-to/use-onboarding-library",
},
{
from: "/guide/metamask-extension-provider",
to: "/wallet/how-to/access-provider",
},
{
from: "/guide/mobile-getting-started",
to: "/wallet/how-to/use-mobile",
},
{
from: "/guide/site-compatibility-checklist",
to: "/wallet/how-to/use-mobile",
},
{
from: "/guide/mobile-best-practices",
to: "/wallet/how-to/use-mobile",
},
{
from: "/guide/snaps",
to: "/snaps/",
},
{
from: "/guide/snaps-development-guide",
to: "/snaps/how-to/develop-a-snap",
},
{
from: "/guide/snaps-concepts",
to: "/snaps/category/concepts",
},
{
from: "/guide/snaps-rpc-api",
to: "/snaps/reference/rpc-api",
},
{
from: "/guide/snaps-permissions",
to: "/snaps/how-to/request-permissions",
},
{
from: "/guide/snaps-exports",
to: "/snaps/reference/exports",
},
{
from: "/guide/snaps-patching-dependencies",
to: "/snaps/how-to/troubleshoot",
},
{
from: "/guide/create-dapp",
to: "/wallet/get-started/set-up-dev-environment",
},
{
from: "/guide/contributors",
to: "/wallet/",
},
{
from: "/wallet/tutorials/simple-react-dapp",
to: "/wallet/tutorials/react-dapp-local-state",
},
].reduce((acc, item) => {
acc.push(item);
acc.push({ from: item.from + ".html", to: item.to });
return acc;
}, []),
},
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: " │ Documentation",
logo: {
alt: "MetaMask logo",
src: "img/metamask-logo.svg",
srcDark: "img/metamask-logo-dark.svg",
width: 150,
},
items: [
{
to: "wallet",
label: "Wallet",
},
{
to: "snaps",
label: "Snaps",
},
],
},
footer: {
logo: {
alt: "MetaMask logo",
src: "img/metamask-logo.svg",
srcDark: "img/metamask-logo-dark.svg",
href: "https://metamask.io/",
width: 250,
},
links: [
{
title: "Wallet",
items: [
{
label: "Introduction",
to: "/wallet",
},
{
label: "Get started",
to: "/wallet/category/get-started",
},
{
label: "How to guides",
to: "/wallet/category/how-to",
},
{
label: "Tutorials",
to: "/wallet/category/tutorials",
},
{
label: "Reference",
to: "/wallet/category/reference",
},
],
},
{
title: "Snaps",
items: [
{
label: "Introduction",
to: "/snaps",
},
{
label: "Get started",
to: "/snaps/category/get-started",
},
{
label: "How to guides",
to: "/snaps/category/how-to",
},
{
label: "Tutorials",
to: "/snaps/category/tutorials",
},
{
label: "Reference",
to: "/snaps/category/reference",
},
],
},
{
title: "Community",
items: [
{
label: "Consensys Discord",
href: "https://discord.gg/consensys",
},
{
label: "Documentation GitHub",
href: "https://github.com/MetaMask/metamask-docs",
},
{
label: "MetaMask wallet GitHub",
href: "https://github.com/MetaMask/metamask-extension/",
},
{
label: "Snaps GitHub",
href: "https://github.com/MetaMask/snaps-monorepo",
},
],
},
{
title: "Legal",
items: [
{
label: "Privacy Policy",
href: "https://consensys.net/privacy-policy/",
},
{
label: "Terms of Use",
href: "https://consensys.net/terms-of-use/",
},
{
label: "Contributor License Agreement",
href: "https://metamask.io/cla/",
},
],
},
],
copyright: `© ${new Date().getFullYear()} MetaMask • A Consensys Formation`,
},
prism: {
theme: codeTheme,
additionalLanguages: ["csharp","swift"],
},
algolia: {
// The application ID provided by Algolia
appId: "AWX4QVM59R",
// Public API key: it is safe to commit it
apiKey: "6095a25a6824bfa909fa0692e6847ec4",
indexName: "mm--v2-staging",
// Optional: see doc section below
contextualSearch: true,
// Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them.
// externalUrlRegex: "external\\.com|domain\\.com",
// Optional: Replace parts of the item URLs from Algolia. Useful when using the same search index for multiple deployments using a different baseUrl. You can use regexp or string in the `from` param. For example: localhost:3000 vs myCompany.com/docs
replaceSearchResultPathname: {
from: "/",
to: process.env.DEST || "/",
},
// Optional: Algolia search parameters
searchParameters: {},
// Optional: path for search page that enabled by default (`false` to disable it)
searchPagePath: "search",
//... other Algolia params
},
}),
};
module.exports = config;