nx/docs/generated/cli/graph.md
Nicholas Cunningham 2b98830b3a
docs(core): remove include command from nx-graph (#30233)
When we run `nx graph --help` we see that the `--include` commands is
not available.
So the docs should also reflect the current options.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #30212
2025-02-28 18:18:11 -05:00

5.2 KiB

title description
graph - CLI command Graph dependencies within workspace.

graph

Graph dependencies within workspace.

Usage

nx graph

Install nx globally to invoke the command directly using nx, or use npx nx, yarn nx, or pnpm nx.

Examples

Open the project graph of the workspace in the browser:

 nx graph

Save the project graph into a json file:

 nx graph --file=output.json

Generate a static website with project graph into an html file, accompanied by an asset folder called static:

 nx graph --file=output.html

Print the project graph as JSON to the console:

 nx graph --print

Show the graph where every node is either an ancestor or a descendant of todos-feature-main:

 nx graph --focus=todos-feature-main

Exclude project-one and project-two from the project graph:

 nx graph --exclude=project-one,project-two

Show the graph where every node is either an ancestor or a descendant of todos-feature-main, but exclude project-one and project-two:

 nx graph --focus=todos-feature-main --exclude=project-one,project-two

Watch for changes to project graph and update in-browser:

 nx graph --watch

Options

Option Type Description
--affected boolean Highlight affected projects.
--base string Base of the current branch (usually main).
--exclude string Exclude certain projects from being processed.
--file string Output file (e.g. --file=output.json or --file=dep-graph.html).
--files string Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces.
--focus string Use to show the project graph for a particular project and every node that is either an ancestor or a descendant.
--groupByFolder boolean Group projects by folder in the project graph.
--head string Latest commit of the current branch (usually HEAD).
--help boolean Show help.
--host string Bind the project graph server to a specific ip address.
--open boolean Open the project graph in the browser. (Default: true)
--port number Bind the project graph server to a specific port.
--print boolean Print the project graph to stdout in the terminal.
--targets string The target to show tasks for in the task graph.
--uncommitted boolean Uncommitted changes.
--untracked boolean Untracked changes.
--verbose boolean Prints additional information about the commands (e.g., stack traces).
--version boolean Show version number.
--view projects, tasks Choose whether to view the projects or task graph. (Default: projects)
--watch boolean Watch for changes to project graph and update in-browser. (Default: true)