Skip to content

Commit

Permalink
fix(core): use both the prune and raw graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli committed Dec 7, 2023
1 parent f35b4e8 commit bbb368e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/nx/src/command-line/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,12 @@ export async function generateGraph(
if (args.file === 'stdout') {
console.log(
JSON.stringify(
await createJsonOutput(prunedGraph, args.projects, args.targets),
await createJsonOutput(
prunedGraph,
rawGraph,
args.projects,
args.targets
),
null,
2
)
Expand Down Expand Up @@ -406,6 +411,7 @@ export async function generateGraph(
ensureDirSync(dirname(fullFilePath));

const json = await createJsonOutput(
prunedGraph,
rawGraph,
args.projects,
args.targets
Expand Down Expand Up @@ -1034,12 +1040,13 @@ interface GraphJsonResponse {
}

async function createJsonOutput(
graph: ProjectGraph,
prunedGraph: ProjectGraph,
rawGraph: ProjectGraph,
projects: string[],
targets?: string[]
): Promise<GraphJsonResponse> {
const response: GraphJsonResponse = {
graph,
graph: prunedGraph,
};

if (targets?.length) {
Expand All @@ -1050,15 +1057,15 @@ async function createJsonOutput(
);

const taskGraph = createTaskGraph(
graph,
rawGraph,
defaultDependencyConfigs,
projects,
targets,
undefined,
{}
);

const hasher = createTaskHasher(graph, readNxJson());
const hasher = createTaskHasher(rawGraph, readNxJson());
let tasks = Object.values(taskGraph.tasks);
const hashes = await hasher.hashTasks(tasks, taskGraph);
response.tasks = taskGraph;
Expand Down

0 comments on commit bbb368e

Please sign in to comment.