nx/docs/generated/devkit/runExecutor.md
Juri Strumpflohner b51676a89a
docs(core): restructure guides into technologies sections (#31288)
Updates the docs structure, navigation etc to be easier + better suited
for showing Nx technology support beyond just TS.

**Notes:**

- API (`/nx-api`) tab is removed from the navigation (i.e. menu bar),
but pages still remain for now until we update references in `*.md`
files.
- Redirects are set up `/nx-api` to go to their respect new location
e.g. `/technologies` or `/reference/core-api`
- Old URLs still exist in the sitemap for now, but majority of them will
be redirected -- a follow-up PR can remove them.

**Preview:**
https://nx-dev-git-nx-dev-polyglot-docs-restructure-nrwl.vercel.app/docs

---------

Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-05-29 14:55:34 -04:00

50 lines
1.6 KiB
Markdown

# Function: runExecutor
**runExecutor**\<`T`\>(`targetDescription`, `overrides`, `context`): `Promise`\<`AsyncIterableIterator`\<`T`\>\>
Loads and invokes executor.
This is analogous to invoking executor from the terminal, with the exception
that the params aren't parsed from the string, but instead provided parsed already.
Apart from that, it works the same way:
- it will load the workspace configuration
- it will resolve the target
- it will load the executor and the schema
- it will load the options for the appropriate configuration
- it will run the validations and will set the default
- and, of course, it will invoke the executor
Example:
```typescript
for await (const s of await runExecutor(
{ project: 'myproj', target: 'serve' },
{ watch: true },
context
)) {
// s.success
}
```
Note that the return value is a promise of an iterator, so you need to await before iterating over it.
#### Type parameters
| Name | Type |
| :--- | :--------------- |
| `T` | extends `Object` |
#### Parameters
| Name | Type |
| :------------------ | :------------------------------------------------------------------------ |
| `targetDescription` | [`Target`](/reference/core-api/devkit/documents/Target) |
| `overrides` | `Object` |
| `context` | [`ExecutorContext`](/reference/core-api/devkit/documents/ExecutorContext) |
#### Returns
`Promise`\<`AsyncIterableIterator`\<`T`\>\>