@netlify/build 27.12.4-beta → 27.13.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/src/steps/get.js CHANGED
@@ -1,4 +1,4 @@
1
- import { EVENTS } from '../plugins/events.js'
1
+ import { DEV_EVENTS, EVENTS } from '../plugins/events.js'
2
2
  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'
@@ -7,18 +7,37 @@ import { bundleFunctions } from '../plugins_core/functions/index.js'
7
7
  // Get all build steps
8
8
  export const getSteps = function (steps) {
9
9
  const stepsA = addCoreSteps(steps)
10
- const stepsB = sortSteps(stepsA)
10
+ const stepsB = sortSteps(stepsA, EVENTS)
11
11
  const events = getEvents(stepsB)
12
12
  return { steps: stepsB, events }
13
13
  }
14
14
 
15
+ // Get all dev steps
16
+ export const getDevSteps = function (command, steps) {
17
+ const devCommandStep = {
18
+ event: 'onDev',
19
+ coreStep: async () => {
20
+ await command()
21
+
22
+ return {}
23
+ },
24
+ coreStepId: 'dev_command',
25
+ coreStepName: 'dev.command',
26
+ coreStepDescription: () => 'Run command for local development',
27
+ }
28
+ const sortedSteps = sortSteps([...steps, devCommandStep], DEV_EVENTS)
29
+ const events = getEvents(sortedSteps)
30
+
31
+ return { steps: sortedSteps, events }
32
+ }
33
+
15
34
  const addCoreSteps = function (steps) {
16
35
  return [buildCommandCore, ...steps, bundleFunctions, bundleEdgeFunctions, deploySite]
17
36
  }
18
37
 
19
38
  // Sort plugin steps by event order.
20
- const sortSteps = function (steps) {
21
- return EVENTS.flatMap((event) => steps.filter((step) => step.event === event))
39
+ const sortSteps = function (steps, events) {
40
+ return events.flatMap((event) => steps.filter((step) => step.event === event))
22
41
  }
23
42
 
24
43
  // Retrieve list of unique events
@@ -5,7 +5,7 @@ import { getSeverity } from '../core/severity.js'
5
5
  import { handleBuildError } from '../error/handle.js'
6
6
  import { getErrorInfo } from '../error/info.js'
7
7
  import { startErrorMonitor } from '../error/monitor/start.js'
8
- import { getBufferLogs } from '../log/logger.js'
8
+ import { getBufferLogs, getSystemLogger } from '../log/logger.js'
9
9
  import { logBuildStart } from '../log/messages/core.js'
10
10
  import { reportStatuses } from '../status/report.js'
11
11
 
@@ -39,6 +39,7 @@ import { runSteps } from './run_steps.js'
39
39
  export const runCoreSteps = async (buildSteps, flags = {}) => {
40
40
  const { errorMonitor, mode, logs, debug, ...flagsA } = startBuild(flags)
41
41
  const errorParams = { errorMonitor, mode, logs, debug }
42
+ const systemLog = getSystemLogger(logs, debug)
42
43
 
43
44
  try {
44
45
  const { netlifyConfig: netlifyConfigA, configMutations } = await executeBuildStep({
@@ -49,6 +50,7 @@ export const runCoreSteps = async (buildSteps, flags = {}) => {
49
50
  debug,
50
51
  errorParams,
51
52
  buildSteps,
53
+ systemLog,
52
54
  })
53
55
  const { success, severityCode } = getSeverity('success')
54
56
 
@@ -93,6 +95,7 @@ const executeBuildStep = async function ({
93
95
  featureFlags,
94
96
  buildSteps,
95
97
  repositoryRoot,
98
+ systemLog,
96
99
  }) {
97
100
  const configOpts = getConfigOpts({
98
101
  config,
@@ -140,6 +143,7 @@ const executeBuildStep = async function ({
140
143
  childEnv,
141
144
  buildSteps,
142
145
  repositoryRoot: repositoryRootA,
146
+ systemLog,
143
147
  })
144
148
 
145
149
  return {
@@ -175,6 +179,7 @@ const runBuildStep = async function ({
175
179
  childEnv,
176
180
  buildSteps,
177
181
  repositoryRoot,
182
+ systemLog,
178
183
  }) {
179
184
  const { netlifyConfig: netlifyConfigA, configMutations } = await runSteps({
180
185
  steps: getBuildSteps(buildSteps),
@@ -188,6 +193,7 @@ const runBuildStep = async function ({
188
193
  featureFlags,
189
194
  childEnv,
190
195
  repositoryRoot,
196
+ systemLog,
191
197
  })
192
198
 
193
199
  return { netlifyConfig: netlifyConfigA, configMutations }
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-lines */
2
1
  import { addMutableConstants } from '../core/constants.js'
3
2
  import { logStepStart } from '../log/messages/steps.js'
4
3
  import { runsAlsoOnBuildFailure, runsOnlyOnBuildFailure } from '../plugins/events.js'
@@ -303,4 +302,3 @@ const tFireStep = function ({
303
302
  verbose,
304
303
  })
305
304
  }
306
- /* eslint-enable max-lines */
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-lines */
2
1
  import pReduce from 'p-reduce'
3
2
 
4
3
  import { addErrorInfo } from '../error/info.js'
@@ -178,4 +177,3 @@ export const runSteps = async function ({
178
177
  configMutations: configMutationsB,
179
178
  }
180
179
  }
181
- /* eslint-enable max-lines */