forked from apollographql/gatsby-theme-apollo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
176 lines (172 loc) · 4.13 KB
/
gatsby-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
const path = require('path');
const remarkTypescript = require('remark-typescript');
const {colors} = require('gatsby-theme-apollo-core/src/utils/colors');
const {HEADER_HEIGHT} = require('./src/utils');
module.exports = ({
root,
siteName,
pageTitle,
description,
githubHost = 'github.com',
githubRepo,
baseDir = '',
contentDir = 'content',
versions = {},
gaTrackingId,
ignore,
checkLinksOptions,
gatsbyRemarkPlugins = [],
remarkPlugins = []
}) => {
const allGatsbyRemarkPlugins = [
{
resolve: 'gatsby-remark-autolink-headers',
options: {
offsetY: HEADER_HEIGHT
}
},
{
resolve: 'gatsby-remark-copy-linked-files',
options: {
ignoreFileExtensions: []
}
},
{
resolve: 'gatsby-remark-mermaid',
options: {
mermaidOptions: {
themeCSS: `
.node rect,
.node circle,
.node polygon,
.node path {
stroke-width: 2px;
stroke: ${colors.primary};
fill: ${colors.background};
}
.node.secondary rect,
.node.secondary circle,
.node.secondary polygon,
.node.tertiary rect,
.node.tertiary circle,
.node.tertiary polygon {
fill: white;
}
.node.secondary rect,
.node.secondary circle,
.node.secondary polygon {
stroke: ${colors.secondary};
}
.cluster rect,
.node.tertiary rect,
.node.tertiary circle,
.node.tertiary polygon {
stroke: ${colors.tertiaryLight};
}
.cluster rect {
fill: none;
stroke-width: 2px;
}
.label, .edgeLabel {
background-color: white;
line-height: 1.3;
}
.edgeLabel rect {
background: none;
fill: none;
}
.messageText, .noteText, .loopText {
font-size: 12px;
stroke: none;
}
g rect, polygon.labelBox {
stroke-width: 2px;
}
g rect.actor {
stroke: ${colors.tertiary};
fill: white;
}
g rect.note {
stroke: ${colors.secondary};
fill: white;
}
g line.loopLine, polygon.labelBox {
stroke: ${colors.primary};
fill: white;
}
`
}
}
},
'gatsby-remark-code-titles',
{
resolve: 'gatsby-remark-prismjs',
options: {
showLineNumbers: true
}
},
'gatsby-remark-rewrite-relative-links',
{
resolve: 'gatsby-remark-check-links',
options: checkLinksOptions
},
...gatsbyRemarkPlugins
];
const plugins = [
'gatsby-theme-apollo-core',
{
resolve: 'gatsby-source-filesystem',
options: {
path: path.join(root, contentDir),
name: 'docs',
ignore
}
},
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: allGatsbyRemarkPlugins
}
},
{
resolve: 'gatsby-plugin-mdx',
options: {
gatsbyRemarkPlugins: allGatsbyRemarkPlugins,
remarkPlugins: [
[remarkTypescript, {wrapperComponent: 'MultiCodeBlock'}],
...remarkPlugins
]
}
},
'gatsby-plugin-printer',
...Object.entries(versions).map(([name, branch]) => ({
resolve: 'gatsby-source-git',
options: {
name,
branch,
remote: `https://${githubHost}/${githubRepo}`,
patterns: [
path.join(baseDir, contentDir, '**'),
path.join(baseDir, 'gatsby-config.js'),
path.join(baseDir, '_config.yml')
]
}
}))
];
if (gaTrackingId) {
plugins.push({
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: gaTrackingId
}
});
}
return {
siteMetadata: {
title: pageTitle || siteName,
siteName,
description
},
plugins
};
};