Skip to content

Commit 23bebd9

Browse files
authored
feat(devkit): bump compatibility to Nx 19 - 21.x (#28243)
BREAKING CHANGE <!-- 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 --> * `@nx/devkit` supports Nx 17 - 20. * Node 18 - 22 is supported * `ExecutorContext.projectGraph`, `ExecutorContext.nxJsonConfiguration`, and `ExecutorContext.projectsConfigurations` is marked as optional because `ExecutorContext` in some versions of Nx did not have them. * `ExecutorContext.workspace` is marked as optional because `ExecutorContext` in some versions of Nx did not have the above properties which contain the same information. * `ProjectGraphNode` is deprecated. * `NxPluginV1.processProjectGraph` was deprecated long ago and there has been a warning since. * `appRootPath` has been deprecated for a long time. * `parseTargetString` had a variant that did not take either the project graph or the executor context. * `readNxJson` has a variant which does not take a tree. This was not clearly deprecated. * There are handlers to require from `@nx/` instead of `@nrwl` * Nx tries to get a root install from `@nrwl/cli` ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> * `@nx/devkit` supports Nx 19 - 21. * Node 20 - 22 is supported * `ExecutorContext.projectGraph`, `ExecutorContext.nxJsonConfiguration`, and `ExecutorContext.projectsConfigurations` is marked as required because `ExecutorContext` in Nx 19+ is guaranteed to have them. * `ExecutorContext.workspace` is removed because the same information is available in the above properties * `ProjectGraphNode` is removed. * `NxPluginV1` is no more. All plugins should be `NxPluginV2`. * `workspaceRoot` is the replacement for `appRootPath`. `appRootPath` is removed. * `parseTargetString` no longer has a variant that did not take either the project graph or the executor context. * `readNxJson` still has a variant which does not take a tree but it's clearly deprecated to be removed in Nx 21. * `@nrwl` packages are no more so we don't have to redirect requires anymore. * `@nrwl/cli` is no more so Nx shouldn't try to get a root install there * ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
1 parent d131b0b commit 23bebd9

File tree

79 files changed

+606
-1381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+606
-1381
lines changed

docs/generated/devkit/CreateNodes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
A pair of file patterns and [CreateNodesFunction](../../devkit/documents/CreateNodesFunction)
66

77
Nx 19.2+: Both original `CreateNodes` and `CreateNodesV2` are supported. Nx will only invoke `CreateNodesV2` if it is present.
8-
Nx 20.X : The `CreateNodesV2` will be the only supported API. This typing will still exist, but be identical to `CreateNodesV2`.
8+
Nx 21.X : The `CreateNodesV2` will be the only supported API. This typing will still exist, but be identical to `CreateNodesV2`.
99
Nx **will not** invoke the original `plugin.createNodes` callback. This should give plugin authors a window to transition.
1010
Plugin authors should update their plugin's `createNodes` function to align with `CreateNodesV2` / the updated `CreateNodes`.
1111
The plugin should contain something like: `export createNodes = createNodesV2;` during this period. This will allow the plugin
1212
to maintain compatibility with Nx 19.2 and up.
13-
Nx 21.X : The `CreateNodesV2` typing will be removed, as it has replaced `CreateNodes`.
13+
Nx 22.X : The `CreateNodesV2` typing will be removed, as it has replaced `CreateNodes`.
1414

1515
**`Deprecated`**
1616

docs/generated/devkit/CreateNodesV2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Ƭ **CreateNodesV2**\<`T`\>: readonly [projectFilePattern: string, createNodesFunction: CreateNodesFunctionV2\<T\>]
44

55
A pair of file patterns and [CreateNodesFunctionV2](../../devkit/documents/CreateNodesFunctionV2)
6-
In Nx 20 [CreateNodes](../../devkit/documents/CreateNodes) will be replaced with this type. In Nx 21, this type will be removed.
6+
In Nx 21 [CreateNodes](../../devkit/documents/CreateNodes) will be replaced with this type. In Nx 22, this type will be removed.
77

88
#### Type parameters
99

docs/generated/devkit/ExecutorContext.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Context that is passed into an executor
1717
- [target](../../devkit/documents/ExecutorContext#target): TargetConfiguration<any>
1818
- [targetName](../../devkit/documents/ExecutorContext#targetname): string
1919
- [taskGraph](../../devkit/documents/ExecutorContext#taskgraph): TaskGraph
20-
- [workspace](../../devkit/documents/ExecutorContext#workspace): ProjectsConfigurations & NxJsonConfiguration<string[] | "\*">
2120

2221
## Properties
2322

@@ -47,23 +46,19 @@ Enable verbose logging
4746

4847
### nxJsonConfiguration
4948

50-
`Optional` **nxJsonConfiguration**: [`NxJsonConfiguration`](../../devkit/documents/NxJsonConfiguration)\<`string`[] \| `"*"`\>
49+
**nxJsonConfiguration**: [`NxJsonConfiguration`](../../devkit/documents/NxJsonConfiguration)\<`string`[] \| `"*"`\>
5150

5251
The contents of nx.json.
5352

54-
@todo(vsavkin): mark this as required for v17
55-
5653
---
5754

5855
### projectGraph
5956

60-
`Optional` **projectGraph**: [`ProjectGraph`](../../devkit/documents/ProjectGraph)
57+
**projectGraph**: [`ProjectGraph`](../../devkit/documents/ProjectGraph)
6158

6259
A snapshot of the project graph as
6360
it existed when the Nx command was kicked off
6461

65-
@todo(vsavkin) mark this required for v17
66-
6762
---
6863

6964
### projectName
@@ -76,12 +71,10 @@ The name of the project being executed on
7671

7772
### projectsConfigurations
7873

79-
`Optional` **projectsConfigurations**: [`ProjectsConfigurations`](../../devkit/documents/ProjectsConfigurations)
74+
**projectsConfigurations**: [`ProjectsConfigurations`](../../devkit/documents/ProjectsConfigurations)
8075

8176
Projects config
8277

83-
@todo(vsavkin): mark this as required for v17
84-
8578
---
8679

8780
### root
@@ -114,13 +107,3 @@ The name of the target being executed
114107

115108
A snapshot of the task graph as
116109
it existed when the Nx command was kicked off
117-
118-
---
119-
120-
### workspace
121-
122-
`Optional` **workspace**: [`ProjectsConfigurations`](../../devkit/documents/ProjectsConfigurations) & [`NxJsonConfiguration`](../../devkit/documents/NxJsonConfiguration)\<`string`[] \| `"*"`\>
123-
124-
Deprecated. Use projectsConfigurations or nxJsonConfiguration
125-
The full workspace configuration
126-
@todo(vsavkin): remove after v17

docs/generated/devkit/NxPlugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Type alias: NxPlugin
22

3-
Ƭ **NxPlugin**: [`NxPluginV1`](../../devkit/documents/NxPluginV1) \| [`NxPluginV2`](../../devkit/documents/NxPluginV2)
3+
Ƭ **NxPlugin**: [`NxPluginV2`](../../devkit/documents/NxPluginV2)
44

55
A plugin for Nx

docs/generated/devkit/NxPluginV1.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/generated/devkit/NxPluginV2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ A plugin for Nx which creates nodes and dependencies for the [ProjectGraph](../.
1616
| :-------------------- | :------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1717
| `createDependencies?` | [`CreateDependencies`](../../devkit/documents/CreateDependencies)\<`TOptions`\> | Provides a function to analyze files to create dependencies for the [ProjectGraph](../../devkit/documents/ProjectGraph) |
1818
| `createMetadata?` | [`CreateMetadata`](../../devkit/documents/CreateMetadata)\<`TOptions`\> | Provides a function to create metadata for the [ProjectGraph](../../devkit/documents/ProjectGraph) |
19-
| `createNodes?` | [`CreateNodes`](../../devkit/documents/CreateNodes)\<`TOptions`\> | Provides a file pattern and function that retrieves configuration info from those files. e.g. { '**/\*.csproj': buildProjectsFromCsProjFile } **`Deprecated`\*\* Use createNodesV2 instead. In Nx 20 support for calling createNodes with a single file for the first argument will be removed. |
20-
| `createNodesV2?` | [`CreateNodesV2`](../../devkit/documents/CreateNodesV2)\<`TOptions`\> | Provides a file pattern and function that retrieves configuration info from those files. e.g. { '\*_/_.csproj': buildProjectsFromCsProjFiles } In Nx 20 createNodes will be replaced with this property. In Nx 21, this property will be removed. |
19+
| `createNodes?` | [`CreateNodes`](../../devkit/documents/CreateNodes)\<`TOptions`\> | Provides a file pattern and function that retrieves configuration info from those files. e.g. { '**/\*.csproj': buildProjectsFromCsProjFile } **`Deprecated`\*\* Use createNodesV2 instead. In Nx 21 support for calling createNodes with a single file for the first argument will be removed. |
20+
| `createNodesV2?` | [`CreateNodesV2`](../../devkit/documents/CreateNodesV2)\<`TOptions`\> | Provides a file pattern and function that retrieves configuration info from those files. e.g. { '\*_/_.csproj': buildProjectsFromCsProjFiles } In Nx 21 createNodes will be replaced with this property. In Nx 22, this property will be removed. |
2121
| `name` | `string` | - |

0 commit comments

Comments
 (0)