Skip to content

Commit c7f0f38

Browse files
committed
chore(const): add IS_NOT_VERCEL_RUNTIME_ENV
1 parent 2f9f1b2 commit c7f0f38

4 files changed

Lines changed: 6 additions & 21 deletions

File tree

apps/site/next-data/blogData.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
import {
22
ENABLE_STATIC_EXPORT,
3-
IS_DEV_ENV,
43
NEXT_DATA_URL,
5-
VERCEL_ENV,
6-
VERCEL_REGION,
4+
IS_NOT_VERCEL_RUNTIME_ENV,
75
} from '@/next.constants.mjs';
86
import type { BlogCategory, BlogPostsRSC } from '@/types';
97

108
const getBlogData = (
119
cat: BlogCategory,
1210
page?: number
1311
): Promise<BlogPostsRSC> => {
14-
const IS_NOT_VERCEL_RUNTIME_ENV =
15-
(!IS_DEV_ENV && VERCEL_ENV && !VERCEL_REGION) ||
16-
(!IS_DEV_ENV && !VERCEL_ENV);
17-
1812
// When we're using Static Exports the Next.js Server is not running (during build-time)
1913
// hence the self-ingestion APIs will not be available. In this case we want to load
2014
// the data directly within the current thread, which will anyways be loaded only once

apps/site/next-data/downloadSnippets.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import {
22
ENABLE_STATIC_EXPORT,
3-
IS_DEV_ENV,
43
NEXT_DATA_URL,
5-
VERCEL_ENV,
6-
VERCEL_REGION,
4+
IS_NOT_VERCEL_RUNTIME_ENV,
75
} from '@/next.constants.mjs';
86
import { availableLocaleCodes } from '@/next.locales.mjs';
97
import type { DownloadSnippet } from '@/types';
@@ -17,10 +15,6 @@ export default async function getDownloadSnippets(
1715
return [];
1816
}
1917

20-
const IS_NOT_VERCEL_RUNTIME_ENV =
21-
(!IS_DEV_ENV && VERCEL_ENV && !VERCEL_REGION) ||
22-
(!IS_DEV_ENV && !VERCEL_ENV);
23-
2418
// When we're using Static Exports the Next.js Server is not running (during build-time)
2519
// hence the self-ingestion APIs will not be available. In this case we want to load
2620
// the data directly within the current thread, which will anyways be loaded only once

apps/site/next-data/releaseData.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
import {
22
ENABLE_STATIC_EXPORT,
3-
IS_DEV_ENV,
43
NEXT_DATA_URL,
5-
VERCEL_ENV,
6-
VERCEL_REGION,
4+
IS_NOT_VERCEL_RUNTIME_ENV,
75
} from '@/next.constants.mjs';
86
import type { NodeRelease } from '@/types';
97

108
const getReleaseData = (): Promise<Array<NodeRelease>> => {
11-
const IS_NOT_VERCEL_RUNTIME_ENV =
12-
(!IS_DEV_ENV && VERCEL_ENV && !VERCEL_REGION) ||
13-
(!IS_DEV_ENV && !VERCEL_ENV);
14-
159
// When we're using Static Exports the Next.js Server is not running (during build-time)
1610
// hence the self-ingestion APIs will not be available. In this case we want to load
1711
// the data directly within the current thread, which will anyways be loaded only once

apps/site/next.constants.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export const VERCEL_ENV = process.env.VERCEL_ENV || undefined;
2323
*/
2424
export const VERCEL_REGION = process.env.VERCEL_REGION || undefined;
2525

26+
export const IS_NOT_VERCEL_RUNTIME_ENV =
27+
(!IS_DEV_ENV && VERCEL_ENV && !VERCEL_REGION) || (!IS_DEV_ENV && !VERCEL_ENV);
28+
2629
/**
2730
* This is used for telling Next.js to do a Static Export Build of the Website
2831
*

0 commit comments

Comments
 (0)