-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathnext.constants.mjs
More file actions
228 lines (200 loc) · 7.3 KB
/
next.constants.mjs
File metadata and controls
228 lines (200 loc) · 7.3 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
'use strict';
/**
* This is used to verify if the current Website is running on a Development Environment
*/
export const IS_DEV_ENV = process.env.NODE_ENV === 'development';
/**
* This is used for telling Next.js if the Website is deployed on Vercel
*
* Can be used for conditionally enabling features that we know are Vercel only
*
* @see https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL_ENV
*/
export const VERCEL_ENV = process.env.VERCEL_ENV || undefined;
/**
* This is used for telling Next.js to do a Static Export Build of the Website
*
* This is used for static/without a Node.js server hosting, such as on our
* legacy Website Build Environment on Node.js's DigitalOcean Droplet.
*
* Note that this is a manual Environment Variable defined by us during `npm run deploy`
*/
export const ENABLE_STATIC_EXPORT =
process.env.NEXT_PUBLIC_STATIC_EXPORT === 'true' ||
process.env.NEXT_PUBLIC_STATIC_EXPORT === true;
/**
* This is used to ensure that pages are Static Export for all locales or only
* in the default (`en`) locale.
*
* Note that this is a manual Environment Variable defined by us during the
* build process in CI.
*/
export const ENABLE_STATIC_EXPORT_LOCALE =
process.env.NEXT_PUBLIC_STATIC_EXPORT_LOCALE === 'true' ||
process.env.NEXT_PUBLIC_STATIC_EXPORT_LOCALE === true;
/**
* This is used for any place that requires the full canonical URL path for the Node.js Website (and its deployment), such as for example, the Node.js RSS Feed.
*
* This variable can either come from the Vercel Deployment as `NEXT_PUBLIC_VERCEL_URL` or from the `NEXT_PUBLIC_BASE_URL` Environment Variable that is manually defined
* by us if necessary. Otherwise it will fallback to the default Node.js Website URL.
*
* @TODO: We should get rid of needing to rely on `VERCEL_URL` for deployment URL.
*
* @see https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables#framework-environment-variables
*/
export const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL
? process.env.NEXT_PUBLIC_BASE_URL
: process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: 'https://nodejs.org';
/**
* This is used for any place that requires the Node.js distribution URL (which by default is nodejs.org/dist)
*
* Note that this is a custom Environment Variable that can be defined by us when necessary
*/
export const DIST_URL =
process.env.NEXT_PUBLIC_DIST_URL || 'https://nodejs.org/dist/';
/**
* This is used for any place that requires the Node.js API Docs URL (which by default is nodejs.org/docs)
*
* Note that this is a custom Environment Variable that can be defined by us when necessary
*/
export const DOCS_URL =
process.env.NEXT_PUBLIC_DOCS_URL || 'https://nodejs.org/docs/';
/**
* Supports a manual override of the base path of the Website
*
* This is useful when running the deployment on a subdirectory
* of a domain, such as when hosted on GitHub Pages.
*
* Note that this is a custom Environment Variable that can be defined by us when necessary
*/
export const BASE_PATH = process.env.NEXT_PUBLIC_BASE_PATH || '';
/**
* This is the default type of blog post type that we use for OG Meta Tags
*/
export const DEFAULT_CATEGORY_OG_TYPE = 'announcement';
/**
* This is the base url for changelog entries
*/
export const BASE_CHANGELOG_URL =
'https://github.com/nodejs/node/releases/tag/v';
/**
* This defines how many blog posts each pagination page should have
*/
export const BLOG_POSTS_PER_PAGE = 6;
/**
* The `localStorage` key to store the theme choice of `next-themes`
*
* This is what allows us to store user preference for theming
*/
export const THEME_STORAGE_KEY = 'theme';
/**
* This is a list of all external links that are used on website sitemap.
* @see https://github.com/nodejs/nodejs.org/issues/5813 for more context
*/
export const EXTERNAL_LINKS_SITEMAP = [
'https://ai-coding-assistants-policy.openjsf.org/',
'https://terms-of-use.openjsf.org/',
'https://privacy-policy.openjsf.org/',
'https://bylaws.openjsf.org/',
'https://code-of-conduct.openjsf.org/',
'https://trademark-policy.openjsf.org/',
'https://trademark-list.openjsf.org/',
'https://www.linuxfoundation.org/cookies',
];
/**
* These are the default Orama Query Parameters that are used by the Website
* @see https://docs.oramasearch.com/open-source/usage/search/introduction
*/
export const DEFAULT_ORAMA_QUERY_PARAMS = {
limit: 25,
threshold: 0,
boost: {
pageSectionTitle: 4,
pageSectionContent: 2.5,
pageTitle: 1.5,
},
};
/**
* The initial Orama Cloud chat suggestions visible in the empty state of the search box.
*/
export const DEFAULT_ORAMA_SUGGESTIONS = [
'How to install Node.js?',
'How to create an HTTP server?',
'Upgrading Node.js version',
];
/**
* The default batch size to use when syncing Orama Cloud
*/
export const ORAMA_SYNC_BATCH_SIZE = 250;
/**
* The default Orama Cloud endpoint to use when searching with Orama Cloud.
*/
export const ORAMA_CLOUD_ENDPOINT =
process.env.NEXT_PUBLIC_ORAMA_ENDPOINT ||
'https://cloud.orama.run/v1/indexes/nodejs-org-dev-hhqrzv';
/**
* The default Orama Cloud API Key to use when searching with Orama Cloud.
* This is a public API key and can be shared publicly on the frontend.
*/
export const ORAMA_CLOUD_READ_API_KEY =
process.env.NEXT_PUBLIC_NEW_ORAMA_API_KEY ||
'c1__KPYDQNEFr$nFgrTgFTVLHf8BuNf08COBqBUzk65AYJEmSsJONPsO$_cihl';
/**
* The default Orama Cloud Datasource ID to use when searching with Orama Cloud.
*/
export const ORAMA_CLOUD_DATASOURCE_ID =
process.env.NEXT_PUBLIC_NEW_ORAMA_DATASOURCE_ID ||
'6044121f-53c3-46af-aaf0-f498e3c548f2';
/**
* The default Orama Cloud Project ID to use when initializing Orama Cloud.
*/
export const ORAMA_CLOUD_PROJECT_ID =
process.env.NEXT_PUBLIC_NEW_ORAMA_PROJECT_ID ||
'2eac5680-790b-44b7-8640-359608f104bd';
/**
* A GitHub Access Token for accessing the GitHub API and not being rate-limited
* The current token is registered on the "nodejs-vercel" GitHub Account.
*
* Note: This has no NEXT_PUBLIC prefix as it should not be exposed to the Browser.
*/
export const GITHUB_API_KEY = process.env.NEXT_GITHUB_API_KEY || '';
/**
* The resource we point people to when discussing internationalization efforts.
*/
export const TRANSLATION_URL =
'https://github.com/nodejs/nodejs.org/blob/main/docs/translation.md#how-to-translate';
/**
* Define the order in which vulnerabilities should be sorted
*/
export const SEVERITY_ORDER = ['critical', 'high', 'medium', 'low'];
/**
* Maps vulnerability severity levels to UI Badge kinds
*/
export const SEVERITY_KIND_MAP = {
unknown: 'neutral',
low: 'default',
medium: 'info',
high: 'warning',
critical: 'error',
};
/**
* Which Node.js versions do we want to display vulnerabilities for?
*/
export const EOL_VERSION_IDENTIFIER = 'End-of-life';
/**
* The location of the Node.js Security Working Group Vulnerabilities data.
*/
export const VULNERABILITIES_URL =
'https://raw.githubusercontent.com/nodejs/security-wg/main/vuln/core/index.json';
/**
* The location of the OpenCollective data
*/
export const OPENCOLLECTIVE_MEMBERS_URL =
'https://opencollective.com/nodejs/members/all.json';
/**
* The location of the Node.js release schedule JSON.
*/
export const RELEASE_SCHEDULE_URL =
'https://raw.githubusercontent.com/nodejs/Release/refs/heads/main/schedule.json';