forked from iterative/dvc.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
234 lines (225 loc) Β· 5.98 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
/* eslint-env node */
const path = require('path')
require('./config/prismjs/dvc')
require('./config/prismjs/usage')
const apiMiddleware = require('./src/server/middleware/api')
const redirectsMiddleware = require('./src/server/middleware/redirects')
const makeFeedHtml = require('./plugins/utils/makeFeedHtml')
const { BLOG } = require('./src/consts')
const title = 'Data Version Control Β· DVC'
const description =
'Open-source version control system for Data Science and Machine Learning ' +
'projects. Git-like experience to organize your data, models, and ' +
'experiments.'
const keywords = [
'data version control',
'machine learning',
'models management'
]
const plugins = [
{
resolve: `gatsby-plugin-typescript`,
options: {
isTSX: true,
allExtensions: true
}
},
'gatsby-plugin-postcss',
'gatsby-plugin-react-helmet',
'gatsby-plugin-sitemap',
'gatsby-plugin-twitter',
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'content',
path: path.join(__dirname, 'content')
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: path.join(__dirname, 'static', 'uploads')
}
},
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
'gatsby-remark-embedder',
'gatsby-remark-dvc-linker',
{
resolve: 'gatsby-remark-prismjs',
options: {
noInlineHighlight: true
}
},
{
resolve: 'gatsby-remark-smartypants',
options: {
quotes: false
}
},
{
resolve: 'gatsby-remark-embed-gist',
options: {
includeDefaultCss: true
}
},
'gatsby-remark-relative-images',
'gatsby-remark-copy-linked-files',
'gatsby-remark-external-links',
{
resolve: 'gatsby-remark-autolink-headers',
options: {
enableCustomId: true,
isIconAfterHeader: true
}
},
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: BLOG.imageMaxWidth,
withWebp: true
}
},
'gatsby-remark-responsive-iframe',
'resize-image-plugin',
'external-link-plugin'
]
}
},
{
resolve: 'gatsby-plugin-svgr',
options: {
ref: true
}
},
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
'gatsby-plugin-catch-links',
{
resolve: 'gatsby-plugin-manifest',
options: {
/* eslint-disable @typescript-eslint/camelcase */
background_color: '#eff4f8',
display: 'minimal-ui',
icon: 'static/favicon-512x512.png',
name: 'dvc.org',
short_name: 'dvc.org',
start_url: '/',
theme_color: '#eff4f8'
/* eslint-enable @typescript-eslint/camelcase */
}
},
{
resolve: `gatsby-plugin-feed`,
options: {
feeds: [
{
description,
output: '/blog/rss.xml',
query: `
{
allBlogPost(
sort: { fields: [date], order: DESC }
) {
nodes {
htmlAst
slug
title
date
description
}
}
}
`,
serialize: ({ query: { site, allBlogPost } }) => {
return allBlogPost.nodes.map(node => {
const html = makeFeedHtml(node.htmlAst, site.siteMetadata.siteUrl)
return Object.assign(
{},
{
/* eslint-disable-next-line @typescript-eslint/camelcase */
custom_elements: [{ 'content:encoded': html }],
title: node.title,
date: node.date,
description: node.description,
guid: site.siteMetadata.siteUrl + node.slug,
url: site.siteMetadata.siteUrl + node.slug
}
)
})
},
title
}
],
query: `
{
site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}
}
`
}
},
{
resolve: 'gatsby-plugin-sentry',
options: {
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV,
release: process.env.SOURCE_VERSION,
enabled: process.env.NODE_ENV === 'production',
ignoreErrors: [
/* When we deploy new version we delete assets which were generated for
the previous deployed version, but users can have opened old version in
their browsers. If they hover some link on the page Gatsby.js will try
fetch old chunks and will get ChunkLoadError, but then will load static
page from the new deployed version and all will be ok. So we can just
ignore these type of errors */
'ChunkLoadError'
],
/* There are some common urls which recomment to ignore. It's even
mentioned in the official documentation: https://docs.sentry.io/platforms/javascript/#decluttering-sentry
In our case we just ignore all errors from the browser's extensions,
because we can't influence on then somehow. */
blacklistUrls: [/extensions\//i, /^chrome:\/\//i]
}
}
]
if (process.env.CONTEXT === 'production') {
plugins.push({
resolve: 'gatsby-plugin-google-analytics',
options: {
respectDNT: true,
trackingId: process.env.GA_ID
}
})
}
if (process.env.ANALYZE) {
plugins.push({
resolve: 'gatsby-plugin-webpack-bundle-analyzer',
options: {
analyzerPort: 4000,
production: process.env.NODE_ENV === 'production'
}
})
}
module.exports = {
plugins,
siteMetadata: {
description,
keywords,
siteUrl: 'https://dvc.org',
title
},
developMiddleware: app => {
app.use(redirectsMiddleware)
app.use('/api', apiMiddleware)
}
}