Skip to content

Commit

Permalink
docs(core): autogenerate nx devkit api (nrwl#5827)
Browse files Browse the repository at this point in the history
Co-authored-by: Isaac Mann <[email protected]>
  • Loading branch information
isaacplmann and Isaac Mann authored Jun 11, 2021
1 parent c7a5f6d commit c39135e
Show file tree
Hide file tree
Showing 25 changed files with 4,602 additions and 14 deletions.
1,331 changes: 1,331 additions & 0 deletions docs/angular/api-nx-devkit/index.md

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions docs/angular/api-nx-devkit/ngcli_adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Module: ngcli-adapter

## Table of contents

### Classes

- [NxScopedHost](../../angular/nx-devkit/ngcli_adapter#nxscopedhost)

### Functions

- [mockSchematicsForTesting](../../angular/nx-devkit/ngcli_adapter#mockschematicsfortesting)
- [overrideCollectionResolutionForTesting](../../angular/nx-devkit/ngcli_adapter#overridecollectionresolutionfortesting)
- [wrapAngularDevkitSchematic](../../angular/nx-devkit/ngcli_adapter#wrapangulardevkitschematic)

## Classes

### NxScopedHost

**NxScopedHost**: _object_

## Functions

### mockSchematicsForTesting

**mockSchematicsForTesting**(`schematics`: { [name: string]: (`host`: [_Tree_](../../angular/nx-devkit/index#tree), `generatorOptions`: { [k: string]: _any_; }) => _Promise_<void\>; }): _void_

If you have an Nx Devkit generator invoking the wrapped Angular Devkit schematic,
and you don't want the Angular Devkit schematic to run, you can mock it up using this function.

Unfortunately, there are some edge cases in the Nx-Angular devkit integration that
can be seen in the unit tests context. This function is useful for handling that as well.

In this case, you can mock it up.

Example:

```
mockSchematicsForTesting({
'mycollection:myschematic': (tree, params) => {
tree.write('README.md');
}
});
```

#### Parameters

| Name | Type |
| :----------- | :------- |
| `schematics` | _object_ |

**Returns:** _void_

---

### overrideCollectionResolutionForTesting

**overrideCollectionResolutionForTesting**(`collections`: { [name: string]: _string_; }): _void_

By default, Angular Devkit schematic collections will be resolved using the Node resolution.
This doesn't work if you are testing schematics that refer to other schematics in the
same repo.

This function can can be used to override the resolution behaviour.

Example:

```
overrideCollectionResolutionForTesting({
'@nrwl/workspace': path.join(__dirname, '../../../../workspace/collection.json'),
'@nrwl/angular': path.join(__dirname, '../../../../angular/collection.json'),
'@nrwl/linter': path.join(__dirname, '../../../../linter/collection.json')
});
```

#### Parameters

| Name | Type |
| :------------ | :------- |
| `collections` | _object_ |

**Returns:** _void_

---

### wrapAngularDevkitSchematic

**wrapAngularDevkitSchematic**(`collectionName`: _string_, `generatorName`: _string_): _function_

#### Parameters

| Name | Type |
| :--------------- | :------- |
| `collectionName` | _string_ |
| `generatorName` | _string_ |

**Returns:** (`host`: [_Tree_](../../angular/nx-devkit/index#tree), `generatorOptions`: { [k: string]: _any_; }) => _Promise_<any\>
54 changes: 54 additions & 0 deletions docs/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,24 @@
}
]
},
{
"name": "Nx Devkit",
"id": "nx-devkit",
"itemList": [
{
"id": "index",
"name": "index",
"searchResultsName": "Nx Devkit",
"file": "angular/api-nx-devkit/index"
},
{
"id": "ngcli_adapter",
"name": "ngcli_adapter",
"searchResultsName": "Ng CLI Adapter",
"file": "angular/api-nx-devkit/ngcli_adapter"
}
]
},
{
"name": "Executors / Builders",
"id": "executors",
Expand Down Expand Up @@ -1978,6 +1996,24 @@
}
]
},
{
"name": "Nx Devkit",
"id": "nx-devkit",
"itemList": [
{
"id": "index",
"name": "index",
"searchResultsName": "Nx Devkit",
"file": "react/api-nx-devkit/index"
},
{
"id": "ngcli_adapter",
"name": "ngcli_adapter",
"searchResultsName": "Ng CLI Adapter",
"file": "react/api-nx-devkit/ngcli_adapter"
}
]
},
{
"name": "Executors / Builders",
"id": "executors",
Expand Down Expand Up @@ -3012,6 +3048,24 @@
}
]
},
{
"name": "Nx Devkit",
"id": "nx-devkit",
"itemList": [
{
"id": "index",
"name": "index",
"searchResultsName": "Nx Devkit",
"file": "node/api-nx-devkit/index"
},
{
"id": "ngcli_adapter",
"name": "ngcli_adapter",
"searchResultsName": "Ng CLI Adapter",
"file": "node/api-nx-devkit/ngcli_adapter"
}
]
},
{
"name": "Executors / Builders",
"id": "executors",
Expand Down
Loading

0 comments on commit c39135e

Please sign in to comment.