feat(core): expose graph json type (#27496)
Closes #3283 ## Current Behavior See #3283 ## Expected Behavior See #3283 ## Related Issue(s) #3283 Fixes # - expose graph json type --------- Co-authored-by: @NgDaddy Paweł Twardziak <contact@ngdaddy.com> Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
This commit is contained in:
parent
ec53f315b9
commit
2c0a50c0d8
35
docs/generated/devkit/GraphJson.md
Normal file
35
docs/generated/devkit/GraphJson.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Interface: GraphJson
|
||||||
|
|
||||||
|
The data type that `nx graph --file graph.json` or `nx build --graph graph.json` contains
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
- [graph](../../devkit/documents/GraphJson#graph): ProjectGraph
|
||||||
|
- [taskPlans](../../devkit/documents/GraphJson#taskplans): Record<string, string[]>
|
||||||
|
- [tasks](../../devkit/documents/GraphJson#tasks): TaskGraph
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
### graph
|
||||||
|
|
||||||
|
• **graph**: [`ProjectGraph`](../../devkit/documents/ProjectGraph)
|
||||||
|
|
||||||
|
The project graph
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### taskPlans
|
||||||
|
|
||||||
|
• `Optional` **taskPlans**: `Record`\<`string`, `string`[]\>
|
||||||
|
|
||||||
|
The plans for hashing a task in the task graph
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### tasks
|
||||||
|
|
||||||
|
• `Optional` **tasks**: [`TaskGraph`](../../devkit/documents/TaskGraph)
|
||||||
|
|
||||||
|
A graph of tasks populated with `nx build --graph`
|
||||||
@ -35,6 +35,7 @@ It only uses language primitives and immutable objects
|
|||||||
- [FileData](../../devkit/documents/FileData)
|
- [FileData](../../devkit/documents/FileData)
|
||||||
- [FileMap](../../devkit/documents/FileMap)
|
- [FileMap](../../devkit/documents/FileMap)
|
||||||
- [GeneratorsJson](../../devkit/documents/GeneratorsJson)
|
- [GeneratorsJson](../../devkit/documents/GeneratorsJson)
|
||||||
|
- [GraphJson](../../devkit/documents/GraphJson)
|
||||||
- [Hash](../../devkit/documents/Hash)
|
- [Hash](../../devkit/documents/Hash)
|
||||||
- [HasherContext](../../devkit/documents/HasherContext)
|
- [HasherContext](../../devkit/documents/HasherContext)
|
||||||
- [ImplicitJsonSubsetDependency](../../devkit/documents/ImplicitJsonSubsetDependency)
|
- [ImplicitJsonSubsetDependency](../../devkit/documents/ImplicitJsonSubsetDependency)
|
||||||
|
|||||||
@ -35,6 +35,7 @@ It only uses language primitives and immutable objects
|
|||||||
- [FileData](../../devkit/documents/FileData)
|
- [FileData](../../devkit/documents/FileData)
|
||||||
- [FileMap](../../devkit/documents/FileMap)
|
- [FileMap](../../devkit/documents/FileMap)
|
||||||
- [GeneratorsJson](../../devkit/documents/GeneratorsJson)
|
- [GeneratorsJson](../../devkit/documents/GeneratorsJson)
|
||||||
|
- [GraphJson](../../devkit/documents/GraphJson)
|
||||||
- [Hash](../../devkit/documents/Hash)
|
- [Hash](../../devkit/documents/Hash)
|
||||||
- [HasherContext](../../devkit/documents/HasherContext)
|
- [HasherContext](../../devkit/documents/HasherContext)
|
||||||
- [ImplicitJsonSubsetDependency](../../devkit/documents/ImplicitJsonSubsetDependency)
|
- [ImplicitJsonSubsetDependency](../../devkit/documents/ImplicitJsonSubsetDependency)
|
||||||
|
|||||||
@ -1155,9 +1155,21 @@ function expandInputs(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GraphJsonResponse {
|
/**
|
||||||
|
* The data type that `nx graph --file graph.json` or `nx build --graph graph.json` contains
|
||||||
|
*/
|
||||||
|
export interface GraphJson {
|
||||||
|
/**
|
||||||
|
* A graph of tasks populated with `nx build --graph`
|
||||||
|
*/
|
||||||
tasks?: TaskGraph;
|
tasks?: TaskGraph;
|
||||||
|
/**
|
||||||
|
* The plans for hashing a task in the task graph
|
||||||
|
*/
|
||||||
taskPlans?: Record<string, string[]>;
|
taskPlans?: Record<string, string[]>;
|
||||||
|
/**
|
||||||
|
* The project graph
|
||||||
|
*/
|
||||||
graph: ProjectGraph;
|
graph: ProjectGraph;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1166,8 +1178,8 @@ async function createJsonOutput(
|
|||||||
rawGraph: ProjectGraph,
|
rawGraph: ProjectGraph,
|
||||||
projects: string[],
|
projects: string[],
|
||||||
targets?: string[]
|
targets?: string[]
|
||||||
): Promise<GraphJsonResponse> {
|
): Promise<GraphJson> {
|
||||||
const response: GraphJsonResponse = {
|
const response: GraphJson = {
|
||||||
graph: prunedGraph,
|
graph: prunedGraph,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -159,6 +159,8 @@ export type {
|
|||||||
ProjectGraphProcessorContext,
|
ProjectGraphProcessorContext,
|
||||||
} from './config/project-graph';
|
} from './config/project-graph';
|
||||||
|
|
||||||
|
export type { GraphJson } from './command-line/graph/graph';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Project Graph
|
* @category Project Graph
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user