forked from xbmc/kodi-tv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
191 lines (189 loc) · 5.41 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
const path = require("path");
const { node } = require("prop-types");
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
});
const config = require("./gatsby-site-config");
// this is an incredibly hacky way to get around a Gatsby bug
// if you load the Netlify CMS in development, you get a bunch of
// Static Query won't load errors when trying to view the site
// but everything works fine at build
// so this creates a one item list with the Netlify CMS plugin only
// if running in non-development mode and concats it to the plugins list
let netlifyCms = [];
if (process.env.NODE_ENV != "development") {
netlifyCms.push({
resolve: "gatsby-plugin-netlify-cms",
options: { modulePath: `${__dirname}/src/cms/netlify.tsx`, manualInit: true },
});
}
module.exports = {
siteMetadata: config.siteMetadata,
flags: { PRESERVE_WEBPACK_CACHE: true, FAST_DEV: true, DEV_SSR: true },
plugins: [
{
resolve: `gatsby-plugin-root-import`,
options: {
src: path.join(__dirname, "src"),
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: "pages",
path: `src/pages/`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: "images",
path: `src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: "blog",
path: `src/content/article`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: "pagesrc",
path: `src/content/pages`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: "yaml-pages",
path: `src/data/yaml`,
},
},
{
resolve: "gatsby-plugin-feed",
options: {
query: `
{
site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}
}
`,
feeds: [
{
serialize: ({ query: { site, blogPosts } }) => {
let featuredImageHtml = "";
let fi = {};
return blogPosts.nodes.map(post => {
fi = post.frontmatter.featured_image;
if (fi != undefined) {
imgSrc = site.siteMetadata.siteUrl + fi.src;
featuredImageHtml = `
<figure>
<img title="${fi.title}" alt="${fi.alt}" src="${imgSrc}" />
</figure>
`;
} else {
featuredImageHtml = "";
}
return Object.assign({}, post.frontmatter, {
title: post.frontmatter.title,
description: post.excerpt,
date: post.frontmatter.date,
author: post.frontmatter.author,
categories: post.frontmatter.tags,
url: site.siteMetadata.siteUrl + post.fields.slug,
guid: site.siteMetadata.siteUrl + post.fields.slug,
custom_elements: [
{ "content:encoded": featuredImageHtml + post.html },
],
});
});
},
query: `
{
blogPosts: allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
filter: {fields: {collection: {eq: "blog"}}}
limit: 20
) {
nodes {
excerpt
html
fields { slug }
frontmatter {
title
date
author
tags
featured_image {
src
title
alt
}
}
}
}
}
`,
title: "Kodi News",
output: "/rss.xml",
},
],
},
},
`gatsby-plugin-postcss`,
`gatsby-plugin-react-helmet`,
`gatsby-plugin-sass`,
`gatsby-plugin-typescript`,
`gatsby-plugin-image`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`, // Needed for dynamic images
`gatsby-transformer-remark`,
`gatsby-transformer-yaml`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: "gatsby-kodi-tv",
short_name: "Kodi website",
start_url: "/",
background_color: "#663399",
theme_color: "#663399",
display: "minimal-ui",
icon: "static/images/kodi-logo.svg",
},
},
{
resolve: `gatsby-source-kodidonorwall`,
options: {
typeName: "Donor",
accessKeyId: process.env.AWS_ID,
secretAccessKey: process.env.AWS_KEY,
region: "us-east-1",
params: {
TableName: process.env.AWS_DBNAME,
IndexName: "all",
Limit: 30,
ProjectionExpression: "id,createdAt,amount,currency,provider,publicName",
ScanIndexForward: false,
KeyConditionExpression: "dummy=:dummyval",
ExpressionAttributeValues: { ":dummyval": "1" },
},
},
},
{
resolve: `gatsby-source-kodiaddon`,
options: {
kodiversions: ["leia", "matrix"],
},
},
].concat(netlifyCms),
};