Skip to content

Commit

Permalink
fix(angular): normalize path in move generator (#17877)
Browse files Browse the repository at this point in the history
(cherry picked from commit fced370)
  • Loading branch information
leosvelperez authored and FrozenPandaz committed Jun 30, 2023
1 parent 39c4f03 commit ef05a37
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/angular/src/generators/move/lib/update-module-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
getProjects,
joinPathFragments,
names,
normalizePath,
readProjectConfiguration,
Tree,
visitNotIgnoredFiles,
Expand Down Expand Up @@ -88,13 +89,14 @@ export function updateModuleName(
// Update any files which import the module
for (const [, definition] of getProjects(tree)) {
visitNotIgnoredFiles(tree, definition.root, (file) => {
// skip files that were already modified
const normalizedFile = normalizePath(file);

if (skipFiles.includes(file)) {
// skip files that were already modified
if (skipFiles.includes(normalizedFile)) {
return;
}

updateFileContent(tree, replacements, file);
updateFileContent(tree, replacements, normalizedFile);
});
}
}
Expand All @@ -105,7 +107,7 @@ function updateFileContent(
fileName: string,
newFileName?: string
): void {
let content = tree.read(fileName)?.toString('utf-8');
let content = tree.read(fileName, 'utf-8');

if (content) {
let updated = false;
Expand Down

0 comments on commit ef05a37

Please sign in to comment.