@netlify/build 29.2.2 → 29.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/build.js +13 -5
- package/lib/core/config.js +4 -2
- package/lib/core/normalize_flags.js +4 -1
- package/lib/plugins/spawn.js +5 -3
- package/lib/steps/return.js +5 -3
- package/lib/steps/run_step.js +5 -2
- package/lib/steps/run_steps.js +2 -1
- package/package.json +2 -2
package/lib/core/build.js
CHANGED
|
@@ -23,12 +23,14 @@ import { normalizeFlags } from './normalize_flags.js';
|
|
|
23
23
|
export const startBuild = function (flags) {
|
|
24
24
|
const timers = initTimers();
|
|
25
25
|
const logs = getBufferLogs(flags);
|
|
26
|
-
|
|
26
|
+
if (!flags.quiet) {
|
|
27
|
+
logBuildStart(logs);
|
|
28
|
+
}
|
|
27
29
|
const { bugsnagKey, ...flagsA } = normalizeFlags(flags, logs);
|
|
28
30
|
const errorMonitor = startErrorMonitor({ flags: flagsA, logs, bugsnagKey });
|
|
29
31
|
return { ...flagsA, errorMonitor, logs, timers };
|
|
30
32
|
};
|
|
31
|
-
const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cachedConfigPath, cwd, repositoryRoot, apiHost, token, siteId, context, branch, baseRelDir, env: envOpt, debug, systemLogFile, verbose, nodePath, functionsDistDir, edgeFunctionsDistDir, cacheDir, dry, mode, offline, deployId, buildId, testOpts, errorMonitor, errorParams, logs, timers, buildbotServerSocket, sendStatus, saveConfig, featureFlags, timeline, devCommand, }) {
|
|
33
|
+
const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cachedConfigPath, cwd, repositoryRoot, apiHost, token, siteId, context, branch, baseRelDir, env: envOpt, debug, systemLogFile, verbose, nodePath, functionsDistDir, edgeFunctionsDistDir, cacheDir, dry, mode, offline, deployId, buildId, testOpts, errorMonitor, errorParams, logs, timers, buildbotServerSocket, sendStatus, saveConfig, featureFlags, timeline, devCommand, quiet, }) {
|
|
32
34
|
const configOpts = getConfigOpts({
|
|
33
35
|
config,
|
|
34
36
|
defaultConfig,
|
|
@@ -57,6 +59,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
57
59
|
logs,
|
|
58
60
|
nodePath,
|
|
59
61
|
timers,
|
|
62
|
+
quiet,
|
|
60
63
|
});
|
|
61
64
|
const constants = await getConstants({
|
|
62
65
|
configPath,
|
|
@@ -110,6 +113,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
110
113
|
featureFlags,
|
|
111
114
|
timeline,
|
|
112
115
|
devCommand,
|
|
116
|
+
quiet,
|
|
113
117
|
});
|
|
114
118
|
return {
|
|
115
119
|
pluginsOptions: pluginsOptionsA,
|
|
@@ -123,7 +127,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
123
127
|
};
|
|
124
128
|
export const execBuild = measureDuration(tExecBuild, 'total', { parentTag: 'build_site' });
|
|
125
129
|
// Runs a build then report any plugin statuses
|
|
126
|
-
export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, buildbotServerSocket, constants, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, timers, sendStatus, saveConfig, testOpts, featureFlags, timeline, devCommand, }) {
|
|
130
|
+
export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, buildbotServerSocket, constants, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, timers, sendStatus, saveConfig, testOpts, featureFlags, timeline, devCommand, quiet, }) {
|
|
127
131
|
try {
|
|
128
132
|
const { stepsCount, netlifyConfig: netlifyConfigA, statuses, pluginsOptions: pluginsOptionsA, failedPlugins, timers: timersA, configMutations, } = await initAndRunBuild({
|
|
129
133
|
pluginsOptions,
|
|
@@ -160,6 +164,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
|
|
|
160
164
|
featureFlags,
|
|
161
165
|
timeline,
|
|
162
166
|
devCommand,
|
|
167
|
+
quiet,
|
|
163
168
|
});
|
|
164
169
|
await Promise.all([
|
|
165
170
|
reportStatuses({
|
|
@@ -219,7 +224,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
|
|
|
219
224
|
}
|
|
220
225
|
};
|
|
221
226
|
// Initialize plugin processes then runs a build
|
|
222
|
-
const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, sendStatus, saveConfig, timers, testOpts, buildbotServerSocket, constants, featureFlags, timeline, devCommand, }) {
|
|
227
|
+
const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, sendStatus, saveConfig, timers, testOpts, buildbotServerSocket, constants, featureFlags, timeline, devCommand, quiet, }) {
|
|
223
228
|
const { pluginsOptions: pluginsOptionsA, timers: timersA } = await getPluginsOptions({
|
|
224
229
|
pluginsOptions,
|
|
225
230
|
netlifyConfig,
|
|
@@ -246,6 +251,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
246
251
|
debug,
|
|
247
252
|
timers: timersA,
|
|
248
253
|
featureFlags,
|
|
254
|
+
quiet,
|
|
249
255
|
});
|
|
250
256
|
try {
|
|
251
257
|
const { stepsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersC, configMutations, } = await runBuild({
|
|
@@ -281,6 +287,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
281
287
|
featureFlags,
|
|
282
288
|
timeline,
|
|
283
289
|
devCommand,
|
|
290
|
+
quiet,
|
|
284
291
|
});
|
|
285
292
|
await Promise.all([
|
|
286
293
|
warnOnMissingSideFiles({ buildDir, netlifyConfig: netlifyConfigA, logs }),
|
|
@@ -307,7 +314,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
307
314
|
};
|
|
308
315
|
// Load plugin main files, retrieve their event handlers then runs them,
|
|
309
316
|
// together with the build command
|
|
310
|
-
const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig, configOpts, packageJson, configPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, dry, buildbotServerSocket, constants, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, timeline, devCommand, }) {
|
|
317
|
+
const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig, configOpts, packageJson, configPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, dry, buildbotServerSocket, constants, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, timeline, devCommand, quiet, }) {
|
|
311
318
|
const { pluginsSteps, timers: timersA } = await loadPlugins({
|
|
312
319
|
pluginsOptions,
|
|
313
320
|
childProcesses,
|
|
@@ -351,6 +358,7 @@ const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig
|
|
|
351
358
|
timers: timersA,
|
|
352
359
|
testOpts,
|
|
353
360
|
featureFlags,
|
|
361
|
+
quiet,
|
|
354
362
|
});
|
|
355
363
|
return { stepsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersB, configMutations };
|
|
356
364
|
};
|
package/lib/core/config.js
CHANGED
|
@@ -37,9 +37,11 @@ export const getConfigOpts = function ({ config, defaultConfig, cwd, repositoryR
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
// Retrieve configuration object
|
|
40
|
-
const tLoadConfig = async function ({ configOpts, cachedConfig, cachedConfigPath, envOpt, debug, logs, nodePath }) {
|
|
40
|
+
const tLoadConfig = async function ({ configOpts, cachedConfig, cachedConfigPath, envOpt, debug, logs, nodePath, quiet, }) {
|
|
41
41
|
const { configPath, headersPath, redirectsPath, buildDir, repositoryRoot, config: netlifyConfig, context: contextA, branch: branchA, token: tokenA, api, siteInfo, env, } = await resolveInitialConfig(configOpts, cachedConfig, cachedConfigPath);
|
|
42
|
-
|
|
42
|
+
if (!quiet) {
|
|
43
|
+
logConfigInfo({ logs, configPath, buildDir, netlifyConfig, context: contextA, debug });
|
|
44
|
+
}
|
|
43
45
|
const apiA = addApiErrorHandlers(api);
|
|
44
46
|
const envValues = mapObj(env, (key, { value }) => [key, value]);
|
|
45
47
|
const childEnv = getChildEnv({ envOpt, env: envValues });
|
|
@@ -23,7 +23,9 @@ export const normalizeFlags = function (flags, logs) {
|
|
|
23
23
|
featureFlags: { ...defaultFlags.featureFlags, ...rawFlags.featureFlags },
|
|
24
24
|
};
|
|
25
25
|
const normalizedFlags = removeFalsy(mergedFlags);
|
|
26
|
-
|
|
26
|
+
if (!flags.quiet) {
|
|
27
|
+
logFlags(logs, rawFlags, normalizedFlags);
|
|
28
|
+
}
|
|
27
29
|
return normalizedFlags;
|
|
28
30
|
};
|
|
29
31
|
// Default values of CLI flags
|
|
@@ -50,6 +52,7 @@ const getDefaultFlags = function ({ env: envOpt = {} }, combinedEnv) {
|
|
|
50
52
|
featureFlags: DEFAULT_FEATURE_FLAGS,
|
|
51
53
|
statsd: { port: DEFAULT_STATSD_PORT },
|
|
52
54
|
timeline: 'build',
|
|
55
|
+
quiet: false,
|
|
53
56
|
};
|
|
54
57
|
};
|
|
55
58
|
// Compute the telemetry flag, it's disabled by default and we want to always disable it
|
package/lib/plugins/spawn.js
CHANGED
|
@@ -12,9 +12,11 @@ const CHILD_MAIN_FILE = fileURLToPath(new URL('child/main.js', import.meta.url))
|
|
|
12
12
|
// (for both security and safety reasons)
|
|
13
13
|
// - logs can be buffered which allows manipulating them for log shipping,
|
|
14
14
|
// transforming and parallel plugins
|
|
15
|
-
const tStartPlugins = async function ({ pluginsOptions, buildDir, childEnv, logs, debug, featureFlags }) {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const tStartPlugins = async function ({ pluginsOptions, buildDir, childEnv, logs, debug, featureFlags, quiet }) {
|
|
16
|
+
if (!quiet) {
|
|
17
|
+
logRuntime(logs, pluginsOptions);
|
|
18
|
+
logLoadingPlugins(logs, pluginsOptions, debug);
|
|
19
|
+
}
|
|
18
20
|
logOutdatedPlugins(logs, pluginsOptions);
|
|
19
21
|
logIncompatiblePlugins(logs, pluginsOptions);
|
|
20
22
|
const childProcesses = await Promise.all(pluginsOptions.map(({ pluginDir, nodePath }) => startPlugin({ pluginDir, nodePath, buildDir, childEnv, featureFlags })));
|
package/lib/steps/return.js
CHANGED
|
@@ -2,7 +2,7 @@ import { logTimer } from '../log/messages/core.js';
|
|
|
2
2
|
import { logStepSuccess } from '../log/messages/steps.js';
|
|
3
3
|
import { handleStepError } from './error.js';
|
|
4
4
|
// Retrieve the return value of a step
|
|
5
|
-
export const getStepReturn = function ({ event, packageName, newError, newEnvChanges, newStatus, coreStep, coreStepName: timerName = `${packageName} ${event}`, childEnv, mode, api, errorMonitor, deployId, netlifyConfig, configMutations, headersPath, redirectsPath, logs, debug, timers, durationNs, testOpts, systemLog, }) {
|
|
5
|
+
export const getStepReturn = function ({ event, packageName, newError, newEnvChanges, newStatus, coreStep, coreStepName: timerName = `${packageName} ${event}`, childEnv, mode, api, errorMonitor, deployId, netlifyConfig, configMutations, headersPath, redirectsPath, logs, debug, timers, durationNs, testOpts, systemLog, quiet, }) {
|
|
6
6
|
if (newError !== undefined) {
|
|
7
7
|
return handleStepError({
|
|
8
8
|
event,
|
|
@@ -19,7 +19,9 @@ export const getStepReturn = function ({ event, packageName, newError, newEnvCha
|
|
|
19
19
|
testOpts,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if (!quiet) {
|
|
23
|
+
logStepSuccess(logs);
|
|
24
|
+
logTimer(logs, durationNs, timerName, systemLog);
|
|
25
|
+
}
|
|
24
26
|
return { newEnvChanges, netlifyConfig, configMutations, headersPath, redirectsPath, newStatus, timers };
|
|
25
27
|
};
|
package/lib/steps/run_step.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fireCoreStep } from './core_step.js';
|
|
|
7
7
|
import { firePluginStep } from './plugin.js';
|
|
8
8
|
import { getStepReturn } from './return.js';
|
|
9
9
|
// Run a step (core, build command or plugin)
|
|
10
|
-
export const runStep = async function ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, pluginPackageJson, loadedFrom, origin, condition, configPath, buildDir, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, }) {
|
|
10
|
+
export const runStep = async function ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, pluginPackageJson, loadedFrom, origin, condition, configPath, buildDir, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, }) {
|
|
11
11
|
const constantsA = await addMutableConstants({ constants, buildDir, netlifyConfig });
|
|
12
12
|
if (!(await shouldRunStep({
|
|
13
13
|
event,
|
|
@@ -22,7 +22,9 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
|
|
|
22
22
|
}))) {
|
|
23
23
|
return {};
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
if (!quiet) {
|
|
26
|
+
logStepStart({ logs, event, packageName, coreStepDescription, index, error, netlifyConfig });
|
|
27
|
+
}
|
|
26
28
|
const fireStep = getFireStep(packageName, coreStepId, event);
|
|
27
29
|
const { newEnvChanges, netlifyConfig: netlifyConfigA = netlifyConfig, configMutations: configMutationsA = configMutations, headersPath: headersPathA = headersPath, redirectsPath: redirectsPathA = redirectsPath, newError, newStatus, timers: timersA, durationNs, } = await fireStep({
|
|
28
30
|
event,
|
|
@@ -84,6 +86,7 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
|
|
|
84
86
|
durationNs,
|
|
85
87
|
testOpts,
|
|
86
88
|
systemLog,
|
|
89
|
+
quiet,
|
|
87
90
|
});
|
|
88
91
|
return { ...newValues, newIndex: index + 1 };
|
|
89
92
|
};
|
package/lib/steps/run_steps.js
CHANGED
|
@@ -7,7 +7,7 @@ import { runStep } from './run_step.js';
|
|
|
7
7
|
// list of `failedPlugins` (that ran `utils.build.failPlugin()`).
|
|
8
8
|
// If an error arises, runs `onError` events.
|
|
9
9
|
// Runs `onEnd` events at the end, whether an error was thrown or not.
|
|
10
|
-
export const runSteps = async function ({ steps, buildbotServerSocket, events, configPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, constants, mode, api, errorMonitor, deployId, errorParams, netlifyConfig, configOpts, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, }) {
|
|
10
|
+
export const runSteps = async function ({ steps, buildbotServerSocket, events, configPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, constants, mode, api, errorMonitor, deployId, errorParams, netlifyConfig, configOpts, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, }) {
|
|
11
11
|
const { index: stepsCount, error: errorA, netlifyConfig: netlifyConfigC, statuses: statusesB, failedPlugins: failedPluginsA, timers: timersC, configMutations: configMutationsB, } = await pReduce(steps, async ({ index, error, failedPlugins, envChanges, netlifyConfig: netlifyConfigA, configMutations, headersPath: headersPathA, redirectsPath: redirectsPathA, statuses, timers: timersA, }, { event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, pluginPackageJson, loadedFrom, origin, condition, }) => {
|
|
12
12
|
const { newIndex = index, newError = error, failedPlugin = [], newEnvChanges = {}, netlifyConfig: netlifyConfigB = netlifyConfigA, configMutations: configMutationsA = configMutations, headersPath: headersPathB = headersPathA, redirectsPath: redirectsPathB = redirectsPathA, newStatus, timers: timersB = timersA, } = await runStep({
|
|
13
13
|
event,
|
|
@@ -54,6 +54,7 @@ export const runSteps = async function ({ steps, buildbotServerSocket, events, c
|
|
|
54
54
|
timers: timersA,
|
|
55
55
|
testOpts,
|
|
56
56
|
featureFlags,
|
|
57
|
+
quiet,
|
|
57
58
|
});
|
|
58
59
|
const statusesA = addStatus({ newStatus, statuses, event, packageName, pluginPackageJson });
|
|
59
60
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.3.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/core/main.js",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"module": "commonjs"
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "7a313d1bf93d7df494c725d3984a9e7640ae4d09"
|
|
153
153
|
}
|