Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add api for v2 of project project graph plugins #18032

Merged
merged 18 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/generated/devkit/CreateDependencies.md
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)[]\>
53 changes: 53 additions & 0 deletions docs/generated/devkit/CreateDependenciesContext.md
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
5 changes: 5 additions & 0 deletions docs/generated/devkit/CreateNodes.md
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)
29 changes: 29 additions & 0 deletions docs/generated/devkit/CreateNodesContext.md
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`
26 changes: 26 additions & 0 deletions docs/generated/devkit/CreateNodesFunction.md
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)\> |
40 changes: 3 additions & 37 deletions docs/generated/devkit/NxPlugin.md
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
16 changes: 16 additions & 0 deletions docs/generated/devkit/NxPluginV1.md
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 |
13 changes: 13 additions & 0 deletions docs/generated/devkit/NxPluginV2.md
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` | - |
24 changes: 15 additions & 9 deletions docs/generated/devkit/ProjectGraphBuilder.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Class: ProjectGraphBuilder

A class which builds up a project graph

**`Deprecated`**

The ProjectGraphProcessor has been deprecated. Use a [CreateNodes](../../devkit/documents/CreateNodes) and/or a [CreateDependencies](../../devkit/documents/CreateDependencies) instead. This will be removed in Nx 18.

## Table of contents

### Constructors
Expand Down Expand Up @@ -34,13 +40,13 @@

### constructor

• **new ProjectGraphBuilder**(`g?`, `fileMap?`)
• **new ProjectGraphBuilder**(`graph?`, `fileMap?`)

#### Parameters

| Name | Type |
| :--------- | :-------------------------------------------------------- |
| `g?` | [`ProjectGraph`](../../devkit/documents/ProjectGraph) |
| `graph?` | [`ProjectGraph`](../../devkit/documents/ProjectGraph) |
| `fileMap?` | [`ProjectFileMap`](../../devkit/documents/ProjectFileMap) |

## Properties
Expand Down Expand Up @@ -69,16 +75,16 @@

### addDependency

`Private` **addDependency**(`sourceProjectName`, `targetProjectName`, `type`, `sourceProjectFile?`): `void`
▸ **addDependency**(`source`, `target`, `type`, `sourceFile?`): `void`

#### Parameters

| Name | Type |
| :------------------- | :-------------------------------------------------------- |
| `sourceProjectName` | `string` |
| `targetProjectName` | `string` |
| `type` | [`DependencyType`](../../devkit/documents/DependencyType) |
| `sourceProjectFile?` | `string` |
| Name | Type |
| :------------ | :-------------------------------------------------------- |
| `source` | `string` |
| `target` | `string` |
| `type` | [`DependencyType`](../../devkit/documents/DependencyType) |
| `sourceFile?` | `string` |

#### Returns

Expand Down
45 changes: 45 additions & 0 deletions docs/generated/devkit/ProjectGraphDependencyWithFile.md
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
4 changes: 4 additions & 0 deletions docs/generated/devkit/ProjectGraphProcessorContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Additional information to be used to process a project graph

**`Deprecated`**

The ProjectGraphProcessor is deprecated. This will be removed in Nx 18.

## Table of contents

### Properties
Expand Down
4 changes: 4 additions & 0 deletions docs/generated/devkit/ProjectTargetConfigurator.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

▸ (`file`): `Record`<`string`, [`TargetConfiguration`](../../devkit/documents/TargetConfiguration)\>

**`Deprecated`**

Add targets to the projects in a [CreateNodes](../../devkit/documents/CreateNodes) function instead. This will be removed in Nx 18

##### Parameters

| Name | Type |
Expand Down
11 changes: 10 additions & 1 deletion docs/generated/devkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ It only uses language primitives and immutable objects

### Interfaces

- [CreateDependenciesContext](../../devkit/documents/CreateDependenciesContext)
- [CreateNodesContext](../../devkit/documents/CreateNodesContext)
- [DefaultTasksRunnerOptions](../../devkit/documents/DefaultTasksRunnerOptions)
- [ExecutorContext](../../devkit/documents/ExecutorContext)
- [ExecutorsJson](../../devkit/documents/ExecutorsJson)
Expand All @@ -38,11 +40,11 @@ It only uses language primitives and immutable objects
- [ModuleFederationConfig](../../devkit/documents/ModuleFederationConfig)
- [NxAffectedConfig](../../devkit/documents/NxAffectedConfig)
- [NxJsonConfiguration](../../devkit/documents/NxJsonConfiguration)
- [NxPlugin](../../devkit/documents/NxPlugin)
- [ProjectConfiguration](../../devkit/documents/ProjectConfiguration)
- [ProjectFileMap](../../devkit/documents/ProjectFileMap)
- [ProjectGraph](../../devkit/documents/ProjectGraph)
- [ProjectGraphDependency](../../devkit/documents/ProjectGraphDependency)
- [ProjectGraphDependencyWithFile](../../devkit/documents/ProjectGraphDependencyWithFile)
- [ProjectGraphExternalNode](../../devkit/documents/ProjectGraphExternalNode)
- [ProjectGraphProcessorContext](../../devkit/documents/ProjectGraphProcessorContext)
- [ProjectGraphProjectNode](../../devkit/documents/ProjectGraphProjectNode)
Expand All @@ -63,13 +65,19 @@ It only uses language primitives and immutable objects
### Type Aliases

- [AdditionalSharedConfig](../../devkit/documents/AdditionalSharedConfig)
- [CreateDependencies](../../devkit/documents/CreateDependencies)
- [CreateNodes](../../devkit/documents/CreateNodes)
- [CreateNodesFunction](../../devkit/documents/CreateNodesFunction)
- [CustomHasher](../../devkit/documents/CustomHasher)
- [Executor](../../devkit/documents/Executor)
- [Generator](../../devkit/documents/Generator)
- [GeneratorCallback](../../devkit/documents/GeneratorCallback)
- [Hasher](../../devkit/documents/Hasher)
- [ImplicitDependencyEntry](../../devkit/documents/ImplicitDependencyEntry)
- [ModuleFederationLibrary](../../devkit/documents/ModuleFederationLibrary)
- [NxPlugin](../../devkit/documents/NxPlugin)
- [NxPluginV1](../../devkit/documents/NxPluginV1)
- [NxPluginV2](../../devkit/documents/NxPluginV2)
- [PackageManager](../../devkit/documents/PackageManager)
- [ProjectGraphNode](../../devkit/documents/ProjectGraphNode)
- [ProjectTargetConfigurator](../../devkit/documents/ProjectTargetConfigurator)
Expand Down Expand Up @@ -156,6 +164,7 @@ It only uses language primitives and immutable objects
- [updateProjectConfiguration](../../devkit/documents/updateProjectConfiguration)
- [updateTsConfigsToJs](../../devkit/documents/updateTsConfigsToJs)
- [updateWorkspaceConfiguration](../../devkit/documents/updateWorkspaceConfiguration)
- [validateDependency](../../devkit/documents/validateDependency)
- [visitNotIgnoredFiles](../../devkit/documents/visitNotIgnoredFiles)
- [workspaceLayout](../../devkit/documents/workspaceLayout)
- [writeJson](../../devkit/documents/writeJson)
Expand Down
Loading