-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): ability to save task graph to a file when running --graph #16350
feat(core): ability to save task graph to a file when running --graph #16350
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
b6f9878
to
cc1cb88
Compare
cc1cb88
to
4447eea
Compare
4447eea
to
d702cf1
Compare
d702cf1
to
9cc3ea3
Compare
@@ -31,11 +31,11 @@ Exclude certain projects from being processed | |||
|
|||
### graph |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
followup: Why is this here?
@@ -192,6 +193,7 @@ export function withDepGraphOptions(yargs: Argv): Argv { | |||
describe: | |||
'Output file (e.g. --file=output.json or --file=dep-graph.html)', | |||
type: 'string', | |||
alias: ['out'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove for now....
cc @philipjfulcher how do you think someone should be able to run nx graph
so that it outputs to the terminal?
We are making nx graph --file stdout
print to the terminal... but it looks kind of weird.. so our preliminary thought was nx graph --out stdout
looks better.. but we don't have to make this identical to file
. This could just be like --stdout
or --print
9cc3ea3
to
6b41341
Compare
@@ -246,6 +246,12 @@ export async function generateGraph( | |||
graph = filterGraph(graph, args.focus || null, args.exclude || []); | |||
|
|||
if (args.file) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to alter this output to include tasks
and omit affectedProjects
and criticalPath
.
Option 1:
tasks
is the same as what print-affected
has currently which is tasks: Task[]
Option 2:
tasks
is the task graph so we have taskGraph: { roots: string[], tasks: Record<string, Task>, dependencies: Record<string, string[]> }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Updated with option 2 🎉
There is a caveat. print-affected
included task hashes, but they were sometimes not matching with the task hash as compared against the cache... See: #16153
Should we try to get accurate hashes this time, or just be ok with no hash?
ba8e1b3
to
1ad12b3
Compare
1ad12b3
to
fc9f76a
Compare
fc9f76a
to
21810e1
Compare
21810e1
to
efca0fc
Compare
efca0fc
to
37bb72a
Compare
37bb72a
to
8c46a37
Compare
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
Saving the graph to a file is only supported for
nx graph
This looks like:nx graph --file output.json
Expected Behavior
You can also save the task graph when running
nx ... --graph
. The PR currently implements this like:nx affected --target build --graph output.json
Deprecations
criticalPath
andaffected
fields within json graph outputs are now deprecated