@netlify/build 29.2.2 → 29.4.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 +17 -5
- package/lib/core/config.js +6 -3
- package/lib/core/flags.js +5 -0
- package/lib/core/normalize_flags.js +4 -1
- package/lib/plugins/spawn.js +5 -3
- package/lib/plugins_core/deploy/index.js +1 -1
- package/lib/plugins_core/save_artifacts/index.js +33 -0
- package/lib/steps/core_step.js +2 -1
- package/lib/steps/get.js +2 -1
- package/lib/steps/return.js +5 -3
- package/lib/steps/run_step.js +12 -5
- package/lib/steps/run_steps.js +3 -1
- package/package.json +3 -3
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, outputConfigPath, 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,
|
|
@@ -81,6 +84,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
81
84
|
configOpts,
|
|
82
85
|
siteInfo,
|
|
83
86
|
configPath,
|
|
87
|
+
outputConfigPath,
|
|
84
88
|
headersPath,
|
|
85
89
|
redirectsPath,
|
|
86
90
|
buildDir,
|
|
@@ -110,6 +114,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
110
114
|
featureFlags,
|
|
111
115
|
timeline,
|
|
112
116
|
devCommand,
|
|
117
|
+
quiet,
|
|
113
118
|
});
|
|
114
119
|
return {
|
|
115
120
|
pluginsOptions: pluginsOptionsA,
|
|
@@ -123,7 +128,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
123
128
|
};
|
|
124
129
|
export const execBuild = measureDuration(tExecBuild, 'total', { parentTag: 'build_site' });
|
|
125
130
|
// 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, }) {
|
|
131
|
+
export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, outputConfigPath, 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
132
|
try {
|
|
128
133
|
const { stepsCount, netlifyConfig: netlifyConfigA, statuses, pluginsOptions: pluginsOptionsA, failedPlugins, timers: timersA, configMutations, } = await initAndRunBuild({
|
|
129
134
|
pluginsOptions,
|
|
@@ -131,6 +136,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
|
|
|
131
136
|
configOpts,
|
|
132
137
|
siteInfo,
|
|
133
138
|
configPath,
|
|
139
|
+
outputConfigPath,
|
|
134
140
|
headersPath,
|
|
135
141
|
redirectsPath,
|
|
136
142
|
buildDir,
|
|
@@ -160,6 +166,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
|
|
|
160
166
|
featureFlags,
|
|
161
167
|
timeline,
|
|
162
168
|
devCommand,
|
|
169
|
+
quiet,
|
|
163
170
|
});
|
|
164
171
|
await Promise.all([
|
|
165
172
|
reportStatuses({
|
|
@@ -219,7 +226,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
|
|
|
219
226
|
}
|
|
220
227
|
};
|
|
221
228
|
// 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, }) {
|
|
229
|
+
const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, outputConfigPath, 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
230
|
const { pluginsOptions: pluginsOptionsA, timers: timersA } = await getPluginsOptions({
|
|
224
231
|
pluginsOptions,
|
|
225
232
|
netlifyConfig,
|
|
@@ -246,6 +253,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
246
253
|
debug,
|
|
247
254
|
timers: timersA,
|
|
248
255
|
featureFlags,
|
|
256
|
+
quiet,
|
|
249
257
|
});
|
|
250
258
|
try {
|
|
251
259
|
const { stepsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersC, configMutations, } = await runBuild({
|
|
@@ -255,6 +263,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
255
263
|
configOpts,
|
|
256
264
|
packageJson,
|
|
257
265
|
configPath,
|
|
266
|
+
outputConfigPath,
|
|
258
267
|
headersPath,
|
|
259
268
|
redirectsPath,
|
|
260
269
|
buildDir,
|
|
@@ -281,6 +290,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
281
290
|
featureFlags,
|
|
282
291
|
timeline,
|
|
283
292
|
devCommand,
|
|
293
|
+
quiet,
|
|
284
294
|
});
|
|
285
295
|
await Promise.all([
|
|
286
296
|
warnOnMissingSideFiles({ buildDir, netlifyConfig: netlifyConfigA, logs }),
|
|
@@ -307,7 +317,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
307
317
|
};
|
|
308
318
|
// Load plugin main files, retrieve their event handlers then runs them,
|
|
309
319
|
// 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, }) {
|
|
320
|
+
const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig, configOpts, packageJson, configPath, outputConfigPath, 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
321
|
const { pluginsSteps, timers: timersA } = await loadPlugins({
|
|
312
322
|
pluginsOptions,
|
|
313
323
|
childProcesses,
|
|
@@ -327,6 +337,7 @@ const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig
|
|
|
327
337
|
buildbotServerSocket,
|
|
328
338
|
events,
|
|
329
339
|
configPath,
|
|
340
|
+
outputConfigPath,
|
|
330
341
|
headersPath,
|
|
331
342
|
redirectsPath,
|
|
332
343
|
buildDir,
|
|
@@ -351,6 +362,7 @@ const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig
|
|
|
351
362
|
timers: timersA,
|
|
352
363
|
testOpts,
|
|
353
364
|
featureFlags,
|
|
365
|
+
quiet,
|
|
354
366
|
});
|
|
355
367
|
return { stepsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersB, configMutations };
|
|
356
368
|
};
|
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 });
|
|
@@ -95,13 +97,14 @@ export const resolveUpdatedConfig = async function (configOpts, configMutations)
|
|
|
95
97
|
// This is only done when `saveConfig` is `true`. This allows performing this
|
|
96
98
|
// in the buildbot but not in local builds, since only the latter run in a
|
|
97
99
|
// container and we want to avoid saving files on local machines.
|
|
98
|
-
export const saveUpdatedConfig = async function ({ configMutations, buildDir, repositoryRoot, configPath = `${repositoryRoot}/netlify.toml`, headersPath, redirectsPath, logs, featureFlags, context, branch, debug, saveConfig, }) {
|
|
100
|
+
export const saveUpdatedConfig = async function ({ configMutations, buildDir, repositoryRoot, configPath = `${repositoryRoot}/netlify.toml`, outputConfigPath = configPath, headersPath, redirectsPath, logs, featureFlags, context, branch, debug, saveConfig, }) {
|
|
99
101
|
if (!saveConfig) {
|
|
100
102
|
return;
|
|
101
103
|
}
|
|
102
104
|
await updateConfig(configMutations, {
|
|
103
105
|
buildDir,
|
|
104
106
|
configPath,
|
|
107
|
+
outputConfigPath,
|
|
105
108
|
headersPath,
|
|
106
109
|
redirectsPath,
|
|
107
110
|
context,
|
package/lib/core/flags.js
CHANGED
|
@@ -162,6 +162,11 @@ Default: false`,
|
|
|
162
162
|
describe: 'Whether configuration changes should be saved to netlify.toml',
|
|
163
163
|
hidden: true,
|
|
164
164
|
},
|
|
165
|
+
outputConfigPath: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
describe: 'Path where to save the netlify.toml resulting from configuration changes. Only applicable if `saveConfig` is set. Defaults to "netlify.toml" in the root directory.',
|
|
168
|
+
hidden: true,
|
|
169
|
+
},
|
|
165
170
|
testOpts: {
|
|
166
171
|
describe: 'Options for testing only',
|
|
167
172
|
hidden: true,
|
|
@@ -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 })));
|
|
@@ -36,7 +36,7 @@ const coreStep = async function ({ buildDir, configPath, repositoryRoot, constan
|
|
|
36
36
|
await closeBuildbotClient(client);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
const shouldDeploy = function ({ buildbotServerSocket }) {
|
|
39
|
+
export const shouldDeploy = function ({ buildbotServerSocket }) {
|
|
40
40
|
return buildbotServerSocket !== undefined;
|
|
41
41
|
};
|
|
42
42
|
export const deploySite = {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { saveUpdatedConfig } from '../../core/config.js';
|
|
2
|
+
import { shouldDeploy } from '../deploy/index.js';
|
|
3
|
+
const coreStep = async function ({ buildDir, configPath, outputConfigPath, repositoryRoot, logs, featureFlags, context, branch, configMutations, headersPath, redirectsPath, debug, saveConfig, }) {
|
|
4
|
+
await saveUpdatedConfig({
|
|
5
|
+
configMutations,
|
|
6
|
+
buildDir,
|
|
7
|
+
repositoryRoot,
|
|
8
|
+
configPath,
|
|
9
|
+
outputConfigPath,
|
|
10
|
+
headersPath,
|
|
11
|
+
redirectsPath,
|
|
12
|
+
logs,
|
|
13
|
+
featureFlags,
|
|
14
|
+
context,
|
|
15
|
+
branch,
|
|
16
|
+
debug,
|
|
17
|
+
saveConfig,
|
|
18
|
+
});
|
|
19
|
+
return {};
|
|
20
|
+
};
|
|
21
|
+
// This step and the deploy step must be mutually exclusive, or we end up
|
|
22
|
+
// mutating the config twice.
|
|
23
|
+
const shouldSaveArtifacts = (options) => {
|
|
24
|
+
return !shouldDeploy(options) && options.saveConfig === true;
|
|
25
|
+
};
|
|
26
|
+
export const saveArtifacts = {
|
|
27
|
+
event: 'onPostBuild',
|
|
28
|
+
coreStep,
|
|
29
|
+
coreStepId: 'save_artifacts',
|
|
30
|
+
coreStepName: 'Save deploy artifacts',
|
|
31
|
+
coreStepDescription: () => 'Save deploy artifacts',
|
|
32
|
+
condition: shouldSaveArtifacts,
|
|
33
|
+
};
|
package/lib/steps/core_step.js
CHANGED
|
@@ -2,12 +2,13 @@ import { setEnvChanges } from '../env/changes.js';
|
|
|
2
2
|
import { addErrorInfo, isBuildError } from '../error/info.js';
|
|
3
3
|
import { updateNetlifyConfig, listConfigSideFiles } from './update_config.js';
|
|
4
4
|
// Fire a core step
|
|
5
|
-
export const fireCoreStep = async function ({ coreStep, coreStepId, coreStepName, configPath, buildDir, repositoryRoot, constants, buildbotServerSocket, events, logs, nodePath, childEnv, context, branch, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, debug, systemLog, saveConfig, }) {
|
|
5
|
+
export const fireCoreStep = async function ({ coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, constants, buildbotServerSocket, events, logs, nodePath, childEnv, context, branch, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, debug, systemLog, saveConfig, }) {
|
|
6
6
|
try {
|
|
7
7
|
const configSideFiles = await listConfigSideFiles([headersPath, redirectsPath]);
|
|
8
8
|
const childEnvA = setEnvChanges(envChanges, { ...childEnv });
|
|
9
9
|
const { newEnvChanges = {}, configMutations: newConfigMutations = [], tags, } = await coreStep({
|
|
10
10
|
configPath,
|
|
11
|
+
outputConfigPath,
|
|
11
12
|
buildDir,
|
|
12
13
|
repositoryRoot,
|
|
13
14
|
constants,
|
package/lib/steps/get.js
CHANGED
|
@@ -3,6 +3,7 @@ import { buildCommandCore } from '../plugins_core/build_command.js';
|
|
|
3
3
|
import { deploySite } from '../plugins_core/deploy/index.js';
|
|
4
4
|
import { bundleEdgeFunctions } from '../plugins_core/edge_functions/index.js';
|
|
5
5
|
import { bundleFunctions } from '../plugins_core/functions/index.js';
|
|
6
|
+
import { saveArtifacts } from '../plugins_core/save_artifacts/index.js';
|
|
6
7
|
// Get all build steps
|
|
7
8
|
export const getSteps = function (steps) {
|
|
8
9
|
const stepsA = addCoreSteps(steps);
|
|
@@ -27,7 +28,7 @@ export const getDevSteps = function (command, steps) {
|
|
|
27
28
|
return { steps: sortedSteps, events };
|
|
28
29
|
};
|
|
29
30
|
const addCoreSteps = function (steps) {
|
|
30
|
-
return [buildCommandCore, ...steps, bundleFunctions, bundleEdgeFunctions, deploySite];
|
|
31
|
+
return [buildCommandCore, ...steps, bundleFunctions, bundleEdgeFunctions, deploySite, saveArtifacts];
|
|
31
32
|
};
|
|
32
33
|
// Sort plugin steps by event order.
|
|
33
34
|
const sortSteps = function (steps, events) {
|
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, outputConfigPath, 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,
|
|
@@ -19,10 +19,13 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
|
|
|
19
19
|
constants: constantsA,
|
|
20
20
|
buildbotServerSocket,
|
|
21
21
|
buildDir,
|
|
22
|
+
saveConfig,
|
|
22
23
|
}))) {
|
|
23
24
|
return {};
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
if (!quiet) {
|
|
27
|
+
logStepStart({ logs, event, packageName, coreStepDescription, index, error, netlifyConfig });
|
|
28
|
+
}
|
|
26
29
|
const fireStep = getFireStep(packageName, coreStepId, event);
|
|
27
30
|
const { newEnvChanges, netlifyConfig: netlifyConfigA = netlifyConfig, configMutations: configMutationsA = configMutations, headersPath: headersPathA = headersPath, redirectsPath: redirectsPathA = redirectsPath, newError, newStatus, timers: timersA, durationNs, } = await fireStep({
|
|
28
31
|
event,
|
|
@@ -35,6 +38,7 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
|
|
|
35
38
|
coreStepId,
|
|
36
39
|
coreStepName,
|
|
37
40
|
configPath,
|
|
41
|
+
outputConfigPath,
|
|
38
42
|
buildDir,
|
|
39
43
|
repositoryRoot,
|
|
40
44
|
nodePath,
|
|
@@ -84,6 +88,7 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
|
|
|
84
88
|
durationNs,
|
|
85
89
|
testOpts,
|
|
86
90
|
systemLog,
|
|
91
|
+
quiet,
|
|
87
92
|
});
|
|
88
93
|
return { ...newValues, newIndex: index + 1 };
|
|
89
94
|
};
|
|
@@ -118,9 +123,10 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
|
|
|
118
123
|
// or available. However, one might be created by a build plugin, in which case,
|
|
119
124
|
// those core plugins should be triggered. We use a dynamic `condition()` to
|
|
120
125
|
// model this behavior.
|
|
121
|
-
const shouldRunStep = async function ({ event, packageName, error, failedPlugins, netlifyConfig, condition, constants, buildbotServerSocket, buildDir, }) {
|
|
126
|
+
const shouldRunStep = async function ({ event, packageName, error, failedPlugins, netlifyConfig, condition, constants, buildbotServerSocket, buildDir, saveConfig, }) {
|
|
122
127
|
if (failedPlugins.includes(packageName) ||
|
|
123
|
-
(condition !== undefined &&
|
|
128
|
+
(condition !== undefined &&
|
|
129
|
+
!(await condition({ buildDir, constants, buildbotServerSocket, netlifyConfig, saveConfig })))) {
|
|
124
130
|
return false;
|
|
125
131
|
}
|
|
126
132
|
if (error !== undefined) {
|
|
@@ -136,13 +142,14 @@ const getFireStep = function (packageName, coreStepId, event) {
|
|
|
136
142
|
const parentTag = normalizeTagName(packageName);
|
|
137
143
|
return measureDuration(tFireStep, event, { parentTag, category: 'pluginEvent' });
|
|
138
144
|
};
|
|
139
|
-
const tFireStep = function ({ event, childProcess, packageName, pluginPackageJson, loadedFrom, origin, coreStep, coreStepId, coreStepName, configPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, error, logs, debug, systemLog, verbose, saveConfig, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, }) {
|
|
145
|
+
const tFireStep = function ({ event, childProcess, packageName, pluginPackageJson, loadedFrom, origin, coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, error, logs, debug, systemLog, verbose, saveConfig, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, }) {
|
|
140
146
|
if (coreStep !== undefined) {
|
|
141
147
|
return fireCoreStep({
|
|
142
148
|
coreStep,
|
|
143
149
|
coreStepId,
|
|
144
150
|
coreStepName,
|
|
145
151
|
configPath,
|
|
152
|
+
outputConfigPath,
|
|
146
153
|
buildDir,
|
|
147
154
|
repositoryRoot,
|
|
148
155
|
constants,
|
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, outputConfigPath, 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,
|
|
@@ -22,6 +22,7 @@ export const runSteps = async function ({ steps, buildbotServerSocket, events, c
|
|
|
22
22
|
origin,
|
|
23
23
|
condition,
|
|
24
24
|
configPath,
|
|
25
|
+
outputConfigPath,
|
|
25
26
|
buildDir,
|
|
26
27
|
repositoryRoot,
|
|
27
28
|
nodePath,
|
|
@@ -54,6 +55,7 @@ export const runSteps = async function ({ steps, buildbotServerSocket, events, c
|
|
|
54
55
|
timers: timersA,
|
|
55
56
|
testOpts,
|
|
56
57
|
featureFlags,
|
|
58
|
+
quiet,
|
|
57
59
|
});
|
|
58
60
|
const statusesA = addStatus({ newStatus, statuses, event, packageName, pluginPackageJson });
|
|
59
61
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.4.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/core/main.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@bugsnag/js": "^7.0.0",
|
|
67
67
|
"@netlify/cache-utils": "^5.1.0",
|
|
68
|
-
"@netlify/config": "^20.
|
|
68
|
+
"@netlify/config": "^20.3.0",
|
|
69
69
|
"@netlify/edge-bundler": "8.0.0",
|
|
70
70
|
"@netlify/functions-utils": "^5.1.1",
|
|
71
71
|
"@netlify/git-utils": "^5.1.0",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"module": "commonjs"
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "87d6d9344ac37b4c40b70c582958347c0f7fd8eb"
|
|
153
153
|
}
|