forked from iterative/dvc.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
246 lines (236 loc) Β· 6.3 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
/* eslint-env node */
require('dotenv').config()
const path = require('path')
const makeFeedHtml = require('@dvcorg/gatsby-theme-iterative/plugins/utils/makeFeedHtml')
const apiMiddleware = require('./src/server/middleware/api')
const redirectsMiddleware = require('./src/server/middleware/redirects')
const autoprefixer = require('autoprefixer')
const customMedia = require('postcss-custom-media')
const customProperties = require('postcss-custom-properties')
const mixins = require('postcss-mixins')
const colorMod = require('postcss-color-mod-function')
const mixinsConfig = require('@dvcorg/gatsby-theme-iterative/config/postcss/mixins')
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 = [
'gatsby-plugin-twitter',
{
resolve: '@dvcorg/gatsby-theme-iterative',
options: {
remark: false,
simpleLinkerTerms: require('./content/linked-terms'),
cssBase: require.resolve(
'./src/@dvcorg/gatsby-theme-iterative/components/Page/base.css'
),
postCssPlugins: [
require('postcss-nested'),
customMedia({
importFrom: './src/styles/media.css'
}),
mixins(mixinsConfig),
customProperties({
importFrom: [
'./src/@dvcorg/gatsby-theme-iterative/components/Page/base.css'
],
disableDeprecationNotice: true
}),
colorMod({
importFrom: [
'./src/@dvcorg/gatsby-theme-iterative/components/Page/base.css'
]
}),
autoprefixer
]
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: path.join(__dirname, 'static', 'img')
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: path.join(__dirname, 'static', 'uploads', 'images')
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'avatars',
path: path.join(__dirname, 'static', 'uploads', 'avatars')
}
},
'community-page',
{
resolve: 'gatsby-plugin-catch-links'
},
{
resolve: `gatsby-plugin-algolia`,
options: {
appId: process.env.GATSBY_ALGOLIA_APP_ID || 'B87HVF62EF',
apiKey: process.env.ALGOLIA_ADMIN_KEY,
skipIndexing:
process.env.CI && process.env.ALGOLIA_ADMIN_KEY ? false : true,
queries: require('./src/utils/algolia-queries.js'),
enablePartialUpdates:
process.env.ALGOLIA_FULL_UPDATE === true ? false : true,
matchFields: ['slug', 'modified']
}
},
{
resolve: 'gatsby-plugin-manifest',
options: {
/* eslint-disable @typescript-eslint/naming-convention */
background_color: '#eff4f8',
display: 'minimal-ui',
icon: 'static/favicon-512x512.png',
name: 'dvc.org',
short_name: 'dvc.org',
start_url: '/',
theme_color: '#eff4f8',
icons: [
{
src: '/apple-touch-icon-48x48.png',
sizes: '48x48',
type: 'image/png'
},
{
src: '/apple-touch-icon-72x72.png',
sizes: '72x72',
type: 'image/png'
},
{
src: '/apple-touch-icon-96x96.png',
sizes: '96x96',
type: 'image/png'
},
{
src: '/apple-touch-icon-144x144.png',
sizes: '144x144',
type: 'image/png'
},
{
src: '/apple-touch-icon.png',
sizes: '180x180',
type: 'image/png'
},
{
src: '/apple-touch-icon-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: '/apple-touch-icon-256x256.png',
sizes: '256x256',
type: 'image/png'
},
{
src: '/apple-touch-icon-384x384.png',
sizes: '384x384',
type: 'image/png'
},
{
src: '/apple-touch-icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
/* eslint-enable @typescript-eslint/naming-convention */
}
},
{
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 Promise.all(
allBlogPost.nodes.map(async node => {
const html = await makeFeedHtml(
node.htmlAst,
site.siteMetadata.siteUrl
)
return Object.assign(
{},
{
/* eslint-disable-next-line @typescript-eslint/naming-convention */
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
}
}
}
`
}
}
]
if (process.env.ANALYZE) {
plugins.push({
resolve: 'gatsby-plugin-webpack-bundle-analyser-v2'
})
}
module.exports = {
trailingSlash: 'never',
plugins,
siteMetadata: {
description,
author: 'Iterative',
keywords,
siteUrl: process.env.HEROKU_APP_NAME
? `https://${process.env.HEROKU_APP_NAME}.herokuapp.com/`
: 'https://dvc.org',
title
},
developMiddleware: app => {
app.use(redirectsMiddleware)
app.use('/api', apiMiddleware)
}
}