-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): projects w/ similar names should not be picked up as affected by change to one project. Closes #125 Signed-off-by: AgentEnder <craigorycoppola@gmail.com> Co-authored-by: Pedro Rodrigues <4513618+pemsbr@users.noreply.github.com>
- Loading branch information
1 parent
73d6dd9
commit 7a3c5e9
Showing
4 changed files
with
36 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
import { readJson } from 'fs-extra'; | ||
import { readJson, remove } from 'fs-extra'; | ||
import { join } from 'path'; | ||
import { execSync } from 'child_process'; | ||
|
||
export async function readDependenciesFromNxCache( | ||
export async function readDependenciesFromNxDepGraph( | ||
workspaceRoot: string, | ||
project: string, | ||
) { | ||
const depGraphCachePath = join( | ||
workspaceRoot, | ||
'node_modules/.cache/nx/nxdeps.json', | ||
); | ||
const depGraphFile = join('tmp', 'dep-graph.json'); | ||
execSync(`npx nx dep-graph --file ${depGraphFile}`, { | ||
cwd: workspaceRoot, | ||
stdio: 'inherit', | ||
}); | ||
const absolutePath = join(workspaceRoot, depGraphFile); | ||
const { graph } = await readJson(absolutePath); | ||
await remove(absolutePath); | ||
|
||
const files: Array<{ file: string; deps: string[] }> = ( | ||
await readJson(depGraphCachePath) | ||
).nodes[project].data.files; | ||
return new Set(files.flatMap((x) => x.deps)); | ||
const deps: Array<{ source: string; target: string }> = | ||
graph.dependencies[project]; | ||
console.log('[E2E]: Found dependencies', deps); | ||
return new Set(deps.map((x) => x.target)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters