Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): handle undefined when package.json changes are not in node modules #13681

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -265,4 +265,32 @@ describe('getTouchedNpmPackages', () => {
'npm:awesome-nrwl',
]);
});
it('should handle workspace package.json changes when the changes are not in `npmPackages` (projectGraph.externalNodes)', () => {
expect(() => {
getTouchedNpmPackages(
[
{
file: 'package.json',
hash: 'some-hash',
getChanges: () => [
{
type: 'JsonPropertyAdded',
path: ['devDependencies', 'changed-test-pkg-name'],
value: { rhs: 'workspace:*' },
},
],
},
],
workspaceJson,
nxJson,
{
dependencies: {
'happy-nrwl': '0.0.1',
'awesome-nrwl': '0.0.1',
},
},
projectGraph
);
}).not.toThrowError();
});
});
Expand Up @@ -31,6 +31,7 @@ export const getTouchedNpmPackages: TouchedProjectLocator<
const npmPackage = npmPackages.find(
(pkg) => pkg.data.packageName === c.path[1]
);
if (!npmPackage) continue;
meeroslav marked this conversation as resolved.
Show resolved Hide resolved
touched.push(npmPackage.name);
// If it was a type declarations package then also mark its corresponding implementation package as affected
if (npmPackage.name.startsWith('npm:@types/')) {
Expand Down