Skip to content

Commit

Permalink
fix(core): handle removed npm package for affected logic
Browse files Browse the repository at this point in the history
Closes #2274
  • Loading branch information
jaysoo authored and vsavkin committed Jan 14, 2020
1 parent 0b77072 commit b96dd1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NxJson } from '../../shared-interfaces';
import { WholeFileChange } from '../..//file-utils';
import { DiffType } from '../../../utils/json-diff';

describe('getImplicitlyTouchedProjectsByJsonChanges', () => {
describe('getTouchedNpmPackages', () => {
let workspaceJson;
let nxJson: NxJson<string[]>;
beforeEach(() => {
Expand Down Expand Up @@ -45,6 +45,15 @@ describe('getImplicitlyTouchedProjectsByJsonChanges', () => {
lhs: '0.0.1',
rhs: '0.0.2'
}
},
// If it's deleted then it should not exist in project graph.
{
type: DiffType.Deleted,
path: ['dependencies', 'sad-nrwl'],
value: {
lhs: '0.0.1',
rhs: undefined
}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const getTouchedNpmPackages: TouchedProjectLocator<
changes.forEach(c => {
if (
isJsonChange(c) &&
(c.path[0] === 'dependencies' || c.path[0] === 'devDependencies')
(c.path[0] === 'dependencies' || c.path[0] === 'devDependencies') &&
c.value.rhs // If rhs is blank then dep was deleted and does not exist in project graph
) {
touched.push(c.path[1]);
} else if (isWholeFileChange(c)) {
Expand Down

0 comments on commit b96dd1f

Please sign in to comment.