Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/fix-withnx
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdoan committed Aug 9, 2024
2 parents 0c0a88c + 7c8bd7c commit e4611e5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/nx/src/project-graph/utils/project-configuration-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,12 @@ function normalizeTargets(
const projectSourceMaps = sourceMaps[project.root];

const targetConfig = project.targets[targetName];
const targetDefaults = readTargetDefaultsForTarget(
targetName,
nxJsonConfiguration.targetDefaults,
targetConfig.executor
const targetDefaults = deepClone(
readTargetDefaultsForTarget(
targetName,
nxJsonConfiguration.targetDefaults,
targetConfig.executor
)
);

// We only apply defaults if they exist
Expand Down Expand Up @@ -718,14 +720,18 @@ function targetDefaultShouldBeApplied(
return !plugin?.startsWith('nx/');
}

function deepClone(obj) {
return JSON.parse(JSON.stringify(obj));
}

export function mergeTargetDefaultWithTargetDefinition(
targetName: string,
project: ProjectConfiguration,
targetDefault: Partial<TargetConfiguration>,
sourceMap: Record<string, SourceInformation>
): TargetConfiguration {
const targetDefinition = project.targets[targetName] ?? {};
const result = JSON.parse(JSON.stringify(targetDefinition));
const result = deepClone(targetDefinition);

for (const key in targetDefault) {
switch (key) {
Expand Down

0 comments on commit e4611e5

Please sign in to comment.