forked from microsoft/jacdac-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
201 lines (197 loc) · 7.45 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
const { identifierToUrlPath } = require(`./jacdac-ts/dist/jacdac.cjs`)
const maxImageWidth = 800
const siteUrl = "https://microsoft.github.io"
const pathPrefix = "/jacdac-docs"
const wsl = !!process.env.WSL_DISTRO_NAME || !!process.env.CODESPACE_NAME
const offline = !!process.env.JACDAC_OFFLINE
const SITE_TITLE = `Jacdac - Connect and code electronics. Instantly.`
const SITE_DESCRIPTION = `Jacdac is a plug-and-play hardware and software stack for microcontrollers and their peripherals such as sensors and actuators. Jacdac is primarily designed for “modular electronics” scenarios that support rapid prototyping, creative exploration, making and learning through physical computing. Jacdac is designed to be cheap, flexible and extensible.`
module.exports = {
trailingSlash: "always",
siteMetadata: {
title: SITE_TITLE,
description: SITE_DESCRIPTION,
author: `Microsoft`,
siteUrl: siteUrl,
},
pathPrefix: pathPrefix,
flags: {
PRESERVE_FILE_DOWNLOAD_CACHE: true,
DEV_WEBPACK_CACHE: true,
FAST_DEV: true,
},
plugins: [
`gatsby-transformer-json`,
`gatsby-transformer-csv`,
`gatsby-transformer-plaintext`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/jacdac-ts/jacdac-spec/devices`,
ignore: [`**/*.json`],
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `pages`,
path: `${__dirname}/src/pages`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `services`,
path: `${__dirname}/jacdac-ts/jacdac-spec/dist/services.json`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `serviceSources`,
path: `${__dirname}/jacdac-ts/jacdac-spec/dist/services-sources.json`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `devices`,
path: `${__dirname}/jacdac-ts/jacdac-spec/dist/devices.json`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `akalinks`,
path: `${__dirname}/jacdac-ts/jacdac-spec/devices/microsoft-research/qr-url-device-map.csv`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `traces`,
path: `${__dirname}/jacdac-ts/jacdac-spec/traces`,
},
},
`gatsby-transformer-javascript-frontmatter`,
`gatsby-theme-material-ui`,
`gatsby-plugin-image`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.mdx`, `.md`],
mdxOptions: {
remarkPlugins: [require(`remark-gfm`)],
},
gatsbyRemarkPlugins: [
wsl || offline
? undefined
: {
resolve: "gatsby-remark-makecode",
options: {
editorUrl: "https://makecode.microbit.org/",
},
},
"gatsby-remark-autolink-headers",
"gatsby-remark-external-links",
{
resolve: `gatsby-remark-images`,
options: {
// It's important to specify the maxWidth (in pixels) of
// the content container as this plugin uses this as the
// base for generating different widths of each image.
maxWidth: maxImageWidth,
linkImagesToOriginal: false,
},
},
"gatsby-remark-static-images",
"gatsby-remark-copy-linked-files",
].filter(plugin => !!plugin),
},
},
{
resolve: `@gatsby-contrib/gatsby-plugin-elasticlunr-search`,
options: {
fields: [`title`, `description`, `body`, `tags`],
resolvers: {
Mdx: {
title: node => node.frontmatter.title,
description: node =>
node.frontmatter.description || node.excerpt,
body: node => node.rawBody || node.body,
tags: node => node.frontmatter.tags || "",
url: node => node.frontmatter.path || node.fields.slug,
},
JavascriptFrontmatter: {
title: node => node.frontmatter?.title,
description: node => node.frontmatter?.description,
tags: node => node.frontmatter?.tags || "",
url: node =>
node.frontmatter?.path ||
node.fields?.slug ||
node.node?.relativePath,
},
ServicesJson: {
title: node => node.name,
description: node => node.notes["short"],
body: node => node.source,
tags: node => node.tags,
url: node => `/services/${node.shortId}/`,
},
DevicesJson: {
title: node => node.name,
description: node => node.description,
body: node => node.company,
tags: node => node.tags,
url: node =>
`/devices/${identifierToUrlPath(node.jsonId)}/`,
},
}, // filter: (node, getNode) => node.frontmatter.tags !== "exempt",
},
},
"gatsby-plugin-sitemap",
{
resolve: `gatsby-plugin-manifest`,
options: {
name: SITE_TITLE,
short_name: `Jacdac`,
description: SITE_DESCRIPTION,
start_url: `/`,
background_color: `#ffc400`,
theme_color: `#ffc400`,
display: `standalone`,
cache_busting_mode: "none",
icon: `src/images/favicon.svg`,
crossOrigin: `use-credentials`,
},
},
{
resolve: `gatsby-plugin-offline`,
options: {
precachePages: [
`/*`,
`/reference/**`,
`/services/**`,
`/devices/**`,
`/tools/**`,
],
},
},
"gatsby-plugin-robots-txt",
"gatsby-plugin-meta-redirect",
"gatsby-plugin-webpack-bundle-analyser-v2",
{
resolve: `gatsby-plugin-catch-links`,
},
],
}