@netlify/build 18.13.11 → 18.15.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/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "18.13.11",
3
+ "version": "18.15.0",
4
4
  "description": "Netlify build module",
5
5
  "main": "src/core/main.js",
6
+ "types": "types/index.d.ts",
6
7
  "bin": {
7
8
  "netlify-build": "./src/core/bin.js"
8
9
  },
@@ -59,7 +60,7 @@
59
60
  "@netlify/plugin-edge-handlers": "^1.11.22",
60
61
  "@netlify/plugins-list": "^4.0.0",
61
62
  "@netlify/run-utils": "^2.0.0",
62
- "@netlify/zip-it-and-ship-it": "^4.23.6",
63
+ "@netlify/zip-it-and-ship-it": "^4.24.0",
63
64
  "@sindresorhus/slugify": "^1.1.0",
64
65
  "@ungap/from-entries": "^0.2.1",
65
66
  "ansi-escapes": "^4.3.2",
@@ -123,7 +123,7 @@ const logConfigInfo = function ({ logs, configPath, buildDir, netlifyConfig, con
123
123
  // normalized.
124
124
  // We use `debug: false` to avoid any debug logs. Otherwise every configuration
125
125
  // change would create debug logs which would be too verbose.
126
- // Errors are propagated and assigned to the specific plugin or core command
126
+ // Errors are propagated and assigned to the specific plugin or core step
127
127
  // which changed the configuration.
128
128
  const resolveUpdatedConfig = async function (configOpts, configMutations) {
129
129
  try {
@@ -52,7 +52,7 @@ const INTERNAL_FUNCTIONS_SRC = '.netlify/functions-internal'
52
52
 
53
53
  // Retrieve constants which might change during the build if a plugin modifies
54
54
  // `netlifyConfig` or creates some default directories.
55
- // Unlike readonly constants, this is called again before each command.
55
+ // Unlike readonly constants, this is called again before each build step.
56
56
  const addMutableConstants = async function ({
57
57
  constants,
58
58
  buildDir,
package/src/core/dry.js CHANGED
@@ -2,27 +2,27 @@
2
2
 
3
3
  const pFilter = require('p-filter')
4
4
 
5
- const { logDryRunStart, logDryRunCommand, logDryRunEnd } = require('../log/messages/dry')
5
+ const { logDryRunStart, logDryRunStep, logDryRunEnd } = require('../log/messages/dry')
6
6
  const { runsOnlyOnBuildFailure } = require('../plugins/events')
7
7
 
8
8
  // If the `dry` flag is specified, do a dry run
9
- const doDryRun = async function ({ buildDir, commands, netlifyConfig, constants, buildbotServerSocket, logs }) {
10
- const successCommands = await pFilter(commands, ({ event, condition }) =>
11
- shouldIncludeCommand({ buildDir, event, condition, netlifyConfig, constants, buildbotServerSocket }),
9
+ const doDryRun = async function ({ buildDir, steps, netlifyConfig, constants, buildbotServerSocket, logs }) {
10
+ const successSteps = await pFilter(steps, ({ event, condition }) =>
11
+ shouldIncludeStep({ buildDir, event, condition, netlifyConfig, constants, buildbotServerSocket }),
12
12
  )
13
- const eventWidth = Math.max(...successCommands.map(getEventLength))
14
- const commandsCount = successCommands.length
13
+ const eventWidth = Math.max(...successSteps.map(getEventLength))
14
+ const stepsCount = successSteps.length
15
15
 
16
- logDryRunStart({ logs, eventWidth, commandsCount })
16
+ logDryRunStart({ logs, eventWidth, stepsCount })
17
17
 
18
- successCommands.forEach((command, index) => {
19
- logDryRunCommand({ logs, command, index, netlifyConfig, eventWidth, commandsCount })
18
+ successSteps.forEach((step, index) => {
19
+ logDryRunStep({ logs, step, index, netlifyConfig, eventWidth, stepsCount })
20
20
  })
21
21
 
22
22
  logDryRunEnd(logs)
23
23
  }
24
24
 
25
- const shouldIncludeCommand = async function ({
25
+ const shouldIncludeStep = async function ({
26
26
  buildDir,
27
27
  event,
28
28
  condition,
@@ -15,6 +15,7 @@ const getFeatureFlag = function (name) {
15
15
 
16
16
  // Default values for feature flags
17
17
  const DEFAULT_FEATURE_FLAGS = {
18
+ buildbot_build_go_functions: false,
18
19
  buildbot_es_modules_esbuild: false,
19
20
  buildbot_zisi_esbuild_parser: false,
20
21
  netlify_config_toml_backslash: false,
package/src/core/flags.js CHANGED
@@ -94,12 +94,12 @@ Default: true`,
94
94
  dry: {
95
95
  alias: 'dry-run',
96
96
  boolean: true,
97
- describe: `Run in dry mode, i.e. printing commands without executing them.
97
+ describe: `Run in dry mode, i.e. printing steps without executing them.
98
98
  Default: false`,
99
99
  },
100
100
  nodePath: {
101
101
  string: true,
102
- describe: `Path to the Node.js binary to use in user commands and build plugins.
102
+ describe: `Path to the Node.js binary to use in the build command and plugins.
103
103
  Default: Current Node.js binary`,
104
104
  },
105
105
  functionsDistDir: {
package/src/core/main.js CHANGED
@@ -3,8 +3,6 @@
3
3
  /* eslint-disable max-lines, import/max-dependencies */
4
4
  require('../utils/polyfills')
5
5
 
6
- const { getCommands } = require('../commands/get')
7
- const { runCommands } = require('../commands/run_commands')
8
6
  const { handleBuildError } = require('../error/handle')
9
7
  const { getErrorInfo } = require('../error/info')
10
8
  const { startErrorMonitor } = require('../error/monitor/start')
@@ -16,6 +14,8 @@ const { pinPlugins } = require('../plugins/pinned_version')
16
14
  const { startPlugins, stopPlugins } = require('../plugins/spawn')
17
15
  const { addCorePlugins } = require('../plugins_core/add')
18
16
  const { reportStatuses } = require('../status/report')
17
+ const { getSteps } = require('../steps/get')
18
+ const { runSteps } = require('../steps/run_steps')
19
19
  const { trackBuildComplete } = require('../telemetry/main')
20
20
  const { initTimers, measureDuration } = require('../time/main')
21
21
  const { reportTimers } = require('../time/report')
@@ -42,8 +42,8 @@ const { getSeverity } = require('./severity')
42
42
  * @param {string} [flags.deployId] - Netlify Deploy ID
43
43
  * @param {string} [flags.context] - Build context
44
44
  * @param {string} [flags.branch] - Repository branch
45
- * @param {boolean} [flags.dry=false] - Run in dry mode, i.e. printing commands without executing them
46
- * @param {string} [flags.nodePath] - Path to the Node.js binary to use in user commands and build plugins
45
+ * @param {boolean} [flags.dry=false] - Run in dry mode, i.e. printing steps without executing them
46
+ * @param {string} [flags.nodePath] - Path to the Node.js binary to use in the build command and plugins
47
47
  * @param {boolean} [flags.buffer=false] - Buffer output instead of printing it
48
48
  *
49
49
  * @returns {object} buildResult
@@ -75,7 +75,7 @@ const build = async function (flags = {}) {
75
75
  netlifyConfig: netlifyConfigA,
76
76
  siteInfo,
77
77
  userNodeVersion,
78
- commandsCount,
78
+ stepsCount,
79
79
  timers,
80
80
  durationNs,
81
81
  configMutations,
@@ -104,7 +104,7 @@ const build = async function (flags = {}) {
104
104
  buildId,
105
105
  deployId,
106
106
  status,
107
- commandsCount,
107
+ stepsCount,
108
108
  pluginsOptions,
109
109
  durationNs,
110
110
  siteInfo,
@@ -248,7 +248,7 @@ const tExecBuild = async function ({
248
248
  const {
249
249
  pluginsOptions: pluginsOptionsA,
250
250
  netlifyConfig: netlifyConfigA,
251
- commandsCount,
251
+ stepsCount,
252
252
  timers: timersB,
253
253
  configMutations,
254
254
  } = await runAndReportBuild({
@@ -288,7 +288,7 @@ const tExecBuild = async function ({
288
288
  netlifyConfig: netlifyConfigA,
289
289
  siteInfo,
290
290
  userNodeVersion,
291
- commandsCount,
291
+ stepsCount,
292
292
  timers: timersB,
293
293
  configMutations,
294
294
  }
@@ -331,7 +331,7 @@ const runAndReportBuild = async function ({
331
331
  }) {
332
332
  try {
333
333
  const {
334
- commandsCount,
334
+ stepsCount,
335
335
  netlifyConfig: netlifyConfigA,
336
336
  statuses,
337
337
  pluginsOptions: pluginsOptionsA,
@@ -404,7 +404,7 @@ const runAndReportBuild = async function ({
404
404
  return {
405
405
  pluginsOptions: pluginsOptionsA,
406
406
  netlifyConfig: netlifyConfigA,
407
- commandsCount,
407
+ stepsCount,
408
408
  timers: timersA,
409
409
  configMutations,
410
410
  }
@@ -492,7 +492,7 @@ const initAndRunBuild = async function ({
492
492
 
493
493
  try {
494
494
  const {
495
- commandsCount,
495
+ stepsCount,
496
496
  netlifyConfig: netlifyConfigA,
497
497
  statuses,
498
498
  failedPlugins,
@@ -535,7 +535,7 @@ const initAndRunBuild = async function ({
535
535
  ])
536
536
 
537
537
  return {
538
- commandsCount,
538
+ stepsCount,
539
539
  netlifyConfig: netlifyConfigA,
540
540
  statuses,
541
541
  pluginsOptions: pluginsOptionsA,
@@ -580,7 +580,7 @@ const runBuild = async function ({
580
580
  testOpts,
581
581
  featureFlags,
582
582
  }) {
583
- const { pluginsCommands, timers: timersA } = await loadPlugins({
583
+ const { pluginsSteps, timers: timersA } = await loadPlugins({
584
584
  pluginsOptions,
585
585
  childProcesses,
586
586
  packageJson,
@@ -588,22 +588,22 @@ const runBuild = async function ({
588
588
  debug,
589
589
  })
590
590
 
591
- const { commands, events } = getCommands(pluginsCommands)
591
+ const { steps, events } = getSteps(pluginsSteps)
592
592
 
593
593
  if (dry) {
594
- await doDryRun({ buildDir, commands, netlifyConfig, constants, buildbotServerSocket, logs })
594
+ await doDryRun({ buildDir, steps, netlifyConfig, constants, buildbotServerSocket, logs })
595
595
  return { netlifyConfig }
596
596
  }
597
597
 
598
598
  const {
599
- commandsCount,
599
+ stepsCount,
600
600
  netlifyConfig: netlifyConfigA,
601
601
  statuses,
602
602
  failedPlugins,
603
603
  timers: timersB,
604
604
  configMutations,
605
- } = await runCommands({
606
- commands,
605
+ } = await runSteps({
606
+ steps,
607
607
  buildbotServerSocket,
608
608
  events,
609
609
  configPath,
@@ -631,7 +631,7 @@ const runBuild = async function ({
631
631
  featureFlags,
632
632
  })
633
633
 
634
- return { commandsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersB, configMutations }
634
+ return { stepsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersB, configMutations }
635
635
  }
636
636
 
637
637
  // Logs and reports that a build successfully ended
@@ -651,7 +651,7 @@ const telemetryReport = async function ({
651
651
  deployId,
652
652
  buildId,
653
653
  status,
654
- commandsCount,
654
+ stepsCount,
655
655
  pluginsOptions,
656
656
  durationNs,
657
657
  siteInfo,
@@ -666,7 +666,7 @@ const telemetryReport = async function ({
666
666
  deployId,
667
667
  buildId,
668
668
  status,
669
- commandsCount,
669
+ stepsCount,
670
670
  pluginsOptions,
671
671
  durationNs,
672
672
  siteInfo,
@@ -29,8 +29,8 @@ const getFunctionsBundlingLocation = function ({ functionName }) {
29
29
  return `While bundling Function "${functionName}"`
30
30
  }
31
31
 
32
- const getCoreCommandLocation = function ({ coreCommandName }) {
33
- return `During ${coreCommandName}`
32
+ const getCoreStepLocation = function ({ coreStepName }) {
33
+ return `During ${coreStepName}`
34
34
  }
35
35
 
36
36
  const getBuildFailLocation = function ({ event, packageName, loadedFrom, origin }) {
@@ -54,7 +54,7 @@ const getApiLocation = function ({ endpoint, parameters }) {
54
54
  const LOCATIONS = {
55
55
  buildCommand: getBuildCommandLocation,
56
56
  functionsBundling: getFunctionsBundlingLocation,
57
- coreCommand: getCoreCommandLocation,
57
+ coreStep: getCoreStepLocation,
58
58
  buildFail: getBuildFailLocation,
59
59
  api: getApiLocation,
60
60
  }
package/src/error/type.js CHANGED
@@ -141,13 +141,13 @@ const TYPES = {
141
141
  severity: 'error',
142
142
  },
143
143
 
144
- // Core command internal error
145
- coreCommand: {
146
- title: ({ location: { coreCommandName } }) => `Internal error during "${coreCommandName}"`,
144
+ // Core step internal error
145
+ coreStep: {
146
+ title: ({ location: { coreStepName } }) => `Internal error during "${coreStepName}"`,
147
147
  stackType: 'stack',
148
148
  showErrorProps: true,
149
149
  rawStack: true,
150
- locationType: 'coreCommand',
150
+ locationType: 'coreStep',
151
151
  severity: 'error',
152
152
  },
153
153
 
@@ -5,8 +5,8 @@ const { arrowDown } = require('figures')
5
5
  const { logMessage, logSubHeader } = require('../logger')
6
6
  const { THEME } = require('../theme')
7
7
 
8
- const logDryRunStart = function ({ logs, eventWidth, commandsCount }) {
9
- const columnWidth = getDryColumnWidth(eventWidth, commandsCount)
8
+ const logDryRunStart = function ({ logs, eventWidth, stepsCount }) {
9
+ const columnWidth = getDryColumnWidth(eventWidth, stepsCount)
10
10
  const line = '─'.repeat(columnWidth)
11
11
  const secondLine = '─'.repeat(columnWidth)
12
12
 
@@ -23,19 +23,19 @@ ${THEME.header(`┌─${line}─┬─${secondLine}─┐
23
23
  )
24
24
  }
25
25
 
26
- const logDryRunCommand = function ({
26
+ const logDryRunStep = function ({
27
27
  logs,
28
- command: { event, packageName, coreCommandDescription },
28
+ step: { event, packageName, coreStepDescription },
29
29
  index,
30
30
  netlifyConfig,
31
31
  eventWidth,
32
- commandsCount,
32
+ stepsCount,
33
33
  }) {
34
- const columnWidth = getDryColumnWidth(eventWidth, commandsCount)
35
- const fullName = getFullName(coreCommandDescription, netlifyConfig, packageName)
34
+ const columnWidth = getDryColumnWidth(eventWidth, stepsCount)
35
+ const fullName = getFullName(coreStepDescription, netlifyConfig, packageName)
36
36
  const line = '─'.repeat(columnWidth)
37
37
  const countText = `${index + 1}. `
38
- const downArrow = commandsCount === index + 1 ? ' ' : ` ${arrowDown}`
38
+ const downArrow = stepsCount === index + 1 ? ' ' : ` ${arrowDown}`
39
39
  const eventWidthA = columnWidth - countText.length - downArrow.length
40
40
 
41
41
  logMessage(
@@ -46,14 +46,14 @@ ${THEME.header(`└─${line}─┘ `)}`,
46
46
  )
47
47
  }
48
48
 
49
- const getFullName = function (coreCommandDescription, netlifyConfig, packageName) {
50
- return coreCommandDescription === undefined
49
+ const getFullName = function (coreStepDescription, netlifyConfig, packageName) {
50
+ return coreStepDescription === undefined
51
51
  ? `Plugin ${THEME.highlightWords(packageName)}`
52
- : coreCommandDescription({ netlifyConfig })
52
+ : coreStepDescription({ netlifyConfig })
53
53
  }
54
54
 
55
- const getDryColumnWidth = function (eventWidth, commandsCount) {
56
- const symbolsWidth = `${commandsCount}`.length + COLUMN_EXTRA_WIDTH
55
+ const getDryColumnWidth = function (eventWidth, stepsCount) {
56
+ const symbolsWidth = `${stepsCount}`.length + COLUMN_EXTRA_WIDTH
57
57
  return Math.max(eventWidth + symbolsWidth, DRY_HEADER_NAMES[1].length)
58
58
  }
59
59
 
@@ -66,6 +66,6 @@ const logDryRunEnd = function (logs) {
66
66
 
67
67
  module.exports = {
68
68
  logDryRunStart,
69
- logDryRunCommand,
69
+ logDryRunStep,
70
70
  logDryRunEnd,
71
71
  }
@@ -0,0 +1,32 @@
1
+ 'use strict'
2
+
3
+ const { getLogHeaderFunc } = require('../header_func')
4
+ const { log, logMessage } = require('../logger')
5
+ const { THEME } = require('../theme')
6
+
7
+ const logStepStart = function ({ logs, event, packageName, coreStepDescription, index, error, netlifyConfig }) {
8
+ const description = getDescription({ coreStepDescription, netlifyConfig, packageName, event })
9
+ const logHeaderFunc = getLogHeaderFunc(error)
10
+ logHeaderFunc(logs, `${index + 1}. ${description}`)
11
+ logMessage(logs, '')
12
+ }
13
+
14
+ const getDescription = function ({ coreStepDescription, netlifyConfig, packageName, event }) {
15
+ return coreStepDescription === undefined
16
+ ? `${event} step from ${packageName}`
17
+ : coreStepDescription({ netlifyConfig })
18
+ }
19
+
20
+ const logBuildCommandStart = function (logs, buildCommand) {
21
+ log(logs, THEME.highlightWords(`$ ${buildCommand}`))
22
+ }
23
+
24
+ const logStepSuccess = function (logs) {
25
+ logMessage(logs, '')
26
+ }
27
+
28
+ module.exports = {
29
+ logStepStart,
30
+ logBuildCommandStart,
31
+ logStepSuccess,
32
+ }
package/src/log/stream.js CHANGED
@@ -36,7 +36,7 @@ const pushBuildCommandOutput = function (output, logsArray) {
36
36
  logsArray.push(output)
37
37
  }
38
38
 
39
- // Start plugin command output
39
+ // Start plugin step output
40
40
  const pipePluginOutput = function (childProcess, logs) {
41
41
  if (logs === undefined) {
42
42
  return streamOutput(childProcess)
@@ -45,7 +45,7 @@ const pipePluginOutput = function (childProcess, logs) {
45
45
  return pushOutputToLogs(childProcess, logs)
46
46
  }
47
47
 
48
- // Stop streaming/buffering plugin command output
48
+ // Stop streaming/buffering plugin step output
49
49
  const unpipePluginOutput = async function (childProcess, logs, listeners) {
50
50
  // Let `childProcess` `stdout` and `stderr` flush before stopping redirecting
51
51
  await pSetTimeout(0)
@@ -7,21 +7,21 @@ const { validatePlugin } = require('./validate')
7
7
  // This also requires the plugin file and fire its top-level function.
8
8
  // This also validates the plugin.
9
9
  // Do it when parent requests it using the `load` event.
10
- // Also figure out the list of plugin commands. This is also passed to the parent.
10
+ // Also figure out the list of plugin steps. This is also passed to the parent.
11
11
  const load = function ({ pluginPath, inputs, packageJson }) {
12
12
  const logic = getLogic({ pluginPath, inputs })
13
13
 
14
14
  validatePlugin(logic)
15
15
 
16
- const pluginCommands = getPluginCommands(logic)
16
+ const pluginSteps = getPluginSteps(logic)
17
17
 
18
18
  // Context passed to every event handler
19
- const context = { pluginCommands, inputs, packageJson }
19
+ const context = { pluginSteps, inputs, packageJson }
20
20
 
21
- return { pluginCommands, context }
21
+ return { pluginSteps, context }
22
22
  }
23
23
 
24
- const getPluginCommands = function (logic) {
24
+ const getPluginSteps = function (logic) {
25
25
  return Object.entries(logic)
26
26
  .filter(isEventHandler)
27
27
  .map(([event, method]) => ({ event, method }))
@@ -8,9 +8,9 @@ const { getUtils } = require('./utils')
8
8
  // Run a specific plugin event handler
9
9
  const run = async function (
10
10
  { event, error, constants, envChanges, netlifyConfig },
11
- { pluginCommands, inputs, packageJson },
11
+ { pluginSteps, inputs, packageJson },
12
12
  ) {
13
- const { method } = pluginCommands.find((pluginCommand) => pluginCommand.event === event)
13
+ const { method } = pluginSteps.find((pluginStep) => pluginStep.event === event)
14
14
  const runState = {}
15
15
  const utils = getUtils({ event, constants, runState })
16
16
  const netlifyConfigCopy = cloneNetlifyConfig(netlifyConfig)
@@ -6,28 +6,28 @@ const { measureDuration } = require('../time/main')
6
6
 
7
7
  const { callChild } = require('./ipc')
8
8
 
9
- // Retrieve all plugins commands
9
+ // Retrieve all plugins steps
10
10
  // Can use either a module name or a file path to the plugin.
11
11
  const loadPlugins = async function ({ pluginsOptions, childProcesses, packageJson, timers, debug }) {
12
12
  return pluginsOptions.length === 0
13
- ? { pluginsCommands: [], timers }
13
+ ? { pluginsSteps: [], timers }
14
14
  : await loadAllPlugins({ pluginsOptions, childProcesses, packageJson, timers, debug })
15
15
  }
16
16
 
17
17
  const tLoadAllPlugins = async function ({ pluginsOptions, childProcesses, packageJson, debug }) {
18
- const pluginsCommands = await Promise.all(
18
+ const pluginsSteps = await Promise.all(
19
19
  pluginsOptions.map((pluginOptions, index) =>
20
20
  loadPlugin(pluginOptions, { childProcesses, index, packageJson, debug }),
21
21
  ),
22
22
  )
23
- const pluginsCommandsA = pluginsCommands.flat()
24
- return { pluginsCommands: pluginsCommandsA }
23
+ const pluginsStepsA = pluginsSteps.flat()
24
+ return { pluginsSteps: pluginsStepsA }
25
25
  }
26
26
 
27
27
  // Only performed if there are some plugins
28
28
  const loadAllPlugins = measureDuration(tLoadAllPlugins, 'load_plugins')
29
29
 
30
- // Retrieve plugin commands for one plugin.
30
+ // Retrieve plugin steps for one plugin.
31
31
  // Do it by executing the plugin `load` event handler.
32
32
  const loadPlugin = async function (
33
33
  { packageName, pluginPackageJson, pluginPackageJson: { version } = {}, pluginPath, inputs, loadedFrom, origin },
@@ -37,8 +37,8 @@ const loadPlugin = async function (
37
37
  const loadEvent = 'load'
38
38
 
39
39
  try {
40
- const { pluginCommands } = await callChild(childProcess, 'load', { pluginPath, inputs, packageJson })
41
- const pluginCommandsA = pluginCommands.map(({ event }) => ({
40
+ const { pluginSteps } = await callChild(childProcess, 'load', { pluginPath, inputs, packageJson })
41
+ const pluginStepsA = pluginSteps.map(({ event }) => ({
42
42
  event,
43
43
  packageName,
44
44
  loadedFrom,
@@ -46,7 +46,7 @@ const loadPlugin = async function (
46
46
  pluginPackageJson,
47
47
  childProcess,
48
48
  }))
49
- return pluginCommandsA
49
+ return pluginStepsA
50
50
  } catch (error) {
51
51
  addErrorInfo(error, {
52
52
  plugin: { packageName, pluginPackageJson },
@@ -6,11 +6,11 @@ const execa = require('execa')
6
6
 
7
7
  const { addErrorInfo } = require('../error/info')
8
8
  const { getBuildCommandDescription } = require('../log/description')
9
- const { logBuildCommandStart } = require('../log/messages/commands')
9
+ const { logBuildCommandStart } = require('../log/messages/steps')
10
10
  const { getBuildCommandStdio, handleBuildCommandOutput } = require('../log/stream')
11
11
 
12
12
  // Fire `build.command`
13
- const coreCommand = async function ({
13
+ const coreStep = async function ({
14
14
  configPath,
15
15
  buildDir,
16
16
  nodePath,
@@ -51,7 +51,7 @@ const coreCommand = async function ({
51
51
  // We use Bash on Unix and `cmd.exe` on Windows
52
52
  const SHELL = platform === 'win32' ? true : 'bash'
53
53
 
54
- const coreCommandDescription = function ({
54
+ const coreStepDescription = function ({
55
55
  netlifyConfig: {
56
56
  build: { commandOrigin: buildCommandOrigin },
57
57
  },
@@ -69,10 +69,10 @@ const hasBuildCommand = function ({
69
69
 
70
70
  const buildCommandCore = {
71
71
  event: 'onBuild',
72
- coreCommand,
73
- coreCommandId: 'build_command',
74
- coreCommandName: 'build.command',
75
- coreCommandDescription,
72
+ coreStep,
73
+ coreStepId: 'build_command',
74
+ coreStepName: 'build.command',
75
+ coreStepDescription,
76
76
  condition: hasBuildCommand,
77
77
  }
78
78
 
@@ -88,9 +88,7 @@ const getDeployDir = function ({ buildDir, repositoryRoot, constants: { PUBLISH_
88
88
  const handleDeployError = function (error, errorType) {
89
89
  const errorA = new Error(`Deploy did not succeed: ${error}`)
90
90
  const errorInfo =
91
- errorType === 'user'
92
- ? { type: 'resolveConfig' }
93
- : { type: 'coreCommand', location: { coreCommandName: 'Deploy site' } }
91
+ errorType === 'user' ? { type: 'resolveConfig' } : { type: 'coreStep', location: { coreStepName: 'Deploy site' } }
94
92
  addErrorInfo(errorA, errorInfo)
95
93
  throw errorA
96
94
  }
@@ -10,7 +10,7 @@ const {
10
10
  deploySiteWithBuildbotClient,
11
11
  } = require('./buildbot_client')
12
12
 
13
- const coreCommand = async function ({
13
+ const coreStep = async function ({
14
14
  buildDir,
15
15
  configPath,
16
16
  repositoryRoot,
@@ -67,10 +67,10 @@ const shouldDeploy = function ({ buildbotServerSocket }) {
67
67
 
68
68
  const deploySite = {
69
69
  event: 'onPostBuild',
70
- coreCommand,
71
- coreCommandId: 'deploy_site',
72
- coreCommandName: 'Deploy site',
73
- coreCommandDescription: () => 'Deploy site',
70
+ coreStep,
71
+ coreStepId: 'deploy_site',
72
+ coreStepName: 'Deploy site',
73
+ coreStepDescription: () => 'Deploy site',
74
74
  condition: shouldDeploy,
75
75
  }
76
76
 
@@ -8,11 +8,7 @@ const mapObject = require('map-obj')
8
8
  const pathExists = require('path-exists')
9
9
 
10
10
  const { log } = require('../../log/logger')
11
- const {
12
- logBundleResults,
13
- logFunctionsNonExistingDir,
14
- logFunctionsToBundle,
15
- } = require('../../log/messages/core_commands')
11
+ const { logBundleResults, logFunctionsNonExistingDir, logFunctionsToBundle } = require('../../log/messages/core_steps')
16
12
 
17
13
  const { getZipError } = require('./error')
18
14
  const { getUserAndInternalFunctions, validateFunctionsSrc } = require('./utils')
@@ -52,6 +48,7 @@ const getZisiParameters = ({ buildDir, featureFlags, functionsConfig, functionsD
52
48
  normalizeFunctionConfig({ buildDir, featureFlags, functionConfig: object, isRunningLocally }),
53
49
  ])
54
50
  const zisiFeatureFlags = {
51
+ buildGoSource: featureFlags.buildbot_build_go_functions,
55
52
  defaultEsModulesToEsbuild: featureFlags.buildbot_es_modules_esbuild,
56
53
  parseWithEsbuild: featureFlags.buildbot_zisi_esbuild_parser,
57
54
  }
@@ -89,7 +86,7 @@ const zipFunctionsAndLogResults = async ({
89
86
 
90
87
  // Plugin to package Netlify functions with @netlify/zip-it-and-ship-it
91
88
  // eslint-disable-next-line complexity
92
- const coreCommand = async function ({
89
+ const coreStep = async function ({
93
90
  constants: {
94
91
  INTERNAL_FUNCTIONS_SRC: relativeInternalFunctionsSrc,
95
92
  IS_LOCAL: isRunningLocally,
@@ -152,7 +149,7 @@ const coreCommand = async function ({
152
149
  }
153
150
  }
154
151
 
155
- // We run this core command if at least one of the functions directories (the
152
+ // We run this core step if at least one of the functions directories (the
156
153
  // one configured by the user or the internal one) exists. We use a dynamic
157
154
  // `condition` because the directories might be created by the build command
158
155
  // or plugins.
@@ -170,10 +167,10 @@ const hasFunctionsDirectories = async function ({ buildDir, constants: { INTERNA
170
167
 
171
168
  const bundleFunctions = {
172
169
  event: 'onBuild',
173
- coreCommand,
174
- coreCommandId: 'functions_bundling',
175
- coreCommandName: 'Functions bundling',
176
- coreCommandDescription: () => 'Functions bundling',
170
+ coreStep,
171
+ coreStepId: 'functions_bundling',
172
+ coreStepName: 'Functions bundling',
173
+ coreStepDescription: () => 'Functions bundling',
177
174
  condition: hasFunctionsDirectories,
178
175
  }
179
176
 
@@ -4,19 +4,17 @@ const { runsOnlyOnBuildFailure } = require('../plugins/events')
4
4
 
5
5
  // The last event handler of a plugin (except for `onError` and `onEnd`)
6
6
  // defaults to `utils.status.show({ state: 'success' })` without any `summary`.
7
- const getSuccessStatus = function (newStatus, { commands, event, packageName }) {
8
- if (newStatus === undefined && isLastNonErrorCommand({ commands, event, packageName })) {
7
+ const getSuccessStatus = function (newStatus, { steps, event, packageName }) {
8
+ if (newStatus === undefined && isLastNonErrorStep({ steps, event, packageName })) {
9
9
  return IMPLICIT_STATUS
10
10
  }
11
11
 
12
12
  return newStatus
13
13
  }
14
14
 
15
- const isLastNonErrorCommand = function ({ commands, event, packageName }) {
16
- const nonErrorCommands = commands.filter(
17
- (command) => command.packageName === packageName && !runsOnlyOnBuildFailure(command.event),
18
- )
19
- return nonErrorCommands.length === 0 || nonErrorCommands[nonErrorCommands.length - 1].event === event
15
+ const isLastNonErrorStep = function ({ steps, event, packageName }) {
16
+ const nonErrorSteps = steps.filter((step) => step.packageName === packageName && !runsOnlyOnBuildFailure(step.event))
17
+ return nonErrorSteps.length === 0 || nonErrorSteps[nonErrorSteps.length - 1].event === event
20
18
  }
21
19
 
22
20
  const IMPLICIT_STATUS = { state: 'success', implicit: true }
@@ -5,10 +5,10 @@ const { addErrorInfo, isBuildError } = require('../error/info')
5
5
 
6
6
  const { updateNetlifyConfig, listConfigSideFiles } = require('./update_config')
7
7
 
8
- // Fire a core command
9
- const fireCoreCommand = async function ({
10
- coreCommand,
11
- coreCommandName,
8
+ // Fire a core step
9
+ const fireCoreStep = async function ({
10
+ coreStep,
11
+ coreStepName,
12
12
  configPath,
13
13
  buildDir,
14
14
  repositoryRoot,
@@ -38,7 +38,7 @@ const fireCoreCommand = async function ({
38
38
  newEnvChanges = {},
39
39
  configMutations: newConfigMutations = [],
40
40
  tags,
41
- } = await coreCommand({
41
+ } = await coreStep({
42
42
  configPath,
43
43
  buildDir,
44
44
  repositoryRoot,
@@ -85,10 +85,10 @@ const fireCoreCommand = async function ({
85
85
  }
86
86
  } catch (newError) {
87
87
  if (!isBuildError(newError)) {
88
- addErrorInfo(newError, { type: 'coreCommand', location: { coreCommandName } })
88
+ addErrorInfo(newError, { type: 'coreStep', location: { coreStepName } })
89
89
  }
90
90
  return { newError }
91
91
  }
92
92
  }
93
93
 
94
- module.exports = { fireCoreCommand }
94
+ module.exports = { fireCoreStep }
@@ -13,7 +13,7 @@ const { isSoftFailEvent } = require('../plugins/events')
13
13
  // stop, but are still reported, and prevent future events from the same
14
14
  // plugin.
15
15
  // This also computes error statuses that are sent to the API.
16
- const handleCommandError = function ({
16
+ const handleStepError = function ({
17
17
  event,
18
18
  newError,
19
19
  childEnv,
@@ -21,14 +21,14 @@ const handleCommandError = function ({
21
21
  api,
22
22
  errorMonitor,
23
23
  deployId,
24
- coreCommand,
24
+ coreStep,
25
25
  netlifyConfig,
26
26
  logs,
27
27
  debug,
28
28
  testOpts,
29
29
  }) {
30
- // Core commands do not report error statuses
31
- if (coreCommand !== undefined) {
30
+ // Core steps do not report error statuses
31
+ if (coreStep !== undefined) {
32
32
  return { newError }
33
33
  }
34
34
 
@@ -103,4 +103,4 @@ const isCorePluginBug = function (error, loadedFrom) {
103
103
  return severity === 'warning' && loadedFrom === 'core'
104
104
  }
105
105
 
106
- module.exports = { handleCommandError, getPluginErrorType }
106
+ module.exports = { handleStepError, getPluginErrorType }
@@ -0,0 +1,35 @@
1
+ 'use strict'
2
+
3
+ const { EVENTS } = require('../plugins/events')
4
+ const { buildCommandCore } = require('../plugins_core/build_command')
5
+ const { deploySite } = require('../plugins_core/deploy')
6
+ const { bundleFunctions } = require('../plugins_core/functions')
7
+
8
+ // Get all build steps
9
+ const getSteps = function (steps) {
10
+ const stepsA = addCoreSteps(steps)
11
+ const stepsB = sortSteps(stepsA)
12
+ const events = getEvents(stepsB)
13
+ return { steps: stepsB, events }
14
+ }
15
+
16
+ const addCoreSteps = function (steps) {
17
+ return [buildCommandCore, ...steps, bundleFunctions, deploySite]
18
+ }
19
+
20
+ // Sort plugin steps by event order.
21
+ const sortSteps = function (steps) {
22
+ return EVENTS.flatMap((event) => steps.filter((step) => step.event === event))
23
+ }
24
+
25
+ // Retrieve list of unique events
26
+ const getEvents = function (steps) {
27
+ const events = steps.map(getEvent)
28
+ return [...new Set(events)]
29
+ }
30
+
31
+ const getEvent = function ({ event }) {
32
+ return event
33
+ }
34
+
35
+ module.exports = { getSteps }
@@ -8,8 +8,8 @@ const { getSuccessStatus } = require('../status/success')
8
8
  const { getPluginErrorType } = require('./error')
9
9
  const { updateNetlifyConfig, listConfigSideFiles } = require('./update_config')
10
10
 
11
- // Fire a plugin command
12
- const firePluginCommand = async function ({
11
+ // Fire a plugin step
12
+ const firePluginStep = async function ({
13
13
  event,
14
14
  childProcess,
15
15
  packageName,
@@ -24,7 +24,7 @@ const firePluginCommand = async function ({
24
24
  headersPath,
25
25
  redirectsPath,
26
26
  constants,
27
- commands,
27
+ steps,
28
28
  error,
29
29
  logs,
30
30
  debug,
@@ -61,7 +61,7 @@ const firePluginCommand = async function ({
61
61
  logs,
62
62
  debug,
63
63
  })
64
- const newStatus = getSuccessStatus(status, { commands, event, packageName })
64
+ const newStatus = getSuccessStatus(status, { steps, event, packageName })
65
65
  return {
66
66
  newEnvChanges,
67
67
  netlifyConfig: netlifyConfigA,
@@ -83,4 +83,4 @@ const firePluginCommand = async function ({
83
83
  }
84
84
  }
85
85
 
86
- module.exports = { firePluginCommand }
86
+ module.exports = { firePluginStep }
@@ -1,19 +1,19 @@
1
1
  'use strict'
2
2
 
3
- const { logCommandSuccess } = require('../log/messages/commands')
4
3
  const { logTimer } = require('../log/messages/core')
4
+ const { logStepSuccess } = require('../log/messages/steps')
5
5
 
6
- const { handleCommandError } = require('./error')
6
+ const { handleStepError } = require('./error')
7
7
 
8
- // Retrieve the return value of a build command or plugin event handler
9
- const getCommandReturn = function ({
8
+ // Retrieve the return value of a step
9
+ const getStepReturn = function ({
10
10
  event,
11
11
  packageName,
12
12
  newError,
13
13
  newEnvChanges,
14
14
  newStatus,
15
- coreCommand,
16
- coreCommandName: timerName = `${packageName} ${event}`,
15
+ coreStep,
16
+ coreStepName: timerName = `${packageName} ${event}`,
17
17
  childEnv,
18
18
  mode,
19
19
  api,
@@ -30,7 +30,7 @@ const getCommandReturn = function ({
30
30
  testOpts,
31
31
  }) {
32
32
  if (newError !== undefined) {
33
- return handleCommandError({
33
+ return handleStepError({
34
34
  event,
35
35
  newError,
36
36
  childEnv,
@@ -38,7 +38,7 @@ const getCommandReturn = function ({
38
38
  api,
39
39
  errorMonitor,
40
40
  deployId,
41
- coreCommand,
41
+ coreStep,
42
42
  netlifyConfig,
43
43
  logs,
44
44
  debug,
@@ -46,11 +46,11 @@ const getCommandReturn = function ({
46
46
  })
47
47
  }
48
48
 
49
- logCommandSuccess(logs)
49
+ logStepSuccess(logs)
50
50
 
51
51
  logTimer(logs, durationNs, timerName)
52
52
 
53
53
  return { newEnvChanges, netlifyConfig, configMutations, headersPath, redirectsPath, newStatus, timers }
54
54
  }
55
55
 
56
- module.exports = { getCommandReturn }
56
+ module.exports = { getStepReturn }
@@ -2,23 +2,23 @@
2
2
  'use strict'
3
3
 
4
4
  const { addMutableConstants } = require('../core/constants')
5
- const { logCommand } = require('../log/messages/commands')
5
+ const { logStepStart } = require('../log/messages/steps')
6
6
  const { runsAlsoOnBuildFailure, runsOnlyOnBuildFailure } = require('../plugins/events')
7
7
  const { measureDuration, normalizeTimerName } = require('../time/main')
8
8
 
9
- const { fireCoreCommand } = require('./core_command')
10
- const { firePluginCommand } = require('./plugin')
11
- const { getCommandReturn } = require('./return')
9
+ const { fireCoreStep } = require('./core_step')
10
+ const { firePluginStep } = require('./plugin')
11
+ const { getStepReturn } = require('./return')
12
12
 
13
- // Run a command (shell or plugin)
14
- const runCommand = async function ({
13
+ // Run a step (core, build command or plugin)
14
+ const runStep = async function ({
15
15
  event,
16
16
  childProcess,
17
17
  packageName,
18
- coreCommand,
19
- coreCommandId,
20
- coreCommandName,
21
- coreCommandDescription,
18
+ coreStep,
19
+ coreStepId,
20
+ coreStepName,
21
+ coreStepDescription,
22
22
  pluginPackageJson,
23
23
  loadedFrom,
24
24
  origin,
@@ -33,7 +33,7 @@ const runCommand = async function ({
33
33
  branch,
34
34
  envChanges,
35
35
  constants,
36
- commands,
36
+ steps,
37
37
  buildbotServerSocket,
38
38
  events,
39
39
  mode,
@@ -58,7 +58,7 @@ const runCommand = async function ({
58
58
  const constantsA = await addMutableConstants({ constants, buildDir, netlifyConfig })
59
59
 
60
60
  if (
61
- !(await shouldRunCommand({
61
+ !(await shouldRunStep({
62
62
  event,
63
63
  packageName,
64
64
  error,
@@ -73,9 +73,9 @@ const runCommand = async function ({
73
73
  return {}
74
74
  }
75
75
 
76
- logCommand({ logs, event, packageName, coreCommandDescription, index, error, netlifyConfig })
76
+ logStepStart({ logs, event, packageName, coreStepDescription, index, error, netlifyConfig })
77
77
 
78
- const fireCommand = getFireCommand(packageName, coreCommandId, event)
78
+ const fireStep = getFireStep(packageName, coreStepId, event)
79
79
  const {
80
80
  newEnvChanges,
81
81
  netlifyConfig: netlifyConfigA = netlifyConfig,
@@ -86,15 +86,15 @@ const runCommand = async function ({
86
86
  newStatus,
87
87
  timers: timersA,
88
88
  durationNs,
89
- } = await fireCommand({
89
+ } = await fireStep({
90
90
  event,
91
91
  childProcess,
92
92
  packageName,
93
93
  pluginPackageJson,
94
94
  loadedFrom,
95
95
  origin,
96
- coreCommand,
97
- coreCommandName,
96
+ coreStep,
97
+ coreStepName,
98
98
  configPath,
99
99
  buildDir,
100
100
  repositoryRoot,
@@ -104,7 +104,7 @@ const runCommand = async function ({
104
104
  branch,
105
105
  envChanges,
106
106
  constants: constantsA,
107
- commands,
107
+ steps,
108
108
  buildbotServerSocket,
109
109
  events,
110
110
  error,
@@ -121,14 +121,14 @@ const runCommand = async function ({
121
121
  featureFlags,
122
122
  })
123
123
 
124
- const newValues = await getCommandReturn({
124
+ const newValues = await getStepReturn({
125
125
  event,
126
126
  packageName,
127
127
  newError,
128
128
  newEnvChanges,
129
129
  newStatus,
130
- coreCommand,
131
- coreCommandName,
130
+ coreStep,
131
+ coreStepName,
132
132
  childEnv,
133
133
  mode,
134
134
  api,
@@ -178,7 +178,7 @@ const runCommand = async function ({
178
178
  // or available. However, one might be created by a build plugin, in which case,
179
179
  // those core plugins should be triggered. We use a dynamic `condition()` to
180
180
  // model this behavior.
181
- const shouldRunCommand = async function ({
181
+ const shouldRunStep = async function ({
182
182
  event,
183
183
  packageName,
184
184
  error,
@@ -203,25 +203,25 @@ const shouldRunCommand = async function ({
203
203
  return !runsOnlyOnBuildFailure(event)
204
204
  }
205
205
 
206
- // Wrap command function to measure its time
207
- const getFireCommand = function (packageName, coreCommandId, event) {
208
- if (coreCommandId !== undefined) {
209
- return measureDuration(tFireCommand, coreCommandId)
206
+ // Wrap step function to measure its time
207
+ const getFireStep = function (packageName, coreStepId, event) {
208
+ if (coreStepId !== undefined) {
209
+ return measureDuration(tFireStep, coreStepId)
210
210
  }
211
211
 
212
212
  const parentTag = normalizeTimerName(packageName)
213
- return measureDuration(tFireCommand, event, { parentTag, category: 'pluginEvent' })
213
+ return measureDuration(tFireStep, event, { parentTag, category: 'pluginEvent' })
214
214
  }
215
215
 
216
- const tFireCommand = function ({
216
+ const tFireStep = function ({
217
217
  event,
218
218
  childProcess,
219
219
  packageName,
220
220
  pluginPackageJson,
221
221
  loadedFrom,
222
222
  origin,
223
- coreCommand,
224
- coreCommandName,
223
+ coreStep,
224
+ coreStepName,
225
225
  configPath,
226
226
  buildDir,
227
227
  repositoryRoot,
@@ -231,7 +231,7 @@ const tFireCommand = function ({
231
231
  branch,
232
232
  envChanges,
233
233
  constants,
234
- commands,
234
+ steps,
235
235
  buildbotServerSocket,
236
236
  events,
237
237
  error,
@@ -246,10 +246,10 @@ const tFireCommand = function ({
246
246
  redirectsPath,
247
247
  featureFlags,
248
248
  }) {
249
- if (coreCommand !== undefined) {
250
- return fireCoreCommand({
251
- coreCommand,
252
- coreCommandName,
249
+ if (coreStep !== undefined) {
250
+ return fireCoreStep({
251
+ coreStep,
252
+ coreStepName,
253
253
  configPath,
254
254
  buildDir,
255
255
  repositoryRoot,
@@ -274,7 +274,7 @@ const tFireCommand = function ({
274
274
  })
275
275
  }
276
276
 
277
- return firePluginCommand({
277
+ return firePluginStep({
278
278
  event,
279
279
  childProcess,
280
280
  packageName,
@@ -289,12 +289,12 @@ const tFireCommand = function ({
289
289
  headersPath,
290
290
  redirectsPath,
291
291
  constants,
292
- commands,
292
+ steps,
293
293
  error,
294
294
  logs,
295
295
  debug,
296
296
  })
297
297
  }
298
298
 
299
- module.exports = { runCommand }
299
+ module.exports = { runStep }
300
300
  /* eslint-enable max-lines */
@@ -6,15 +6,15 @@ const pReduce = require('p-reduce')
6
6
  const { addErrorInfo } = require('../error/info')
7
7
  const { addStatus } = require('../status/add')
8
8
 
9
- const { runCommand } = require('./run_command')
9
+ const { runStep } = require('./run_step')
10
10
 
11
- // Run all commands.
12
- // Each command can change some state: last `error`, environment variables changes,
11
+ // Run all steps.
12
+ // Each step can change some state: last `error`, environment variables changes,
13
13
  // list of `failedPlugins` (that ran `utils.build.failPlugin()`).
14
14
  // If an error arises, runs `onError` events.
15
15
  // Runs `onEnd` events at the end, whether an error was thrown or not.
16
- const runCommands = async function ({
17
- commands,
16
+ const runSteps = async function ({
17
+ steps,
18
18
  buildbotServerSocket,
19
19
  events,
20
20
  configPath,
@@ -42,7 +42,7 @@ const runCommands = async function ({
42
42
  featureFlags,
43
43
  }) {
44
44
  const {
45
- index: commandsCount,
45
+ index: stepsCount,
46
46
  error: errorA,
47
47
  netlifyConfig: netlifyConfigC,
48
48
  statuses: statusesB,
@@ -50,7 +50,7 @@ const runCommands = async function ({
50
50
  timers: timersC,
51
51
  configMutations: configMutationsB,
52
52
  } = await pReduce(
53
- commands,
53
+ steps,
54
54
  async (
55
55
  {
56
56
  index,
@@ -68,10 +68,10 @@ const runCommands = async function ({
68
68
  event,
69
69
  childProcess,
70
70
  packageName,
71
- coreCommand,
72
- coreCommandId,
73
- coreCommandName,
74
- coreCommandDescription,
71
+ coreStep,
72
+ coreStepId,
73
+ coreStepName,
74
+ coreStepDescription,
75
75
  pluginPackageJson,
76
76
  loadedFrom,
77
77
  origin,
@@ -89,14 +89,14 @@ const runCommands = async function ({
89
89
  redirectsPath: redirectsPathB = redirectsPathA,
90
90
  newStatus,
91
91
  timers: timersB = timersA,
92
- } = await runCommand({
92
+ } = await runStep({
93
93
  event,
94
94
  childProcess,
95
95
  packageName,
96
- coreCommand,
97
- coreCommandId,
98
- coreCommandName,
99
- coreCommandDescription,
96
+ coreStep,
97
+ coreStepId,
98
+ coreStepName,
99
+ coreStepDescription,
100
100
  pluginPackageJson,
101
101
  loadedFrom,
102
102
  origin,
@@ -111,7 +111,7 @@ const runCommands = async function ({
111
111
  branch,
112
112
  envChanges,
113
113
  constants,
114
- commands,
114
+ steps,
115
115
  buildbotServerSocket,
116
116
  events,
117
117
  mode,
@@ -168,7 +168,7 @@ const runCommands = async function ({
168
168
  }
169
169
 
170
170
  return {
171
- commandsCount,
171
+ stepsCount,
172
172
  netlifyConfig: netlifyConfigC,
173
173
  statuses: statusesB,
174
174
  failedPlugins: failedPluginsA,
@@ -177,5 +177,5 @@ const runCommands = async function ({
177
177
  }
178
178
  }
179
179
 
180
- module.exports = { runCommands }
180
+ module.exports = { runSteps }
181
181
  /* eslint-enable max-lines */
File without changes
@@ -21,7 +21,7 @@ const trackBuildComplete = async function ({
21
21
  deployId,
22
22
  buildId,
23
23
  status,
24
- commandsCount,
24
+ stepsCount,
25
25
  pluginsOptions,
26
26
  durationNs,
27
27
  siteInfo,
@@ -39,7 +39,7 @@ const trackBuildComplete = async function ({
39
39
  deployId,
40
40
  buildId,
41
41
  status,
42
- commandsCount,
42
+ stepsCount,
43
43
  pluginsOptions,
44
44
  durationNs,
45
45
  siteInfo,
@@ -73,7 +73,7 @@ const getPayload = function ({
73
73
  deployId,
74
74
  buildId,
75
75
  status,
76
- commandsCount,
76
+ stepsCount,
77
77
  pluginsOptions,
78
78
  durationNs,
79
79
  userNodeVersion,
@@ -88,7 +88,7 @@ const getPayload = function ({
88
88
  deployId,
89
89
  buildId,
90
90
  status,
91
- steps: commandsCount,
91
+ steps: stepsCount,
92
92
  buildVersion,
93
93
  // We're passing the node version set by the buildbot/user which will run the `build.command` and
94
94
  // the `package.json`/locally defined plugins
@@ -1,35 +0,0 @@
1
- 'use strict'
2
-
3
- const { EVENTS } = require('../plugins/events')
4
- const { buildCommandCore } = require('../plugins_core/build_command')
5
- const { deploySite } = require('../plugins_core/deploy')
6
- const { bundleFunctions } = require('../plugins_core/functions')
7
-
8
- // Get commands for all events
9
- const getCommands = function (commands) {
10
- const commandsA = addCoreCommands(commands)
11
- const commandsB = sortCommands(commandsA)
12
- const events = getEvents(commandsB)
13
- return { commands: commandsB, events }
14
- }
15
-
16
- const addCoreCommands = function (commands) {
17
- return [buildCommandCore, ...commands, bundleFunctions, deploySite]
18
- }
19
-
20
- // Sort plugin commands by event order.
21
- const sortCommands = function (commands) {
22
- return EVENTS.flatMap((event) => commands.filter((command) => command.event === event))
23
- }
24
-
25
- // Retrieve list of unique events
26
- const getEvents = function (commands) {
27
- const events = commands.map(getEvent)
28
- return [...new Set(events)]
29
- }
30
-
31
- const getEvent = function ({ event }) {
32
- return event
33
- }
34
-
35
- module.exports = { getCommands }
@@ -1,32 +0,0 @@
1
- 'use strict'
2
-
3
- const { getLogHeaderFunc } = require('../header_func')
4
- const { log, logMessage } = require('../logger')
5
- const { THEME } = require('../theme')
6
-
7
- const logCommand = function ({ logs, event, packageName, coreCommandDescription, index, error, netlifyConfig }) {
8
- const description = getDescription({ coreCommandDescription, netlifyConfig, packageName, event })
9
- const logHeaderFunc = getLogHeaderFunc(error)
10
- logHeaderFunc(logs, `${index + 1}. ${description}`)
11
- logMessage(logs, '')
12
- }
13
-
14
- const getDescription = function ({ coreCommandDescription, netlifyConfig, packageName, event }) {
15
- return coreCommandDescription === undefined
16
- ? `${event} command from ${packageName}`
17
- : coreCommandDescription({ netlifyConfig })
18
- }
19
-
20
- const logBuildCommandStart = function (logs, buildCommand) {
21
- log(logs, THEME.highlightWords(`$ ${buildCommand}`))
22
- }
23
-
24
- const logCommandSuccess = function (logs) {
25
- logMessage(logs, '')
26
- }
27
-
28
- module.exports = {
29
- logCommand,
30
- logBuildCommandStart,
31
- logCommandSuccess,
32
- }