|
1 | 1 | module.exports = {
|
2 | 2 | onPreBuild: ({inputs, utils}) => {
|
3 |
| - try { |
4 |
| - console.group("Starting the \"uefn\" plugin process"); |
5 |
| - const prefix = inputs.prefix || process.env.NETLIFY_PLUGIN_USE_ENV_IN_RUNTIME_PREFIX; |
6 |
| - |
7 |
| - // Stop the process if there is no prefix input without breaking the build |
8 |
| - if (!prefix) { |
9 |
| - return console.warn("No \"prefix\" input defined. Skip the process."); |
10 |
| - } |
11 |
| - |
12 |
| - console.info(`Defined prefix: "${prefix}"`); |
13 |
| - |
14 |
| - // Stop the process if there is no def input without breaking the build |
15 |
| - const hasDef = inputs.def || process.env.NETLIFY_PLUGIN_USE_ENV_IN_RUNTIME_DEF; |
16 |
| - if (!hasDef) { |
17 |
| - return console.warn("No \"def\" input defined. Skip the process."); |
18 |
| - } |
19 |
| - |
20 |
| - // Build definitions |
21 |
| - const definitions = buildGlobalDefinitions(inputs.def); |
22 |
| - console.info("Built-in definitions: ", definitions); |
23 |
| - |
24 |
| - console.group("Definition process"); |
25 |
| - // Set the process env object |
26 |
| - for (const definition of definitions) { |
27 |
| - // Use old concat to provide a support to old Node versions |
28 |
| - const key = `${prefix}_${definition}`; |
29 |
| - process.env[key] = process.env[definition]; |
30 |
| - console.info(`- Set ${key} with the following value: "${definition}" in process.env`); |
31 |
| - } |
32 |
| - console.groupEnd(); |
33 |
| - |
34 |
| - console.info("Use Env In Runtime plugin process completed"); |
35 |
| - console.groupEnd(); |
36 |
| - console.info("The environment variables have been added successfully!"); |
| 3 | + console.group("Starting the \"uefn\" plugin process"); |
| 4 | + const prefix = inputs.prefix || process.env.NETLIFY_PLUGIN_USE_ENV_IN_RUNTIME_PREFIX; |
| 5 | + |
| 6 | + // Stop the process if there is no prefix input without breaking the build |
| 7 | + if (!prefix) { |
| 8 | + return console.warn("No \"prefix\" input defined. Skip the process."); |
| 9 | + } |
| 10 | + |
| 11 | + console.info(`Defined prefix: "${prefix}"`); |
| 12 | + |
| 13 | + // Stop the process if there is no def input without breaking the build |
| 14 | + const hasDef = inputs.def || process.env.NETLIFY_PLUGIN_USE_ENV_IN_RUNTIME_DEF; |
| 15 | + if (!hasDef) { |
| 16 | + return console.warn("No \"def\" input defined. Skip the process."); |
37 | 17 | }
|
38 |
| - catch (error) { |
39 |
| - utils.build.failPlugin("The plugin failed. Please check your configuration. Stack trace:", {error}); |
| 18 | + |
| 19 | + // Build definitions |
| 20 | + const definitions = buildGlobalDefinitions(inputs.def); |
| 21 | + console.info("Built-in definitions: ", definitions); |
| 22 | + |
| 23 | + console.group("Definition process"); |
| 24 | + // Set the process env object |
| 25 | + for (const definition of definitions) { |
| 26 | + // Use old concat to provide a support to old Node versions |
| 27 | + const key = `${prefix}_${definition}`; |
| 28 | + process.env[key] = process.env[definition]; |
| 29 | + console.info(`- Set ${key} with the following value: "${definition}" in process.env`); |
40 | 30 | }
|
| 31 | + console.groupEnd(); |
| 32 | + |
| 33 | + console.info("Use Env In Runtime plugin process completed"); |
| 34 | + console.groupEnd(); |
| 35 | + console.info("The environment variables have been added successfully!"); |
41 | 36 | }
|
42 | 37 | };
|
43 | 38 |
|
|
0 commit comments