Skip to content

Commit

Permalink
fix(core): normalize paths in ng cli adapter when finding matching fi…
Browse files Browse the repository at this point in the history
…les (#10113)
  • Loading branch information
leosvelperez committed May 3, 2022
1 parent c1213b6 commit cfe21b2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/nx/src/adapter/ngcli-adapter.ts
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

1 comment on commit cfe21b2

@vercel
Copy link

@vercel vercel bot commented on cfe21b2 May 3, 2022

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
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app

Please sign in to comment.