-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmagidoc.mjs
57 lines (50 loc) · 1.89 KB
/
magidoc.mjs
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
import path from 'path'
import { fileURLToPath } from 'url'
function markdown(string) {
// Takes the first indent and trims that length from everywhere.
// Markdown templates don't like the extra space at the beginning.
const target = string[0]
const trimSize = /^\s+/.exec(string)[0].length
return target
.split('\n')
.map((line) => line.substr(trimSize - 1))
.join('\n')
}
function relativePath(target) {
return path.join(path.dirname(fileURLToPath(import.meta.url)), target)
}
export default {
introspection: {
type: 'url',
url: 'https://spacex-production.up.railway.app/graphql',
},
website: {
template: 'carbon-multi-page',
staticAssets: relativePath('./assets'),
options: {
appTitle: 'SpaceX GraphQL API',
appLogo: '/logo.png',
appFavicon: '/favicon.png',
siteMeta: {
description: "Magidoc demo for SpaceX's GraphQL API.",
'og:description': "Magidoc demo for SpaceX's GraphQL API.",
},
pages: [
{
title: 'Welcome',
content: markdown`
# 👋 Hi
Welcome to [SpaceX](https://studio.apollographql.com/public/SpaceX-pxxbxen/variant/current/explorer)'s GraphQL documentation
generated with [Magidoc](https://github.com/magidoc-org/magidoc), a free open source software designed to build customizable static GraphQL documentation websites with little effort.
You wonder how easy it was to build this website? Have a look at the [configuration file](https://github.com/magidoc-org/magidoc/blob/main/packages/examples/spacex/magidoc.mjs).
## Wanna learn more?
Head to the docs to learn how to [generate your own static GraphQL documentation website](https://magidoc.js.org/introduction/welcome)!
`,
},
],
queryGenerationFactories: {
uuid: '<an-example-of-scalar-value>',
},
},
},
}