Skip to content

Commit

Permalink
chore: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasholzer committed Jun 26, 2024
1 parent 3240ed9 commit 9347e75
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@
"lint-staged": {
"!(packages/*/tests/**/fixtures/**/*)*.+(j|t)s": "eslint --ignore-path .gitignore --cache --fix",
"*": "prettier --write --ignore-unknown"
}
},
"packageManager": "yarn@1.22.22+sha256.c17d3797fb9a9115bf375e31bfd30058cac6bc9c3b8807a3d8cb2094794b51ca"
}
7 changes: 7 additions & 0 deletions packages/build/src/core/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const tExecBuild = async function ({
} = await runAndReportBuild({
pluginsOptions,
netlifyConfig,
cachedConfig,
configOpts,
siteInfo,
configPath,
Expand Down Expand Up @@ -240,6 +241,7 @@ export const execBuild = measureDuration(tExecBuild, 'total', { parentTag: 'buil
export const runAndReportBuild = async function ({
pluginsOptions,
netlifyConfig,
cachedConfig,
configOpts,
siteInfo,
configPath,
Expand Down Expand Up @@ -295,6 +297,7 @@ export const runAndReportBuild = async function ({
} = await initAndRunBuild({
pluginsOptions,
netlifyConfig,
cachedConfig,
configOpts,
siteInfo,
configPath,
Expand Down Expand Up @@ -400,6 +403,7 @@ export const runAndReportBuild = async function ({
const initAndRunBuild = async function ({
pluginsOptions,
netlifyConfig,
cachedConfig,
configOpts,
siteInfo,
configPath,
Expand Down Expand Up @@ -508,6 +512,7 @@ const initAndRunBuild = async function ({
childProcesses,
pluginsOptions: pluginsOptionsA,
netlifyConfig,
cachedConfig,
configOpts,
packageJson,
configPath,
Expand Down Expand Up @@ -583,6 +588,7 @@ const runBuild = async function ({
childProcesses,
pluginsOptions,
netlifyConfig,
cachedConfig,
configOpts,
packageJson,
configPath,
Expand Down Expand Up @@ -671,6 +677,7 @@ const runBuild = async function ({
deployId,
errorParams,
netlifyConfig,
cachedConfig,
configOpts,
logs,
debug,
Expand Down
10 changes: 7 additions & 3 deletions packages/build/src/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@ const logConfigInfo = function ({ logs, configPath, buildDir, netlifyConfig, con
// change would create debug logs which would be too verbose.
// Errors are propagated and assigned to the specific plugin or core step
// which changed the configuration.
export const resolveUpdatedConfig = async function (configOpts, configMutations, netlifyConfig) {
export const resolveUpdatedConfig = async function (configOpts, configMutations, cachedConfig) {
try {
const resolved = await resolveConfig({ ...configOpts, configMutations, debug: false })
return mergeConfigs([resolved, { config: netlifyConfig }], { concatenateArrays: true })
return await resolveConfig({
...configOpts,
configMutations,
cachedConfig,
debug: false,
})
} catch (error) {
changeErrorType(error, 'resolveConfig', 'pluginValidation')
throw error
Expand Down
3 changes: 3 additions & 0 deletions packages/build/src/steps/core_step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const fireCoreStep = async function ({
errorParams,
configOpts,
netlifyConfig,
cachedConfig,
configMutations,
headersPath,
redirectsPath,
Expand Down Expand Up @@ -65,6 +66,7 @@ export const fireCoreStep = async function ({
branch,
childEnv: childEnvA,
netlifyConfig,
cachedConfig,
nodePath,
configMutations,
headersPath,
Expand All @@ -86,6 +88,7 @@ export const fireCoreStep = async function ({
} = await updateNetlifyConfig({
configOpts,
netlifyConfig,
cachedConfig,
headersPath,
redirectsPath,
configMutations,
Expand Down
2 changes: 2 additions & 0 deletions packages/build/src/steps/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const firePluginStep = async function ({
errorParams,
configOpts,
netlifyConfig,
cachedConfig,
configMutations,
headersPath,
redirectsPath,
Expand Down Expand Up @@ -76,6 +77,7 @@ export const firePluginStep = async function ({
} = await updateNetlifyConfig({
configOpts,
netlifyConfig,
cachedConfig,
headersPath,
packagePath,
redirectsPath,
Expand Down
3 changes: 3 additions & 0 deletions packages/build/src/steps/run_core_steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const executeBuildStep = async function ({

try {
const { netlifyConfig: netlifyConfigA, configMutations } = await runBuildStep({
cachedConfig,
netlifyConfig,
buildDir,
nodePath,
Expand Down Expand Up @@ -148,6 +149,7 @@ const executeBuildStep = async function ({
}

const runBuildStep = async function ({
cachedConfig,
netlifyConfig,
buildDir,
nodePath,
Expand All @@ -170,6 +172,7 @@ const runBuildStep = async function ({
nodePath,
constants,
netlifyConfig,
cachedConfig,
logs,
debug,
timers: [],
Expand Down
5 changes: 5 additions & 0 deletions packages/build/src/steps/run_step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const runStep = async function ({
failedPlugins,
configOpts,
netlifyConfig,
cachedConfig,
configMutations,
headersPath,
redirectsPath,
Expand Down Expand Up @@ -143,6 +144,7 @@ export const runStep = async function ({
durationNs,
metrics,
} = await fireStep({
cachedConfig,
event,
childProcess,
packageName,
Expand Down Expand Up @@ -304,6 +306,7 @@ const getFireStep = function (packageName: string, coreStepId?: string, event?:
}

const tFireStep = function ({
cachedConfig,
event,
childProcess,
packageName,
Expand Down Expand Up @@ -371,6 +374,7 @@ const tFireStep = function ({
errorParams,
configOpts,
netlifyConfig,
cachedConfig,
configMutations,
headersPath,
redirectsPath,
Expand Down Expand Up @@ -398,6 +402,7 @@ const tFireStep = function ({
errorParams,
configOpts,
netlifyConfig,
cachedConfig,
configMutations,
headersPath,
redirectsPath,
Expand Down
2 changes: 2 additions & 0 deletions packages/build/src/steps/run_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { runStep } from './run_step.js'
// If an error arises, runs `onError` events.
// Runs `onEnd` events at the end, whether an error was thrown or not.
export const runSteps = async function ({
cachedConfig,
steps,
buildbotServerSocket,
events,
Expand Down Expand Up @@ -134,6 +135,7 @@ export const runSteps = async function ({
error,
failedPlugins,
configOpts,
cachedConfig,
netlifyConfig: netlifyConfigA,
configMutations,
headersPath: headersPathA,
Expand Down
3 changes: 2 additions & 1 deletion packages/build/src/steps/update_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { logConfigMutations, systemLogConfigMutations } from '../log/messages/mu
export const updateNetlifyConfig = async function ({
configOpts,
netlifyConfig,
cachedConfig,
headersPath,
redirectsPath,
configMutations,
Expand Down Expand Up @@ -47,7 +48,7 @@ export const updateNetlifyConfig = async function ({
config: netlifyConfigA,
headersPath: headersPathA,
redirectsPath: redirectsPathA,
} = await resolveUpdatedConfig(configOpts, mergedConfigMutations, netlifyConfig)
} = await resolveUpdatedConfig(configOpts, mergedConfigMutations, cachedConfig)
logConfigOnUpdate({ logs, netlifyConfig: netlifyConfigA, debug })

errorParams.netlifyConfig = netlifyConfigA
Expand Down

0 comments on commit 9347e75

Please sign in to comment.