-
Notifications
You must be signed in to change notification settings - Fork 4
/
sourcebit.js
58 lines (56 loc) · 1.58 KB
/
sourcebit.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
const _ = require("lodash");
const isDev = process.env.NODE_ENV === "development";
module.exports = {
plugins: [
{
module: require("sourcebit-source-sanity"),
options: {
accessToken: process.env.SANITY_ACCESS_TOKEN,
projectId: process.env.SANITY_PROJECT_ID || "ykw3edr8",
dataset: process.env.SANITY_DATASET || "production",
isPreview: isDev,
watch: isDev,
},
},
{
module: require("sourcebit-target-next"),
options: {
liveUpdate: isDev,
flattenAssetUrls: true,
pages: [
{
path: "/{stackbit_url_path}",
predicate: _.matchesProperty("__metadata.modelName", "home"),
},
{
path: "/{stackbit_url_path}",
predicate: _.matchesProperty("__metadata.modelName", "contact"),
},
{
path: "/{stackbit_url_path}",
predicate: _.matchesProperty("__metadata.modelName", "page"),
},
{
path: "/{stackbit_url_path}",
predicate: _.matchesProperty("__metadata.modelName", "post"),
},
],
commonProps: (items) => {
return {
pages: _.filter(items, (item) =>
["home", "contact", "page", "post"].includes(
_.get(item, "__metadata.modelName")
)
),
data: {
config: _.find(
items,
_.matchesProperty("__metadata.modelName", "config")
),
},
};
},
},
},
],
};