-
Notifications
You must be signed in to change notification settings - Fork 0
/
sourcebit.js
40 lines (37 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
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 || 'twn53eci',
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', 'advanced') },
{ path: '/{stackbit_url_path}', predicate: _.matchesProperty('__metadata.modelName', 'blog') },
{ 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 => ["advanced","blog","page","post"].includes(_.get(item, '__metadata.modelName'))),
data: {
config: _.find(items, _.matchesProperty('__metadata.modelName', 'config'))
}
};
}
}
}
]
};