feat(core): remove deprecated affected commands (#16349)
This commit is contained in:
parent
a798576e0e
commit
fc07794d90
@ -1,98 +0,0 @@
|
||||
---
|
||||
title: 'affected:apps - CLI command'
|
||||
description: 'Print applications affected by changes'
|
||||
---
|
||||
|
||||
# affected:apps
|
||||
|
||||
**Deprecated:** Use `nx print-affected --type=app --select=projects` instead. This command will be removed in v15.
|
||||
|
||||
Print applications affected by changes
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
nx affected:apps
|
||||
```
|
||||
|
||||
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
|
||||
|
||||
### Examples
|
||||
|
||||
Print the names of all the apps affected by changing the index.ts file:
|
||||
|
||||
```shell
|
||||
nx affected:apps --files=libs/mylib/src/index.ts
|
||||
```
|
||||
|
||||
Print the names of all the apps affected by the changes between main and HEAD (e.g., PR):
|
||||
|
||||
```shell
|
||||
nx affected:apps --base=main --head=HEAD
|
||||
```
|
||||
|
||||
Print the names of all the apps affected by the last commit on main:
|
||||
|
||||
```shell
|
||||
nx affected:apps --base=main~1 --head=main
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### all
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
All projects
|
||||
|
||||
### base
|
||||
|
||||
Type: `string`
|
||||
|
||||
Base of the current branch (usually main)
|
||||
|
||||
### 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
|
||||
|
||||
### plain
|
||||
|
||||
Produces a plain output for affected:apps and affected:libs
|
||||
|
||||
### uncommitted
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Uncommitted changes
|
||||
|
||||
### untracked
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Untracked changes
|
||||
|
||||
### version
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Show version number
|
||||
@ -1,98 +0,0 @@
|
||||
---
|
||||
title: 'affected:libs - CLI command'
|
||||
description: 'Print libraries affected by changes'
|
||||
---
|
||||
|
||||
# affected:libs
|
||||
|
||||
**Deprecated:** Use `nx print-affected --type=lib --select=projects` instead. This command will be removed in v15.
|
||||
|
||||
Print libraries affected by changes
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
nx affected:libs
|
||||
```
|
||||
|
||||
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
|
||||
|
||||
### Examples
|
||||
|
||||
Print the names of all the libs affected by changing the index.ts file:
|
||||
|
||||
```shell
|
||||
nx affected:libs --files=libs/mylib/src/index.ts
|
||||
```
|
||||
|
||||
Print the names of all the libs affected by the changes between main and HEAD (e.g., PR):
|
||||
|
||||
```shell
|
||||
nx affected:libs --base=main --head=HEAD
|
||||
```
|
||||
|
||||
Print the names of all the libs affected by the last commit on main:
|
||||
|
||||
```shell
|
||||
nx affected:libs --base=main~1 --head=main
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### all
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
All projects
|
||||
|
||||
### base
|
||||
|
||||
Type: `string`
|
||||
|
||||
Base of the current branch (usually main)
|
||||
|
||||
### 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
|
||||
|
||||
### plain
|
||||
|
||||
Produces a plain output for affected:apps and affected:libs
|
||||
|
||||
### uncommitted
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Uncommitted changes
|
||||
|
||||
### untracked
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Untracked changes
|
||||
|
||||
### version
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Show version number
|
||||
@ -5366,22 +5366,6 @@
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "affected:apps",
|
||||
"path": "/packages/nx/documents/affected-apps",
|
||||
"id": "affected-apps",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "affected:libs",
|
||||
"path": "/packages/nx/documents/affected-libs",
|
||||
"id": "affected-libs",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "print-affected",
|
||||
"path": "/packages/nx/documents/print-affected",
|
||||
|
||||
@ -1569,28 +1569,6 @@
|
||||
"tags": [],
|
||||
"originalFilePath": "generated/cli/affected-graph"
|
||||
},
|
||||
"/packages/nx/documents/affected-apps": {
|
||||
"id": "affected-apps",
|
||||
"name": "affected:apps",
|
||||
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
||||
"file": "generated/packages/nx/documents/affected-apps",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/packages/nx/documents/affected-apps",
|
||||
"tags": [],
|
||||
"originalFilePath": "generated/cli/affected-apps"
|
||||
},
|
||||
"/packages/nx/documents/affected-libs": {
|
||||
"id": "affected-libs",
|
||||
"name": "affected:libs",
|
||||
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
||||
"file": "generated/packages/nx/documents/affected-libs",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/packages/nx/documents/affected-libs",
|
||||
"tags": [],
|
||||
"originalFilePath": "generated/cli/affected-libs"
|
||||
},
|
||||
"/packages/nx/documents/print-affected": {
|
||||
"id": "print-affected",
|
||||
"name": "print-affected",
|
||||
|
||||
@ -1550,28 +1550,6 @@
|
||||
"tags": [],
|
||||
"originalFilePath": "generated/cli/affected-graph"
|
||||
},
|
||||
{
|
||||
"id": "affected-apps",
|
||||
"name": "affected:apps",
|
||||
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
||||
"file": "generated/packages/nx/documents/affected-apps",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "nx/documents/affected-apps",
|
||||
"tags": [],
|
||||
"originalFilePath": "generated/cli/affected-apps"
|
||||
},
|
||||
{
|
||||
"id": "affected-libs",
|
||||
"name": "affected:libs",
|
||||
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
||||
"file": "generated/packages/nx/documents/affected-libs",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "nx/documents/affected-libs",
|
||||
"tags": [],
|
||||
"originalFilePath": "generated/cli/affected-libs"
|
||||
},
|
||||
{
|
||||
"id": "print-affected",
|
||||
"name": "print-affected",
|
||||
|
||||
@ -1,98 +0,0 @@
|
||||
---
|
||||
title: 'affected:apps - CLI command'
|
||||
description: 'Print applications affected by changes'
|
||||
---
|
||||
|
||||
# affected:apps
|
||||
|
||||
**Deprecated:** Use `nx print-affected --type=app --select=projects` instead. This command will be removed in v15.
|
||||
|
||||
Print applications affected by changes
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
nx affected:apps
|
||||
```
|
||||
|
||||
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
|
||||
|
||||
### Examples
|
||||
|
||||
Print the names of all the apps affected by changing the index.ts file:
|
||||
|
||||
```shell
|
||||
nx affected:apps --files=libs/mylib/src/index.ts
|
||||
```
|
||||
|
||||
Print the names of all the apps affected by the changes between main and HEAD (e.g., PR):
|
||||
|
||||
```shell
|
||||
nx affected:apps --base=main --head=HEAD
|
||||
```
|
||||
|
||||
Print the names of all the apps affected by the last commit on main:
|
||||
|
||||
```shell
|
||||
nx affected:apps --base=main~1 --head=main
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### all
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
All projects
|
||||
|
||||
### base
|
||||
|
||||
Type: `string`
|
||||
|
||||
Base of the current branch (usually main)
|
||||
|
||||
### 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
|
||||
|
||||
### plain
|
||||
|
||||
Produces a plain output for affected:apps and affected:libs
|
||||
|
||||
### uncommitted
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Uncommitted changes
|
||||
|
||||
### untracked
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Untracked changes
|
||||
|
||||
### version
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Show version number
|
||||
@ -1,98 +0,0 @@
|
||||
---
|
||||
title: 'affected:libs - CLI command'
|
||||
description: 'Print libraries affected by changes'
|
||||
---
|
||||
|
||||
# affected:libs
|
||||
|
||||
**Deprecated:** Use `nx print-affected --type=lib --select=projects` instead. This command will be removed in v15.
|
||||
|
||||
Print libraries affected by changes
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
nx affected:libs
|
||||
```
|
||||
|
||||
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
|
||||
|
||||
### Examples
|
||||
|
||||
Print the names of all the libs affected by changing the index.ts file:
|
||||
|
||||
```shell
|
||||
nx affected:libs --files=libs/mylib/src/index.ts
|
||||
```
|
||||
|
||||
Print the names of all the libs affected by the changes between main and HEAD (e.g., PR):
|
||||
|
||||
```shell
|
||||
nx affected:libs --base=main --head=HEAD
|
||||
```
|
||||
|
||||
Print the names of all the libs affected by the last commit on main:
|
||||
|
||||
```shell
|
||||
nx affected:libs --base=main~1 --head=main
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### all
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
All projects
|
||||
|
||||
### base
|
||||
|
||||
Type: `string`
|
||||
|
||||
Base of the current branch (usually main)
|
||||
|
||||
### 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
|
||||
|
||||
### plain
|
||||
|
||||
Produces a plain output for affected:apps and affected:libs
|
||||
|
||||
### uncommitted
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Uncommitted changes
|
||||
|
||||
### untracked
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Untracked changes
|
||||
|
||||
### version
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Show version number
|
||||
@ -1527,16 +1527,6 @@
|
||||
"id": "affected-dep-graph",
|
||||
"file": "generated/cli/affected-graph"
|
||||
},
|
||||
{
|
||||
"name": "affected:apps",
|
||||
"id": "affected-apps",
|
||||
"file": "generated/cli/affected-apps"
|
||||
},
|
||||
{
|
||||
"name": "affected:libs",
|
||||
"id": "affected-libs",
|
||||
"file": "generated/cli/affected-libs"
|
||||
},
|
||||
{
|
||||
"name": "print-affected",
|
||||
"id": "print-affected",
|
||||
|
||||
@ -9,8 +9,6 @@
|
||||
- [run-many](/packages/nx/documents/run-many)
|
||||
- [affected](/packages/nx/documents/affected)
|
||||
- [affected:graph](/packages/nx/documents/affected-dep-graph)
|
||||
- [affected:apps](/packages/nx/documents/affected-apps)
|
||||
- [affected:libs](/packages/nx/documents/affected-libs)
|
||||
- [print-affected](/packages/nx/documents/print-affected)
|
||||
- [format:check](/packages/nx/documents/format-check)
|
||||
- [format:write](/packages/nx/documents/format-write)
|
||||
|
||||
@ -63,63 +63,49 @@ describe('Nx Affected and Graph Tests', () => {
|
||||
});
|
||||
`
|
||||
);
|
||||
expect(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`affected:apps --files="libs/${mylib}/src/index.ts" --plain`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim()
|
||||
).toEqual(myapp);
|
||||
|
||||
const affectedApps = runCLI(
|
||||
`affected:apps --files="libs/${mylib}/src/index.ts"`
|
||||
`print-affected --files="libs/${mylib}/src/index.ts" --select projects`
|
||||
);
|
||||
expect(affectedApps).toContain(myapp);
|
||||
expect(affectedApps).not.toContain(myapp2);
|
||||
expect(affectedApps).not.toContain(`${myapp}-e2e`);
|
||||
|
||||
const implicitlyAffectedApps = runCLI(
|
||||
'affected:apps --files="tsconfig.base.json"'
|
||||
'print-affected --select projects --files="tsconfig.base.json"'
|
||||
);
|
||||
expect(implicitlyAffectedApps).toContain(myapp);
|
||||
expect(implicitlyAffectedApps).toContain(myapp2);
|
||||
|
||||
const noAffectedApps = runCLI('affected:apps --files="README.md"');
|
||||
const noAffectedApps = runCLI(
|
||||
'print-affected --select projects --files="README.md"'
|
||||
);
|
||||
expect(noAffectedApps).not.toContain(myapp);
|
||||
expect(noAffectedApps).not.toContain(myapp2);
|
||||
|
||||
expect(
|
||||
(
|
||||
await runCLIAsync(
|
||||
`affected:libs --files="libs/${mylib}/src/index.ts" --plain`,
|
||||
{ silent: true }
|
||||
)
|
||||
).stdout.trim()
|
||||
).toEqual(`${mylib} ${mypublishablelib}`);
|
||||
|
||||
const affectedLibs = runCLI(
|
||||
`affected:libs --files="libs/${mylib}/src/index.ts"`
|
||||
`print-affected --select projects --files="libs/${mylib}/src/index.ts"`
|
||||
);
|
||||
expect(affectedLibs).toContain(mypublishablelib);
|
||||
expect(affectedLibs).toContain(mylib);
|
||||
expect(affectedLibs).not.toContain(mylib2);
|
||||
|
||||
const implicitlyAffectedLibs = runCLI(
|
||||
'affected:libs --files="tsconfig.base.json"'
|
||||
'print-affected --select projects --files="tsconfig.base.json"'
|
||||
);
|
||||
expect(implicitlyAffectedLibs).toContain(mypublishablelib);
|
||||
expect(implicitlyAffectedLibs).toContain(mylib);
|
||||
expect(implicitlyAffectedLibs).toContain(mylib2);
|
||||
|
||||
const noAffectedLibsNonExistentFile = runCLI(
|
||||
'affected:libs --files="tsconfig.json"'
|
||||
'print-affected --select projects --files="tsconfig.json"'
|
||||
);
|
||||
expect(noAffectedLibsNonExistentFile).not.toContain(mypublishablelib);
|
||||
expect(noAffectedLibsNonExistentFile).not.toContain(mylib);
|
||||
expect(noAffectedLibsNonExistentFile).not.toContain(mylib2);
|
||||
|
||||
const noAffectedLibs = runCLI('affected:libs --files="README.md"');
|
||||
const noAffectedLibs = runCLI(
|
||||
'print-affected --select projects --files="README.md"'
|
||||
);
|
||||
expect(noAffectedLibs).not.toContain(mypublishablelib);
|
||||
expect(noAffectedLibs).not.toContain(mylib);
|
||||
expect(noAffectedLibs).not.toContain(mylib2);
|
||||
@ -211,18 +197,20 @@ describe('Nx Affected and Graph Tests', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
runCLI(`generate @nrwl/web:app ${myapp}`);
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('print-affected --select projects')).toContain(myapp);
|
||||
runCommand(`git add . && git commit -am "add ${myapp}"`);
|
||||
|
||||
runCLI(`generate @nrwl/web:app ${myapp2}`);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp);
|
||||
expect(runCLI('affected:apps')).toContain(myapp2);
|
||||
let output = runCLI('print-affected --select projects');
|
||||
expect(output).not.toContain(myapp);
|
||||
expect(output).toContain(myapp2);
|
||||
runCommand(`git add . && git commit -am "add ${myapp2}"`);
|
||||
|
||||
runCLI(`generate @nrwl/js:lib ${mylib}`);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).toContain(mylib);
|
||||
output = runCLI('print-affected --select projects');
|
||||
expect(output).not.toContain(myapp);
|
||||
expect(output).not.toContain(myapp2);
|
||||
expect(output).toContain(mylib);
|
||||
}
|
||||
}, 1000000);
|
||||
|
||||
@ -234,9 +222,10 @@ describe('Nx Affected and Graph Tests', () => {
|
||||
...config,
|
||||
tags: ['tag'],
|
||||
}));
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
const output = runCLI('print-affected --select projects');
|
||||
expect(output).toContain(myapp);
|
||||
expect(output).not.toContain(myapp2);
|
||||
expect(output).not.toContain(mylib);
|
||||
}
|
||||
});
|
||||
|
||||
@ -244,9 +233,10 @@ describe('Nx Affected and Graph Tests', () => {
|
||||
generateAll();
|
||||
const root = readResolvedConfiguration().projects[mylib].root;
|
||||
removeFile(root);
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
const output = runCLI('print-affected --select projects');
|
||||
expect(output).toContain(myapp);
|
||||
expect(output).toContain(myapp2);
|
||||
expect(output).not.toContain(mylib);
|
||||
});
|
||||
|
||||
it('should detect changes to implicitly dependant projects', () => {
|
||||
@ -259,12 +249,11 @@ describe('Nx Affected and Graph Tests', () => {
|
||||
runCommand('git commit -m "setup test"');
|
||||
updateFile(`libs/${mylib}/index.html`, '<html></html>');
|
||||
|
||||
const affectedApps = runCLI('affected:apps');
|
||||
const affectedLibs = runCLI('affected:libs');
|
||||
const output = runCLI('print-affected --select projects');
|
||||
|
||||
expect(affectedApps).toContain(myapp);
|
||||
expect(affectedApps).not.toContain(myapp2);
|
||||
expect(affectedLibs).toContain(mylib);
|
||||
expect(output).toContain(myapp);
|
||||
expect(output).not.toContain(myapp2);
|
||||
expect(output).toContain(mylib);
|
||||
|
||||
// Clear implicit deps to not interfere with other tests.
|
||||
updateProjectConfig(myapp, (config) => ({
|
||||
|
||||
@ -14,8 +14,6 @@ describe('nx-dev: Additional API references section', () => {
|
||||
{ title: 'run-many', path: '/cli/run-many' },
|
||||
{ title: 'affected', path: '/cli/affected' },
|
||||
{ title: 'affected:graph', path: '/cli/affected-dep-graph' },
|
||||
{ title: 'affected:apps', path: '/cli/affected-apps' },
|
||||
{ title: 'affected:libs', path: '/cli/affected-libs' },
|
||||
{ title: 'print-affected', path: '/cli/print-affected' },
|
||||
{ title: 'format:check', path: '/cli/format-check' },
|
||||
{ title: 'format:write', path: '/cli/format-write' },
|
||||
|
||||
@ -311,9 +311,9 @@ const cliUrls = {
|
||||
'/cli/run-many': '/nx/run-many',
|
||||
'/cli/affected': '/nx/affected',
|
||||
'/cli/affected-dep-graph': '/nx/affected-dep-graph',
|
||||
'/cli/affected-apps': '/nx/affected-apps',
|
||||
'/cli/affected-libs': '/nx/affected-libs',
|
||||
'/cli/print-affected': '/nx/print-affected',
|
||||
'/cli/affected-apps': '/packages/nx/documents/print-affected',
|
||||
'/cli/affected-libs': '/packages/nx/documents/print-affected',
|
||||
'/cli/print-affected': '/packages/nx/documents/print-affected',
|
||||
'/cli/format-check': '/nx/format-check',
|
||||
'/cli/format-write': '/nx/format-write',
|
||||
'/cli/migrate': '/nx/migrate',
|
||||
@ -461,9 +461,13 @@ const packagesDocuments = {
|
||||
'/nx/run-many': '/packages/nx/documents/run-many',
|
||||
'/nx/affected': '/packages/nx/documents/affected',
|
||||
'/nx/affected-dep-graph': '/packages/nx/documents/affected-dep-graph',
|
||||
'/nx/affected-apps': '/packages/nx/documents/affected-apps',
|
||||
'/nx/affected-libs': '/packages/nx/documents/affected-libs',
|
||||
'/nx/affected-apps': '/packages/nx/documents/print-affected',
|
||||
'/nx/affected-libs': '/packages/nx/documents/print-affected',
|
||||
'/nx/print-affected': '/packages/nx/documents/print-affected',
|
||||
'/packages/nx/documents/affected-apps':
|
||||
'/packages/nx/documents/print-affected',
|
||||
'/packages/nx/documents/affected-libs':
|
||||
'/packages/nx/documents/print-affected',
|
||||
'/nx/format-check': '/packages/nx/documents/format-check',
|
||||
'/nx/format-write': '/packages/nx/documents/format-write',
|
||||
'/nx/migrate': '/packages/nx/documents/migrate',
|
||||
|
||||
@ -20,7 +20,7 @@ import { workspaceConfigurationCheck } from '../utils/workspace-configuration-ch
|
||||
import { findMatchingProjects } from '../utils/find-matching-projects';
|
||||
|
||||
export async function affected(
|
||||
command: 'apps' | 'libs' | 'graph' | 'print-affected' | 'affected',
|
||||
command: 'graph' | 'print-affected' | 'affected',
|
||||
args: { [k: string]: any },
|
||||
extraTargetDependencies: Record<
|
||||
string,
|
||||
@ -51,46 +51,6 @@ export async function affected(
|
||||
|
||||
try {
|
||||
switch (command) {
|
||||
case 'apps':
|
||||
const apps = projects
|
||||
.filter((p) => p.type === 'app')
|
||||
.map((p) => p.name);
|
||||
if (args.plain) {
|
||||
console.log(apps.join(' '));
|
||||
} else {
|
||||
if (apps.length) {
|
||||
output.warn({
|
||||
title:
|
||||
'Deprecated: Use "nx print-affected --type=app --select=projects" instead. This command will be removed in v16.',
|
||||
});
|
||||
output.log({
|
||||
title: 'Affected apps:',
|
||||
bodyLines: apps.map((app) => `${output.dim('-')} ${app}`),
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'libs':
|
||||
const libs = projects
|
||||
.filter((p) => p.type === 'lib')
|
||||
.map((p) => p.name);
|
||||
if (args.plain) {
|
||||
console.log(libs.join(' '));
|
||||
} else {
|
||||
if (libs.length) {
|
||||
output.warn({
|
||||
title:
|
||||
'Deprecated: Use "nx print-affected --type=lib --select=projects" instead. This command will be removed in v16.',
|
||||
});
|
||||
output.log({
|
||||
title: 'Affected libs:',
|
||||
bodyLines: libs.map((lib) => `${output.dim('-')} ${lib}`),
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'graph':
|
||||
const projectNames = projects.map((p) => p.name);
|
||||
await generateGraph(args as any, projectNames);
|
||||
|
||||
@ -169,40 +169,6 @@ export const examples: Record<string, Example[]> = {
|
||||
'Run lint for all the projects affected by the last commit on main',
|
||||
},
|
||||
],
|
||||
'affected:apps': [
|
||||
{
|
||||
command: 'affected:apps --files=libs/mylib/src/index.ts',
|
||||
description:
|
||||
'Print the names of all the apps affected by changing the index.ts file',
|
||||
},
|
||||
{
|
||||
command: 'affected:apps --base=main --head=HEAD',
|
||||
description:
|
||||
'Print the names of all the apps affected by the changes between main and HEAD (e.g., PR)',
|
||||
},
|
||||
{
|
||||
command: 'affected:apps --base=main~1 --head=main',
|
||||
description:
|
||||
'Print the names of all the apps affected by the last commit on main',
|
||||
},
|
||||
],
|
||||
'affected:libs': [
|
||||
{
|
||||
command: 'affected:libs --files=libs/mylib/src/index.ts',
|
||||
description:
|
||||
'Print the names of all the libs affected by changing the index.ts file',
|
||||
},
|
||||
{
|
||||
command: 'affected:libs --base=main --head=HEAD',
|
||||
description:
|
||||
'Print the names of all the libs affected by the changes between main and HEAD (e.g., PR)',
|
||||
},
|
||||
{
|
||||
command: 'affected:libs --base=main~1 --head=main',
|
||||
description:
|
||||
'Print the names of all the libs affected by the last commit on main',
|
||||
},
|
||||
],
|
||||
'format:write': [],
|
||||
'format:check': [],
|
||||
graph: [
|
||||
|
||||
@ -147,40 +147,6 @@ export const commandsObject = yargs
|
||||
target: 'e2e',
|
||||
}),
|
||||
})
|
||||
.command({
|
||||
command: 'affected:apps',
|
||||
deprecated:
|
||||
'Use `nx print-affected --type=app --select=projects` instead. This command will be removed in v15.',
|
||||
describe: `Print applications affected by changes`,
|
||||
builder: (yargs) =>
|
||||
linkToNxDevAndExamples(
|
||||
withAffectedOptions(withPlainOption(yargs)),
|
||||
'affected:apps'
|
||||
),
|
||||
handler: async (args) => {
|
||||
await (await import('./affected')).affected('apps', { ...args });
|
||||
process.exit(0);
|
||||
},
|
||||
})
|
||||
.command({
|
||||
command: 'affected:libs',
|
||||
deprecated:
|
||||
'Use `nx print-affected --type=lib --select=projects` instead. This command will be removed in v15.',
|
||||
describe: 'Print libraries affected by changes',
|
||||
builder: (yargs) =>
|
||||
linkToNxDevAndExamples(
|
||||
withAffectedOptions(withPlainOption(yargs)),
|
||||
'affected:libs'
|
||||
),
|
||||
handler: async (args) => {
|
||||
await (
|
||||
await import('./affected')
|
||||
).affected('libs', {
|
||||
...args,
|
||||
});
|
||||
process.exit(0);
|
||||
},
|
||||
})
|
||||
.command({
|
||||
command: 'affected:graph',
|
||||
describe: 'Graph dependencies affected by changes',
|
||||
@ -473,12 +439,6 @@ function withPrintAffectedOptions(yargs: yargs.Argv): yargs.Argv {
|
||||
});
|
||||
}
|
||||
|
||||
function withPlainOption(yargs: yargs.Argv): yargs.Argv {
|
||||
return yargs.option('plain', {
|
||||
describe: 'Produces a plain output for affected:apps and affected:libs',
|
||||
});
|
||||
}
|
||||
|
||||
function withExcludeOption(yargs: yargs.Argv): yargs.Argv {
|
||||
return yargs.option('exclude', {
|
||||
describe: 'Exclude certain projects from being processed',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user