Skip to content

fix(ng-update): do not throw if project does not have dependencies #18470

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -877,9 +877,8 @@ export class HammerGesturesRule extends MigrationRule<null> {

const packageJson = JSON.parse(tree.read('/package.json')!.toString('utf8'));

// We do not handle the case where someone manually added "hammerjs"
// to the dev dependencies.
if (packageJson.dependencies[HAMMER_MODULE_SPECIFIER]) {
// We do not handle the case where someone manually added "hammerjs" to the dev dependencies.
if (packageJson.dependencies && packageJson.dependencies[HAMMER_MODULE_SPECIFIER]) {
delete packageJson.dependencies[HAMMER_MODULE_SPECIFIER];
tree.overwrite('/package.json', JSON.stringify(packageJson, null, 2));
return true;
Expand Down