File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -221,21 +221,10 @@ async function readFunctionSkipFile(cacheDir: string) {
221
221
222
222
// eslint-disable-next-line complexity
223
223
function overrideNeededFunctions ( neededFunctions ) {
224
- const skipAll =
225
- process . env . NETLIFY_SKIP_GATSBY_FUNCTIONS === 'true' ||
226
- process . env . NETLIFY_SKIP_GATSBY_FUNCTIONS === '1'
227
-
228
- const skipAPI =
229
- process . env . NETLIFY_SKIP_API_FUNCTION === 'true' ||
230
- process . env . NETLIFY_SKIP_API_FUNCTION === '1'
231
-
232
- const skipSSR =
233
- process . env . NETLIFY_SKIP_SSR_FUNCTION === 'true' ||
234
- process . env . NETLIFY_SKIP_SSR_FUNCTION === '1'
235
-
236
- const skipDSG =
237
- process . env . NETLIFY_SKIP_DSG_FUNCTION === 'true' ||
238
- process . env . NETLIFY_SKIP_DSG_FUNCTION === '1'
224
+ const skipAll = isEnvSet ( 'NETLIFY_SKIP_GATSBY_FUNCTIONS' )
225
+ const skipAPI = isEnvSet ( 'NETLIFY_SKIP_API_FUNCTION' )
226
+ const skipSSR = isEnvSet ( 'NETLIFY_SKIP_SSR_FUNCTION' )
227
+ const skipDSG = isEnvSet ( 'NETLIFY_SKIP_DSG_FUNCTION' )
239
228
240
229
return {
241
230
API : skipAll || skipAPI ? false : neededFunctions . API ,
@@ -244,6 +233,10 @@ function overrideNeededFunctions(neededFunctions) {
244
233
}
245
234
}
246
235
236
+ function isEnvSet ( envVar : string ) {
237
+ return process . env [ envVar ] === 'true' || process . env [ envVar ] === '1'
238
+ }
239
+
247
240
export function getGatsbyRoot ( publish : string ) : string {
248
241
return path . resolve ( path . dirname ( publish ) )
249
242
}
You can’t perform that action at this time.
0 commit comments