fix(core): shallow merge named inputs (#20040)

This commit is contained in:
Craigory Coppola 2023-11-03 16:04:40 -04:00 committed by GitHub
parent ba426a2821
commit 96dd3b5aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 0 deletions

View File

@ -490,6 +490,43 @@ describe('project-configuration-utils', () => {
}
`);
});
it('should merge namedInputs', () => {
const rootMap = new RootMapBuilder()
.addProject({
root: 'libs/lib-a',
name: 'lib-a',
namedInputs: {
production: [
'{projectRoot}/**/*.ts',
'!{projectRoot}/**/*.spec.ts',
],
test: ['{projectRoot}/**/*.spec.ts'],
},
})
.getRootMap();
mergeProjectConfigurationIntoRootMap(rootMap, {
root: 'libs/lib-a',
name: 'lib-a',
namedInputs: {
another: ['{projectRoot}/**/*.ts'],
production: ['{projectRoot}/**/*.prod.ts'],
},
});
expect(rootMap.get('libs/lib-a').namedInputs).toMatchInlineSnapshot(`
{
"another": [
"{projectRoot}/**/*.ts",
],
"production": [
"{projectRoot}/**/*.prod.ts",
],
"test": [
"{projectRoot}/**/*.spec.ts",
],
}
`);
});
});
describe('readProjectsConfigurationsFromRootMap', () => {

View File

@ -57,6 +57,13 @@ export function mergeProjectConfigurationIntoRootMap(
}
}
if (project.namedInputs && matchingProject.namedInputs) {
updatedProjectConfiguration.namedInputs = {
...matchingProject.namedInputs,
...project.namedInputs,
};
}
if (project.targets && matchingProject.targets) {
updatedProjectConfiguration.targets = {
...matchingProject.targets,