-
Notifications
You must be signed in to change notification settings - Fork 4
/
add-contentful-blog.js
55 lines (48 loc) · 1.32 KB
/
add-contentful-blog.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
module.exports = targets => {
const builtins = targets.of('@magento/pwa-buildpack');
builtins.envVarDefinitions.tap(defs => {
defs.sections.push({
name: 'Contentful',
variables: [
{
name: 'CONTENTFUL_GRAPHQL_ENDPOINT',
type: 'str',
desc: 'Specify the GraphQL endpoint for Contentful',
default: ''
}
]
});
});
builtins.specialFeatures.tap(features => {
features[targets.name] = {
esModules: true,
cssModules: true
};
});
const venia = targets.of('@magento/venia-ui');
venia.navItems.tap(navItems => [
...navItems,
{
name: 'Blog',
to: '/blog'
}
]);
venia.routes.tap(routes => [
...routes,
{
name: 'Blog',
pattern: '/blog',
path: targets.name + '/lib/pages/blog.js',
exact: true
},
{
name: 'BlogPost',
pattern: '/blog/:slug',
path: targets.name + '/lib/pages/blog-post.js'
}
]);
venia.apolloLinks.tap(linkWrappers =>
linkWrappers.concat(targets.name + '/lib/add-contentful-endpoint.js')
);
return targets;
};