Skip to content
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
17 changes: 11 additions & 6 deletions src/google-maps/schematics/ng-update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ const DEPRECATED_CLASS_NAME = 'DeprecatedMapMarkerClusterer';
export function updateToV19(): Rule {
return tree => {
tree.visit(path => {
if (path.includes('node_modules')) {
return;
}

if (path.endsWith('.html')) {
const content = tree.readText(path);
const content = tree.read(path)?.toString();

if (content.includes('<' + TAG_NAME)) {
if (content && content.includes('<' + TAG_NAME)) {
tree.overwrite(path, migrateHtml(content));
}
} else if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
Expand All @@ -48,13 +52,14 @@ function migrateHtml(content: string): string {

/** Migrates a TypeScript file from the old tag and class names to the new ones. */
function migrateTypeScript(path: Path, tree: Tree) {
const content = tree.readText(path);
const content = tree.read(path)?.toString();

// Exit early if none of the symbols we're looking for are mentioned.
if (
!content.includes('<' + TAG_NAME) &&
!content.includes(MODULE_NAME) &&
!content.includes(CLASS_NAME)
!content ||
(!content.includes('<' + TAG_NAME) &&
!content.includes(MODULE_NAME) &&
!content.includes(CLASS_NAME))
) {
return;
}
Expand Down
Loading