nx/docs/shared/deprecated/print-affected.md
Jason Jean 8f705e31e2
fix(misc): adjust deprecation messages to v20 (#23223)
<!-- 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` -->

## Breaking Changes:


BREAKING CHANGE: `nx print-affected` was deprecated in 16.4.0 and has
been removed.
BREAKING CHANGE: `nx affected:graph` was deprecated in 16.4.0 and has
been removed.
BREAKING CHANGE: The `criticalPath` and `affectedProjects` properties of
the JSON created by `nx graph --file graph.json` was deprecated in
16.2.0 and has been removed.

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

Some deprecation messages still reference v19.

`nx print-affected` was deprecated in 16.4.0 to be removed in Nx 19 but
was not removed.
`nx affected:graph` was deprecated in 16.4.0 to be removed in Nx 19 but
was not removed.

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

Deprecation messages reference v20 now.

`nx print-affected` is removed.
`nx affected:graph` is removed.

There are redirects to a `deprecated` page describing those commands for
Nx users using Nx <19

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

Fixes #
2024-05-08 21:54:41 -04:00

129 lines
2.2 KiB
Markdown

---
title: 'print-affected - CLI command'
description: 'Prints information about the projects and targets affected by changes'
---
# print-affected
**Deprecated:** Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on
which best suits your use case. The `print-affected` command was removed in Nx 19.
Prints information about the projects and targets affected by changes
## Usage
```shell
nx print-affected
```
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
### Examples
Print information about affected projects and the project graph:
```shell
nx print-affected
```
Print information about the projects affected by the changes between main and HEAD (e.g,. PR):
```shell
nx print-affected --base=main --head=HEAD
```
Prints information about the affected projects and a list of tasks to test them:
```shell
nx print-affected -t test
```
Prints the projects property from the print-affected output:
```shell
nx print-affected -t build --select=projects
```
Prints the tasks.target.project property from the print-affected output:
```shell
nx print-affected -t build --select=tasks.target.project
```
## Options
### base
Type: `string`
Base of the current branch (usually main)
### configuration
Type: `string`
This is the configuration to use when performing tasks on projects
### exclude
Type: `string`
Exclude certain projects from being processed
### files
Type: `string`
Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by
commas or spaces
### head
Type: `string`
Latest commit of the current branch (usually HEAD)
### help
Type: `boolean`
Show help
### select
Type: `string`
Select the subset of the returned json document (e.g., --select=projects)
### targets
Type: `string`
Tasks to run for affected projects
### type
Type: `string`
Choices: [app, lib]
Select the type of projects to be returned (e.g., --type=app)
### uncommitted
Type: `boolean`
Uncommitted changes
### untracked
Type: `boolean`
Untracked changes
### version
Type: `boolean`
Show version number