-
Notifications
You must be signed in to change notification settings - Fork 5
/
gatsby-config.ts
613 lines (591 loc) · 21.5 KB
/
gatsby-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
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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
/**
* Configure your Gatsby site with this file.
*
* See: https://www.gatsbyjs.com/docs/reference/config-files/gatsby-config/
*/
import path from 'path';
import { GatsbyConfig } from 'gatsby';
import { normalizeConnector } from './src/utils';
import { SUPABASE_CONNECTION_STRING } from './config';
// Disable multiple prepared statements because pgbouncer doesn't like 'em very much
process.env.POSTGRAPHILE_PREPARED_STATEMENT_CACHE_SIZE = '1';
const strapiConfig = {
apiURL: process.env.STRAPI_API_URL,
accessToken: process.env.STRAPI_TOKEN,
collectionTypes: [
'blog-post',
'company-update-post',
'tag',
'author',
'connection',
'connector',
'testimonial',
'vanity-logo',
'job-posting',
'employee',
'podcast',
{
singularName: 'case-study',
queryParams: {
populate: {
Logo: {
populate: '*',
},
About: {
populate: {
Topics: {
populate: '*',
},
},
},
},
},
},
{
singularName: 'comparison',
queryParams: {
populate: {
logo: {
populate: '*',
},
UseCases: {
populate: {
ODS_Replication: {
populate: '*',
},
Data_Integration: {
populate: '*',
},
Data_Migration: {
populate: '*',
},
Stream_Processing: {
populate: '*',
},
Operational_Analytics: {
populate: '*',
},
AI_Pipelines: {
populate: '*',
},
},
},
Connectors: {
populate: {
Third_Party: {
populate: '*',
},
Custom_SDK: {
populate: '*',
},
Admin_API: {
populate: '*',
},
},
},
Features: {
populate: {
ETL_Transforms: {
populate: '*',
},
ELT_Transforms: {
populate: '*',
},
Store_Replay: {
populate: '*',
},
Time_Travel: {
populate: '*',
},
Schema_Inference: {
populate: '*',
},
Data_Ops: {
populate: '*',
},
Snapshots: {
populate: '*',
},
easeOfUse: {
populate: '*',
},
},
},
Deployment: {
populate: {
Abilities: {
populate: '*',
},
Security: {
populate: '*',
},
},
},
Support: {
populate: {
Support: '*',
},
},
Cost: {
populate: {
Vendor: {
populate: '*',
},
Data_Engineering: {
populate: '*',
},
Admin: {
populate: '*',
},
},
},
introductoryDetails: {
populate: {
Introduction: {
populate: '*',
},
Pros: {
populate: '*',
},
Cons: {
populate: '*',
},
Pricing: {
populate: '*',
},
},
},
},
},
},
],
singleTypes: [],
// remoteFileHeaders: {
// /**
// * Customized request headers
// * For http request with a image or other files need authorization
// * For expamle: Fetch a CDN file which has a security config when gatsby building needs
// */
// Referer: "https://your-site-domain/",
// // Authorization: "Bearer eyJhabcdefg_replace_it_with_your_own_token",
// },
};
const rehypeSelectors = {
STRAPI_BLOG_POST_BODY_TEXTNODE: {
extractor: (node) => node.Body,
pluginOpts: {
enableToc: false,
},
},
STRAPI_COMPANY_UPDATE_POST_BODY_TEXTNODE: {
extractor: (node) => node.body,
pluginOpts: {
enableToc: false,
},
},
STRAPI_JOB_POSTING_DESCRIPTION_TEXTNODE: {
extractor: (node) => node.Description,
pluginOpts: { enableToc: false },
},
STRAPI_CASE_STUDY_BODY_TEXTNODE: {
extractor: (node) => node.Body,
pluginOpts: {
enableToc: false,
},
},
STRAPI_CASE_STUDY_SIDECONTENT_TEXTNODE: {
extractor: (node) => node.SideContent,
pluginOpts: {
enableToc: false,
},
},
STRAPI__COMPONENT_CASE_STUDY_CASE_STUDY_ABOUT_DESCRIPTION_TEXTNODE: {
extractor: (node) => node.Description,
pluginOpts: {
enableToc: false,
},
},
};
/**
* @type {import('gatsby').GatsbyConfig}
*/
const cfg: GatsbyConfig = {
siteMetadata: {
title: 'Estuary',
description: 'Estuary',
siteUrl: 'https://estuary.dev',
social: {
twitter: 'estuary twitter',
},
},
flags: {
PARALLEL_SOURCING: true,
DEV_SSR: true,
},
// graphqlTypegen: true,
plugins: [
{
resolve: `gatsby-plugin-webfonts`,
options: {
fonts: {
google: [
{
family: `Inter`,
variants: [
`200`,
`300`,
`400`,
`500`,
`600`,
`700`,
`900`,
],
},
],
},
formats: ['woff2', 'woff'],
useMinify: true,
usePreload: true,
usePreconnect: true,
},
},
{
resolve: 'gatsby-plugin-preconnect',
options: {
domains: ['https://hs-banner.com', 'https://hs-scripts.com'],
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/images`,
name: 'blog_images',
},
},
{
resolve: 'gatsby-source-strapi',
options: strapiConfig,
},
{
resolve: 'gatsby-plugin-sitemap',
options: {
query: `
{
site {
siteMetadata {
siteUrl
}
}
allSitePage {
nodes {
path
pageContext
}
}
}
`,
serialize: ({ path: serializePath, pageContext }) => {
return {
url: serializePath,
lastmod: pageContext?.lastMod,
};
},
},
},
'gatsby-plugin-robots-txt',
'gatsby-transformer-inline-svg',
'gatsby-plugin-image',
// `gatsby-plugin-svgr-svgo`,
{
resolve: 'gatsby-transformer-rehype',
options: {
// Condition for selecting an existing GrapghQL node (optional)
// If not set, the transformer operates on file nodes.
filter: (node) =>
Object.keys(rehypeSelectors).includes(node.internal.type),
// Only needed when using filter (optional, default: node.html)
// Source location of the html to be transformed
source: (node) =>
rehypeSelectors[node.internal.type].extractor(node),
// Additional fields of the sourced node can be added here (optional)
// These fields are then available on the htmlNode on `htmlNode.context`
contextFields: [],
// Fragment mode (optional, default: true)
fragment: true,
// Space mode (optional, default: `html`)
space: 'html',
// EmitParseErrors mode (optional, default: false)
emitParseErrors: true,
// Verbose mode (optional, default: false)
verbose: true,
// Plugins configs (optional but most likely you need one)
plugins: [
{
resolve: '@draftbox-co/gatsby-rehype-inline-images',
// all options are optional and can be omitted
pluginOptions: {
// all images larger are scaled down to maxWidth (default: maxWidth = imageWidth)
// maxWidth: 2000,
// disable, if you need to save memory
useImageCache: true,
quality: 100,
},
},
{
// Can't use require.resolve
// https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/#requireresolve
resolve: path.resolve(
'./plugins/estuary-rehype-transformers'
),
pluginOptions: Object.assign(
{},
...Object.entries(rehypeSelectors).map(
([k, { pluginOpts }]) => ({ [k]: pluginOpts })
)
),
},
],
},
},
'gatsby-plugin-less',
{
resolve: 'gatsby-plugin-local-search',
options: {
// A unique name for the search index. This should be descriptive of
// what the index contains. This is required.
name: 'posts',
// Set the search engine to create the index. This is required.
// The following engines are supported: flexsearch, lunr
engine: 'lunr',
// Provide options to the engine. This is optional and only recommended
// for advanced users.
//
// Note: Only the flexsearch engine supports options.
// engineOptions: "default",
// GraphQL query used to fetch all data for the search index. This is required.
query: `
{
allStrapiBlogPost{
nodes {
id
title: Title
slug: Slug
publishedAt(formatString: "MMMM D, YYYY")
tags: tags {
Name
Slug
Type
}
authors {
name: Name
picture: Picture {
localFile {
childImageSharp {
gatsbyImageData(layout: CONSTRAINED, width: 50, placeholder: BLURRED)
}
}
}
}
hero: Hero {
localFile {
childImageSharp {
gatsbyImageData(
layout: CONSTRAINED
placeholder: BLURRED
width: 400
aspectRatio: 1.7
formats: [AUTO, WEBP, AVIF]
)
# Further below in this doc you can learn how to use these response images
}
}
}
}
}
}
`,
// Field used as the reference value for each document.
// Default: 'id'.
ref: 'id',
// List of keys to index. The values of the keys are taken from the
// normalizer function below.
// Default: all fields
index: ['title', 'searchable_tags'],
// List of keys to store and make available in your UI. The values of
// the keys are taken from the normalizer function below.
// Default: all fields
store: [
'id',
'title',
'slug',
'publishedAt',
'tags',
'authors',
'hero',
],
// Function used to map the result from the GraphQL query. This should
// return an array of items to index in the form of flat objects
// containing properties to index. The objects must contain the `ref`
// field above (default: 'id'). This is required.
normalizer: ({ data }) => {
const allNodes = data.allStrapiBlogPost.nodes;
const mappedNodes = allNodes.map((node) => ({
...node,
searchable_tags: node.tags.map((t) => t.Name).join(' '),
}));
// eslint-disable-next-line no-debugger
debugger;
return mappedNodes;
},
},
},
{
resolve: 'gatsby-plugin-local-search',
options: {
// A unique name for the search index. This should be descriptive of
// what the index contains. This is required.
name: 'connectors',
// Set the search engine to create the index. This is required.
// The following engines are supported: flexsearch, lunr
engine: 'lunr',
// Provide options to the engine. This is optional and only recommended
// for advanced users.
//
// Note: Only the flexsearch engine supports options.
// engineOptions: "default",
// GraphQL query used to fetch all data for the search index. This is
// required.
query: `
{
postgres {
allConnectors(orderBy: [RECOMMENDED_DESC, CREATED_AT_DESC]) {
nodes {
id
externalUrl
imageName
shortDescription
longDescription
title
logoUrl
recommended
connectorTagsByConnectorIdList {
protocol
}
}
}
}
}
`,
// Field used as the reference value for each document.
// Default: 'id'.
ref: 'id',
// List of keys to index. The values of the keys are taken from the
// normalizer function below.
// Default: all fields
index: ['title', 'shortDescription', 'type'],
// List of keys to store and make available in your UI. The values of
// the keys are taken from the normalizer function below.
// Default: all fields
store: [
'id',
'externalUrl',
'imageName',
'shortDescription',
'longDescription',
'title',
'logoUrl',
'logo',
'recommended',
'type',
'slug',
],
// Function used to map the result from the GraphQL query. This should
// return an array of items to index in the form of flat objects
// containing properties to index. The objects must contain the `ref`
// field above (default: 'id'). This is required.
normalizer: ({ data }) =>
data.postgres.allConnectors.nodes.map(normalizeConnector),
},
},
{
resolve: 'gatsby-plugin-react-svg',
options: {
rule: {
include: /svgs/, // See below to configure properly
},
},
},
{
resolve: 'gatsby-source-pg',
options: {
connectionString: SUPABASE_CONNECTION_STRING,
schema: 'public',
// refetchInterval: 60, // Refetch data every 60 seconds
},
},
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
{
resolve: `gatsby-plugin-canonical-urls`,
options: {
siteUrl: `https://estuary.dev`,
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [`gatsby-remark-reading-time`],
},
},
// {
// resolve: `gatsby-plugin-feed`,
// options: {
// query: `
// {
// site {
// siteMetadata {
// title
// description
// siteUrl
// site_url: siteUrl
// }
// }
// }
// `,
// feeds: [
// {
// serialize: ({ query: { site, allMarkdownRemark } }) => {
// return allMarkdownRemark.nodes.map(node => {
// return Object.assign({}, node.frontmatter, {
// description: node.excerpt,
// date: node.frontmatter.date,
// url: site.siteMetadata.siteUrl + node.fields.slug,
// guid: site.siteMetadata.siteUrl + node.fields.slug,
// custom_elements: [{ "content:encoded": node.html }],
// })
// })
// },
// query: `{
// allMarkdownRemark(sort: {frontmatter: {date: DESC}}) {
// nodes {
// excerpt
// html
// fields {
// slug
// }
// frontmatter {
// title
// date
// }
// }
// }
// }`,
// output: "/rss.xml",
// title: "Gatsby Starter Blog RSS Feed",
// },
// ],
// },
// },
],
};
module.exports = cfg;