Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 18 additions & 39 deletions packages/build/src/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,25 @@ const getDefaultFlags = function({ env: envOpt = {} }) {
const DEFAULT_FUNCTIONS_DIST = '.netlify/functions/'

// Retrieve configuration object
const loadConfig = async function(
{
config,
defaultConfig,
cachedConfig,
cwd,
repositoryRoot,
dry,
nodePath,
functionsDistDir,
token,
siteId,
deployId,
context,
branch,
baseRelDir,
env: envOpt,
telemetry,
mode,
buildImagePluginsDir,
debug,
},
const loadConfig = async function({
config,
defaultConfig,
cachedConfig,
cwd,
repositoryRoot,
functionsDistDir,
token,
siteId,
context,
branch,
baseRelDir,
env: envOpt,
debug,
mode,
deployId,
logs,
testOpts,
) {
}) {
const {
configPath,
buildDir,
Expand Down Expand Up @@ -100,22 +94,7 @@ const loadConfig = async function(
getPackageJson(buildDir, { normalize: false }),
])

return {
netlifyConfig,
configPath,
buildDir,
nodePath,
childEnv,
sitePackageJson,
api: apiA,
dry,
siteInfo,
deployId,
constants,
telemetry,
mode,
buildImagePluginsDir,
}
return { netlifyConfig, configPath, buildDir, childEnv, sitePackageJson, api: apiA, siteInfo, constants }
}

const logConfigInfo = function({ logs, configPath, buildDir, netlifyConfig, context, debug }) {
Expand Down
26 changes: 16 additions & 10 deletions packages/build/src/core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,31 @@ const { doDryRun } = require('./dry')
* @returns {string[]} buildResult.logs - When using the `buffer` option, all log messages
*/
const build = async function(flags = {}) {
const { flags: flagsA, errorMonitor, logs, testOpts, buildTimer } = startBuild(flags)
const {
nodePath,
buildImagePluginsDir,
dry,
mode,
deployId,
telemetry,
testOpts,
errorMonitor,
logs,
buildTimer,
...flagsA
} = startBuild(flags)

try {
const {
netlifyConfig,
configPath,
buildDir,
nodePath,
childEnv,
sitePackageJson,
api,
dry,
siteInfo,
deployId,
constants,
telemetry,
mode,
buildImagePluginsDir,
} = await loadConfig(flagsA, logs, testOpts)
} = await loadConfig({ ...flagsA, mode, deployId, logs, testOpts })

try {
const { commandsCount } = await runAndReportBuild({
Expand Down Expand Up @@ -115,9 +121,9 @@ const startBuild = function(flags) {
const logs = getBufferLogs(flags)
logBuildStart(logs)

const { testOpts, bugsnagKey, ...flagsA } = normalizeFlags(flags, logs)
const { bugsnagKey, ...flagsA } = normalizeFlags(flags, logs)
const errorMonitor = startErrorMonitor({ flags: flagsA, logs, bugsnagKey })
return { flags: flagsA, errorMonitor, logs, testOpts, buildTimer }
return { ...flagsA, errorMonitor, logs, buildTimer }
}

// Runs a build then report any plugin statuses
Expand Down