1
- require ( "dotenv" ) . config ( ) ;
2
- const queries = require ( "./src/utils/algolia" ) ;
3
- const config = require ( "./config" ) ;
1
+ require ( 'dotenv' ) . config ( {
2
+ path : `.env.${ process . env . NODE_ENV } ` ,
3
+ } ) ;
4
+ // keep dotenv at the top of this file
5
+
6
+ const queries = require ( './src/utils/algolia' ) ;
7
+
8
+ const config = require ( './config' ) ;
9
+
10
+ const sharp = require ( 'sharp' ) ;
11
+
12
+ // disable sharp cacheing to stop segmentation faults on netlify
13
+ sharp . cache ( false ) ;
14
+ sharp . simd ( false ) ;
15
+
16
+ const GATSBY_SHOW_DOCS = process . env . GATSBY_SHOW_DOCS ;
17
+
18
+ const GATSBY_SETTINGS_FILE = process . env . GATSBY_SETTINGS_FILE ;
19
+
20
+ const GATSBY_ENV = process . env . GATSBY_ENV ;
21
+
22
+ console . log ( { GATSBY_ENV , GATSBY_SETTINGS_FILE , GATSBY_SHOW_DOCS } ) ;
23
+
4
24
const plugins = [
5
25
'gatsby-plugin-sitemap' ,
6
26
'gatsby-plugin-sharp' ,
7
27
{
8
28
resolve : `gatsby-plugin-layout` ,
9
29
options : {
10
- component : require . resolve ( `./src/templates/docs.js` )
11
- }
30
+ component : require . resolve ( `./src/templates/docs.js` ) ,
31
+ } ,
12
32
} ,
13
33
'gatsby-plugin-emotion' ,
14
34
'gatsby-plugin-react-helmet' ,
15
35
{
16
- resolve : " gatsby-source-filesystem" ,
36
+ resolve : ' gatsby-source-filesystem' ,
17
37
options : {
18
- name : " docs" ,
19
- path : `${ __dirname } /content/`
20
- }
38
+ name : ' docs' ,
39
+ path : `${ __dirname } /content/` ,
40
+ } ,
21
41
} ,
22
42
{
23
43
resolve : 'gatsby-plugin-mdx' ,
24
44
options : {
25
45
gatsbyRemarkPlugins : [
26
46
{
27
- resolve : " gatsby-remark-images" ,
47
+ resolve : ' gatsby-remark-images' ,
28
48
options : {
29
49
maxWidth : 1035 ,
30
- sizeByPixelDensity : true
31
- }
50
+ sizeByPixelDensity : true ,
51
+ } ,
32
52
} ,
33
53
{
34
- resolve : 'gatsby-remark-copy-linked-files'
35
- }
54
+ resolve : 'gatsby-remark-copy-linked-files' ,
55
+ } ,
36
56
] ,
37
- extensions : [ " .mdx" , " .md" ]
38
- }
57
+ extensions : [ ' .mdx' , ' .md' ] ,
58
+ } ,
39
59
} ,
40
60
{
41
61
resolve : `gatsby-plugin-gtag` ,
@@ -50,22 +70,27 @@ const plugins = [
50
70
} ,
51
71
] ;
52
72
// check and add algolia
53
- if ( config . header . search && config . header . search . enabled && config . header . search . algoliaAppId && config . header . search . algoliaAdminKey ) {
73
+ if (
74
+ config . header . search &&
75
+ config . header . search . enabled &&
76
+ config . header . search . algoliaAppId &&
77
+ config . header . search . algoliaAdminKey
78
+ ) {
54
79
plugins . push ( {
55
80
resolve : `gatsby-plugin-algolia` ,
56
81
options : {
57
82
appId : config . header . search . algoliaAppId , // algolia application id
58
83
apiKey : config . header . search . algoliaAdminKey , // algolia admin key to index
59
84
queries,
60
85
chunkSize : 10000 , // default: 1000
61
- } }
62
- )
86
+ } ,
87
+ } ) ;
63
88
}
64
89
// check and add pwa functionality
65
90
if ( config . pwa && config . pwa . enabled && config . pwa . manifest ) {
66
91
plugins . push ( {
67
- resolve : `gatsby-plugin-manifest` ,
68
- options : { ...config . pwa . manifest } ,
92
+ resolve : `gatsby-plugin-manifest` ,
93
+ options : { ...config . pwa . manifest } ,
69
94
} ) ;
70
95
plugins . push ( {
71
96
resolve : 'gatsby-plugin-offline' ,
@@ -90,13 +115,16 @@ module.exports = {
90
115
docsLocation : config . siteMetadata . docsLocation ,
91
116
ogImage : config . siteMetadata . ogImage ,
92
117
favicon : config . siteMetadata . favicon ,
93
- logo : { link : config . header . logoLink ? config . header . logoLink : '/' , image : config . header . logo } , // backwards compatible
118
+ logo : {
119
+ link : config . header . logoLink ? config . header . logoLink : '/' ,
120
+ image : config . header . logo ,
121
+ } , // backwards compatible
94
122
headerTitle : config . header . title ,
95
123
githubUrl : config . header . githubUrl ,
96
124
helpUrl : config . header . helpUrl ,
97
125
tweetText : config . header . tweetText ,
98
126
headerLinks : config . header . links ,
99
127
siteUrl : config . gatsby . siteUrl ,
100
128
} ,
101
- plugins : plugins
129
+ plugins : plugins ,
102
130
} ;
0 commit comments