fix(js): handle empty objects for migration to remove deprecated buil… (#19996)

This commit is contained in:
Jason Jean 2023-11-02 12:54:30 -04:00 committed by GitHub
parent 41f276b84e
commit 61ad9c3d21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -53,6 +53,17 @@ describe('remove-deprecated-build-options', () => {
await expect(migration(tree)).resolves.not.toThrow();
});
it('should work if a target is an empty object', async () => {
addProjectConfiguration(tree, 'proj', {
root: 'proj',
targets: {
build: {},
},
});
await expect(migration(tree)).resolves.not.toThrow();
});
it('should not update community executors', async () => {
addProjectConfiguration(tree, 'proj', {
root: 'proj',

View File

@ -19,7 +19,8 @@ export default async function (tree: Tree) {
for (const target of Object.values(projectConfig.targets)) {
if (
target.executor.startsWith('@nx/') &&
target.executor?.startsWith('@nx/') &&
target.options &&
('buildableProjectDepsInPackageJsonType' in target.options ||
'updateBuildableProjectDepsInPackageJson' in target.options)
) {