-
Notifications
You must be signed in to change notification settings - Fork 222
/
gatsby-config.js
275 lines (264 loc) · 6.65 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
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
const path = require('path');
const { isProduction } = require('./src/utils/utils.node');
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
});
const shouldAnnouncementBannerBeShown = false;
const plugins = [
'gatsby-transformer-sharp',
{
resolve: 'gatsby-plugin-sharp',
options: {
defaults: {
quality: 90,
placeholder: 'none',
},
},
},
'gatsby-plugin-image',
'gatsby-plugin-catch-links',
'gatsby-plugin-resolve-src',
'gatsby-transformer-json',
{
resolve: 'gatsby-plugin-manifest',
options: {
name: 'k6',
short_name: 'k6',
start_url: '/',
background_color: '#fff',
theme_color: '#BADA55',
display: 'minimal-ui',
icon: './src/images/favicon.png',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'data',
path: `${__dirname}/src/data/`,
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: `${__dirname}/src/images`,
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'markdown',
path: `${__dirname}/src/data/markdown`,
},
},
{
resolve: 'gatsby-plugin-mdx',
options: {
extensions: ['.md'],
gatsbyRemarkPlugins: [
{
resolve: 'gatsby-remark-relative-images',
},
{
resolve: 'gatsby-remark-copy-linked-files',
},
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 800,
quality: 90,
withWebp: true,
disableBgImage: true,
wrapperStyle: 'margin-left: 0;',
showCaptions: ['title'],
},
},
],
},
},
{
resolve: 'gatsby-plugin-google-fonts',
options: {
fonts: ['roboto mono:300,400'],
},
},
{
resolve: 'gatsby-plugin-svgr-svgo',
options: {
inlineSvgOptions: [
{
test: /\.inline.svg$/,
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
'prefixIds',
],
},
},
],
urlSvgOptions: [
{
test: /\.svg$/,
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
],
},
},
],
},
},
{
resolve: 'gatsby-plugin-sass',
options: {
additionalData:
'@import "./src/styles/variables.scss", "./src/styles/mixins.scss";',
useResolveUrlLoader: true,
cssLoaderOptions: {
modules: {
namedExport: false,
exportLocalsConvention: 'camelCase',
},
},
},
},
{
resolve: 'gatsby-plugin-sitemap',
options: {
excludes: ['/get-started/welcome', '/docs/get-started/welcome'],
},
},
{
resolve: `@tmttn/gatsby-plugin-linkedin-insight`,
options: {
partnerId: '4981058',
includeInDevelopment: false,
},
},
];
const enableAlgolia = false;
if (
enableAlgolia &&
process.env.ALGOLIA_ADMIN_KEY &&
process.env.GATSBY_ALGOLIA_APP_ID &&
process.env.GATSBY_ALGOLIA_SEARCH_ONLY_KEY
) {
// const queries = require('./src/utils/algolia');
plugins.push({
resolve: 'gatsby-plugin-algolia',
options: {
appId: process.env.GATSBY_ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_ADMIN_KEY,
enablePartialUpdates: true,
matchFields: ['title', 'slug', 'content', 'excerpt', 'heading'],
// queries,
chunkSize: 10000, // default: 1000
},
});
}
if (shouldAnnouncementBannerBeShown) {
// See more on how it works:
// https://github.com/k6io/new.k6.io/pull/102
const options = {
banner: {
componentPath: path.join(
__dirname,
'./src/components/shared/announcement-banner/announcement-banner.js',
),
text:
// eslint-disable-next-line max-len
'🎉 We have migrated the docs to the Grafana website! To check out the docs for the latest version of k6, head over to grafana.com/docs/k6.',
link:
// eslint-disable-next-line max-len
'https://grafana.com/docs/k6/latest/',
buttonText: 'Learn more',
},
// settings below have to match
// settings in other repos to avoid
// unpredictable behavior
cookie: {
name: 'k6-announcement-banner-is-hidden',
consentBannerCookieName: 'user-has-accepted-cookies',
expiration: {
days: 60,
},
},
storage: {
// changing storage name to force users to see the banner even if it was disabled
name: 'k6-db-was-shown',
},
};
if (isProduction) {
// enabling GA in prod
options.ga = {
label: 'docs',
action: 'Click',
readMoreButtonCategory: 'BannerAnnouncementReadMore',
dismissButtonCategory: 'BannerAnnouncementDismiss',
};
}
plugins.push({
resolve: 'gatsby-plugin-announcement-banner',
options,
});
}
if (isProduction) {
plugins.push({
resolve: 'gatsby-plugin-google-tagmanager',
options: {
id: 'GTM-KBV9L4L',
includeInDevelopment: false,
},
});
plugins.push({
resolve: '@sentry/gatsby',
options: {
dsn: 'https://[email protected]/5289132',
environment: 'production',
},
});
}
if (process.env.BUCKET_NAME) {
plugins.push({
resolve: `gatsby-plugin-s3`,
options: {
generateRedirectObjectsForPermanentRedirects: true,
bucketName: process.env.BUCKET_NAME,
region: process.env.BUCKET_REGION,
protocol: 'https',
hostname: isProduction ? 'k6.io' : 'staging.k6.io',
},
});
}
module.exports = {
pathPrefix: process.env.PATH_PREFIX || `/docs`,
trailingSlash: 'always',
siteMetadata: {
siteTitle:
'Docs k6.io - Performance testing for developers, like unit-testing, for performance', // <title>
shortSiteTitle: 'k6', // <title> ending for posts and pages
siteDescription:
// eslint-disable-next-line max-len
'Grafana k6 is an open source developer-centric load and performance regression testing tool for cloud native APIs, microservices and web sites/apps. Tests are written in ES6 JS with support for HTTP/1.1, HTTP/2.0 and WebSocket protocols.',
siteImage: '/images/k6-cover-image.png',
siteUrl: process.env.GATSBY_DEFAULT_MAIN_URL,
authorName: 'k6',
authorTwitterAccount: '@k6_io',
},
plugins,
};