-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add api for v2 of project project graph plugins (#18032)
Co-authored-by: FrozenPandaz <[email protected]>
- Loading branch information
1 parent
0cfd8af
commit a7cf272
Showing
56 changed files
with
1,981 additions
and
1,294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Type alias: CreateDependencies | ||
|
||
Ƭ **CreateDependencies**: (`context`: [`CreateDependenciesContext`](../../devkit/documents/CreateDependenciesContext)) => [`ProjectGraphDependencyWithFile`](../../devkit/documents/ProjectGraphDependencyWithFile)[] \| `Promise`<[`ProjectGraphDependencyWithFile`](../../devkit/documents/ProjectGraphDependencyWithFile)[]\> | ||
|
||
#### Type declaration | ||
|
||
▸ (`context`): [`ProjectGraphDependencyWithFile`](../../devkit/documents/ProjectGraphDependencyWithFile)[] \| `Promise`<[`ProjectGraphDependencyWithFile`](../../devkit/documents/ProjectGraphDependencyWithFile)[]\> | ||
|
||
A function which parses files in the workspace to create dependencies in the [ProjectGraph](../../devkit/documents/ProjectGraph) | ||
Use [validateDependency](../../devkit/documents/validateDependency) to validate dependencies | ||
|
||
##### Parameters | ||
|
||
| Name | Type | | ||
| :-------- | :------------------------------------------------------------------------------ | | ||
| `context` | [`CreateDependenciesContext`](../../devkit/documents/CreateDependenciesContext) | | ||
|
||
##### Returns | ||
|
||
[`ProjectGraphDependencyWithFile`](../../devkit/documents/ProjectGraphDependencyWithFile)[] \| `Promise`<[`ProjectGraphDependencyWithFile`](../../devkit/documents/ProjectGraphDependencyWithFile)[]\> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Interface: CreateDependenciesContext | ||
|
||
Context for [CreateDependencies](../../devkit/documents/CreateDependencies) | ||
|
||
## Table of contents | ||
|
||
### Properties | ||
|
||
- [fileMap](../../devkit/documents/CreateDependenciesContext#filemap) | ||
- [filesToProcess](../../devkit/documents/CreateDependenciesContext#filestoprocess) | ||
- [graph](../../devkit/documents/CreateDependenciesContext#graph) | ||
- [nxJsonConfiguration](../../devkit/documents/CreateDependenciesContext#nxjsonconfiguration) | ||
- [projectsConfigurations](../../devkit/documents/CreateDependenciesContext#projectsconfigurations) | ||
|
||
## Properties | ||
|
||
### fileMap | ||
|
||
• `Readonly` **fileMap**: [`ProjectFileMap`](../../devkit/documents/ProjectFileMap) | ||
|
||
All files in the workspace | ||
|
||
--- | ||
|
||
### filesToProcess | ||
|
||
• `Readonly` **filesToProcess**: [`ProjectFileMap`](../../devkit/documents/ProjectFileMap) | ||
|
||
Files changes since last invocation | ||
|
||
--- | ||
|
||
### graph | ||
|
||
• `Readonly` **graph**: [`ProjectGraph`](../../devkit/documents/ProjectGraph) | ||
|
||
The current project graph, | ||
|
||
--- | ||
|
||
### nxJsonConfiguration | ||
|
||
• `Readonly` **nxJsonConfiguration**: [`NxJsonConfiguration`](../../devkit/documents/NxJsonConfiguration)<`string`[] \| `"*"`\> | ||
|
||
The `nx.json` configuration from the workspace | ||
|
||
--- | ||
|
||
### projectsConfigurations | ||
|
||
• `Readonly` **projectsConfigurations**: [`ProjectsConfigurations`](../../devkit/documents/ProjectsConfigurations) | ||
|
||
The configuration of each project in the workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Type alias: CreateNodes | ||
|
||
Ƭ **CreateNodes**: [projectFilePattern: string, createNodesFunction: CreateNodesFunction] | ||
|
||
A pair of file patterns and [CreateNodesFunction](../../devkit/documents/CreateNodesFunction) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Interface: CreateNodesContext | ||
|
||
Context for [CreateNodesFunction](../../devkit/documents/CreateNodesFunction) | ||
|
||
## Table of contents | ||
|
||
### Properties | ||
|
||
- [nxJsonConfiguration](../../devkit/documents/CreateNodesContext#nxjsonconfiguration) | ||
- [projectsConfigurations](../../devkit/documents/CreateNodesContext#projectsconfigurations) | ||
- [workspaceRoot](../../devkit/documents/CreateNodesContext#workspaceroot) | ||
|
||
## Properties | ||
|
||
### nxJsonConfiguration | ||
|
||
• `Readonly` **nxJsonConfiguration**: [`NxJsonConfiguration`](../../devkit/documents/NxJsonConfiguration)<`string`[] \| `"*"`\> | ||
|
||
--- | ||
|
||
### projectsConfigurations | ||
|
||
• `Readonly` **projectsConfigurations**: `Record`<`string`, [`ProjectConfiguration`](../../devkit/documents/ProjectConfiguration)\> | ||
|
||
--- | ||
|
||
### workspaceRoot | ||
|
||
• `Readonly` **workspaceRoot**: `string` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Type alias: CreateNodesFunction | ||
|
||
Ƭ **CreateNodesFunction**: (`projectConfigurationFile`: `string`, `context`: [`CreateNodesContext`](../../devkit/documents/CreateNodesContext)) => { `externalNodes?`: `Record`<`string`, [`ProjectGraphExternalNode`](../../devkit/documents/ProjectGraphExternalNode)\> ; `projects?`: `Record`<`string`, [`ProjectConfiguration`](../../devkit/documents/ProjectConfiguration)\> } | ||
|
||
#### Type declaration | ||
|
||
▸ (`projectConfigurationFile`, `context`): `Object` | ||
|
||
A function which parses a configuration file into a set of nodes. | ||
Used for creating nodes for the [ProjectGraph](../../devkit/documents/ProjectGraph) | ||
|
||
##### Parameters | ||
|
||
| Name | Type | | ||
| :------------------------- | :---------------------------------------------------------------- | | ||
| `projectConfigurationFile` | `string` | | ||
| `context` | [`CreateNodesContext`](../../devkit/documents/CreateNodesContext) | | ||
|
||
##### Returns | ||
|
||
`Object` | ||
|
||
| Name | Type | | ||
| :--------------- | :------------------------------------------------------------------------------------------------- | | ||
| `externalNodes?` | `Record`<`string`, [`ProjectGraphExternalNode`](../../devkit/documents/ProjectGraphExternalNode)\> | | ||
| `projects?` | `Record`<`string`, [`ProjectConfiguration`](../../devkit/documents/ProjectConfiguration)\> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,5 @@ | ||
# Interface: NxPlugin | ||
# Type alias: NxPlugin | ||
|
||
A plugin for Nx | ||
|
||
## Table of contents | ||
|
||
### Properties | ||
|
||
- [name](../../devkit/documents/NxPlugin#name) | ||
- [processProjectGraph](../../devkit/documents/NxPlugin#processprojectgraph) | ||
- [projectFilePatterns](../../devkit/documents/NxPlugin#projectfilepatterns) | ||
- [registerProjectTargets](../../devkit/documents/NxPlugin#registerprojecttargets) | ||
|
||
## Properties | ||
|
||
### name | ||
|
||
• **name**: `string` | ||
|
||
--- | ||
|
||
### processProjectGraph | ||
Ƭ **NxPlugin**: [`NxPluginV1`](../../devkit/documents/NxPluginV1) \| [`NxPluginV2`](../../devkit/documents/NxPluginV2) | ||
|
||
• `Optional` **processProjectGraph**: `ProjectGraphProcessor` | ||
|
||
--- | ||
|
||
### projectFilePatterns | ||
|
||
• `Optional` **projectFilePatterns**: `string`[] | ||
|
||
A glob pattern to search for non-standard project files. | ||
@example: ["*.csproj", "pom.xml"] | ||
|
||
--- | ||
|
||
### registerProjectTargets | ||
|
||
• `Optional` **registerProjectTargets**: [`ProjectTargetConfigurator`](../../devkit/documents/ProjectTargetConfigurator) | ||
A plugin for Nx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Type alias: NxPluginV1 | ||
|
||
Ƭ **NxPluginV1**: `Object` | ||
|
||
**`Deprecated`** | ||
|
||
Use [NxPluginV2](../../devkit/documents/NxPluginV2) instead. This will be removed in Nx 18 | ||
|
||
#### Type declaration | ||
|
||
| Name | Type | Description | | ||
| :------------------------ | :------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `name` | `string` | - | | ||
| `processProjectGraph?` | `ProjectGraphProcessor` | **`Deprecated`** Use [CreateNodes](../../devkit/documents/CreateNodes) and [CreateDependencies](../../devkit/documents/CreateDependencies) instead. This will be removed in Nx 18 | | ||
| `projectFilePatterns?` | `string`[] | A glob pattern to search for non-standard project files. @example: ["*.csproj", "pom.xml"] **`Deprecated`** Use [CreateNodes](../../devkit/documents/CreateNodes) instead. This will be removed in Nx 18 | | ||
| `registerProjectTargets?` | [`ProjectTargetConfigurator`](../../devkit/documents/ProjectTargetConfigurator) | **`Deprecated`** Add targets to the projects inside of [CreateNodes](../../devkit/documents/CreateNodes) instead. This will be removed in Nx 18 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Type alias: NxPluginV2 | ||
|
||
Ƭ **NxPluginV2**: `Object` | ||
|
||
A plugin for Nx which creates nodes and dependencies for the [ProjectGraph](../../devkit/documents/ProjectGraph) | ||
|
||
#### Type declaration | ||
|
||
| Name | Type | Description | | ||
| :-------------------- | :---------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `createDependencies?` | [`CreateDependencies`](../../devkit/documents/CreateDependencies) | Provides a function to analyze files to create dependencies for the [ProjectGraph](../../devkit/documents/ProjectGraph) | | ||
| `createNodes?` | [`CreateNodes`](../../devkit/documents/CreateNodes) | Provides a file pattern and function that retrieves configuration info from those files. e.g. { '\*_/_.csproj': buildProjectsFromCsProjFile } | | ||
| `name` | `string` | - | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Interface: ProjectGraphDependencyWithFile | ||
|
||
A [ProjectGraph](../../devkit/documents/ProjectGraph) dependency between 2 projects | ||
Optional: Specifies a file from where the dependency is made | ||
|
||
## Table of contents | ||
|
||
### Properties | ||
|
||
- [dependencyType](../../devkit/documents/ProjectGraphDependencyWithFile#dependencytype) | ||
- [source](../../devkit/documents/ProjectGraphDependencyWithFile#source) | ||
- [sourceFile](../../devkit/documents/ProjectGraphDependencyWithFile#sourcefile) | ||
- [target](../../devkit/documents/ProjectGraphDependencyWithFile#target) | ||
|
||
## Properties | ||
|
||
### dependencyType | ||
|
||
• **dependencyType**: [`DependencyType`](../../devkit/documents/DependencyType) | ||
|
||
The type of dependency | ||
|
||
--- | ||
|
||
### source | ||
|
||
• **source**: `string` | ||
|
||
The name of a [ProjectGraphProjectNode](../../devkit/documents/ProjectGraphProjectNode) or [ProjectGraphExternalNode](../../devkit/documents/ProjectGraphExternalNode) depending on the target project | ||
|
||
--- | ||
|
||
### sourceFile | ||
|
||
• `Optional` **sourceFile**: `string` | ||
|
||
The path of a file (relative from the workspace root) where the dependency is made | ||
|
||
--- | ||
|
||
### target | ||
|
||
• **target**: `string` | ||
|
||
The name of a [ProjectGraphProjectNode](../../devkit/documents/ProjectGraphProjectNode) or [ProjectGraphExternalNode](../../devkit/documents/ProjectGraphExternalNode) that the source project depends on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
a7cf272
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.
Successfully deployed to the following URLs:
nx-dev – ./
nx.dev
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app