Skip to content

Commit

Permalink
fix(core): normalize paths in ng cli adapter when finding matching files
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez committed May 3, 2022
1 parent 378990b commit 6c8ae60
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/nx/src/adapter/ngcli-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,23 +737,25 @@ function findCreatedProjects(host: Tree): FileChange[] {
.listChanges()
.filter(
(f) =>
f.type === 'CREATE' &&
(basename(f.path) === 'project.json' ||
basename(f.path) === 'package.json') &&
f.type === 'CREATE'
basename(f.path) === 'package.json')
);
}

function findDeletedProjects(host: Tree): FileChange[] {
return host
.listChanges()
.filter((f) => basename(f.path) === 'project.json' && f.type === 'DELETE');
.filter((f) => f.type === 'DELETE' && basename(f.path) === 'project.json');
}

function findMatchingFileChange(host: Tree, path: Path) {
const targetPath = path.startsWith('/') ? path.substring(1) : path.toString();
const targetPath = normalize(
path.startsWith('/') ? path.substring(1) : path.toString()
);
return host
.listChanges()
.find((f) => f.path === targetPath && f.type !== 'DELETE');
.find((f) => f.type !== 'DELETE' && normalize(f.path) === targetPath);
}

function isWorkspaceConfigPath(p: Path | string) {
Expand Down

0 comments on commit 6c8ae60

Please sign in to comment.