Skip to content

Commit

Permalink
fix(core): normalize path in tree when accessing recorded changes (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez authored May 15, 2023
1 parent 428b0c9 commit 9b4ba3a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/nx/src/generators/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,11 @@ export class FsTree implements Tree {
isDeleted: true,
};

// Delete directories when
if (this.children(dirname(this.rp(filePath))).length < 1) {
// Delete directory when is not root and there are no children
if (
filePath !== '' &&
this.children(dirname(this.rp(filePath))).length < 1
) {
this.delete(dirname(this.rp(filePath)));
}
}
Expand Down Expand Up @@ -282,7 +285,7 @@ export class FsTree implements Tree {

res = [...res, ...this.directChildrenOfDir(this.rp(dirPath))];
res = res.filter((q) => {
const r = this.recordedChanges[join(this.rp(dirPath), q)];
const r = this.recordedChanges[this.normalize(join(this.rp(dirPath), q))];
return !r?.isDeleted;
});
// Dedupe
Expand Down

1 comment on commit 9b4ba3a

@vercel
Copy link

@vercel vercel bot commented on 9b4ba3a May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.