|
3 | 3 | import * as nextJson from './next.json.mjs'; |
4 | 4 | import * as nextLocales from './next.locales.mjs'; |
5 | 5 |
|
| 6 | +/** |
| 7 | + * This is used for telling Next.js if the Website is deployed on Vercel |
| 8 | + * |
| 9 | + * Can be used for conditionally enabling features that we know are Vercel only |
| 10 | + * |
| 11 | + * @see https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables#framework-environment-variables |
| 12 | + */ |
| 13 | +export const VERCEL_ENV = process.env.NEXT_PUBLIC_VERCEL_ENV || undefined; |
| 14 | + |
6 | 15 | /** |
7 | 16 | * This is used for telling Next.js to to a Static Export Build of the Website |
8 | 17 | * |
9 | 18 | * This is used for static/without a Node.js server hosting, such as on our |
10 | 19 | * legacy Website Build Environment on Node.js's DigitalOcean Droplet. |
| 20 | + * |
| 21 | + * Note that this is a manual Environment Variable defined by us during `npm run deploy` |
11 | 22 | */ |
12 | 23 | export const ENABLE_STATIC_EXPORT = |
13 | 24 | process.env.NEXT_STATIC_EXPORT === 'true' || |
14 | 25 | process.env.NEXT_STATIC_EXPORT === true; |
15 | 26 |
|
| 27 | +/** |
| 28 | + * 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. |
| 29 | + * |
| 30 | + * This variable can either come from the Vercel Deployment as `NEXT_PUBLIC_VERCEL_URL` or from the `NEXT_BASE_URL` environment variable that is manually defined |
| 31 | + * by us if necessary. Otherwise it will fallback to the default Node.js Website URL. |
| 32 | + * |
| 33 | + * @see https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables#framework-environment-variables |
| 34 | + */ |
| 35 | +export const BASE_URL = process.env.NEXT_PUBLIC_VERCEL_URL |
| 36 | + ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` |
| 37 | + : process.env.NEXT_BASE_URL || 'https://nodejs.org'; |
| 38 | + |
16 | 39 | /** |
17 | 40 | * Supports a manual override of the base path of the Website |
18 | 41 | * |
19 | 42 | * This is useful when running the deployment on a subdirectory |
20 | 43 | * of a domain, such as when hosted on GitHub Pages. |
| 44 | + * |
| 45 | + * Note that this is a manual Environment Variable defined by us if necessary. |
21 | 46 | */ |
22 | | -export const BASE_PATH = String(process.env.NEXT_BASE_PATH || ''); |
| 47 | +export const BASE_PATH = process.env.NEXT_BASE_PATH || ''; |
23 | 48 |
|
24 | 49 | /** |
25 | 50 | * This ReGeX is used to remove the `index.md(x)` suffix of a name and to remove |
|
0 commit comments