docs(core): nx sync (#27825)

- Adds nx sync to command reference
- Updates nx.json reference
- Update project configuration reference
- Adds a sync generators concept page
- Adds a Register a Sync Generator recipe under Extending Nx Recipes

---------

Co-authored-by: James Henry <james@henry.sc>
This commit is contained in:
Isaac Mann 2024-09-12 07:30:46 -04:00 committed by GitHub
parent b6140d4590
commit 4517d9f721
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 514 additions and 2 deletions

View File

@ -0,0 +1,24 @@
---
title: 'sync:check - CLI command'
description: 'Check that no changes are required after running all sync generators.'
---
# sync:check
Check that no changes are required after running all sync generators.
## Usage
```shell
nx sync:check
```
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
## Options
| Option | Type | Description |
| ----------- | ------- | ---------------------------------------------------------------------- |
| `--help` | boolean | Show help. |
| `--verbose` | boolean | Prints additional information about the commands (e.g., stack traces). |
| `--version` | boolean | Show version number. |

View File

@ -0,0 +1,24 @@
---
title: 'sync - CLI command'
description: 'Sync the workspace files by running all the sync generators.'
---
# sync
Sync the workspace files by running all the sync generators.
## Usage
```shell
nx sync
```
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
## Options
| Option | Type | Description |
| ----------- | ------- | ---------------------------------------------------------------------- |
| `--help` | boolean | Show help. |
| `--verbose` | boolean | Prints additional information about the commands (e.g., stack traces). |
| `--version` | boolean | Show version number. |

View File

@ -151,6 +151,17 @@
"path": "/extending-nx/recipes/modifying-files", "path": "/extending-nx/recipes/modifying-files",
"tags": ["generate-code"] "tags": ["generate-code"]
}, },
{
"id": "create-sync-generator",
"name": "Create a Sync Generator",
"description": "",
"mediaImage": "",
"file": "shared/recipes/generators/create-sync-generator",
"itemList": [],
"isExternal": false,
"path": "/extending-nx/recipes/create-sync-generator",
"tags": ["generate-code"]
},
{ {
"id": "migration-generators", "id": "migration-generators",
"name": "Write a Migration", "name": "Write a Migration",
@ -288,6 +299,17 @@
"path": "/extending-nx/recipes/modifying-files", "path": "/extending-nx/recipes/modifying-files",
"tags": ["generate-code"] "tags": ["generate-code"]
}, },
"/extending-nx/recipes/create-sync-generator": {
"id": "create-sync-generator",
"name": "Create a Sync Generator",
"description": "",
"mediaImage": "",
"file": "shared/recipes/generators/create-sync-generator",
"itemList": [],
"isExternal": false,
"path": "/extending-nx/recipes/create-sync-generator",
"tags": ["generate-code"]
},
"/extending-nx/recipes/migration-generators": { "/extending-nx/recipes/migration-generators": {
"id": "migration-generators", "id": "migration-generators",
"name": "Write a Migration", "name": "Write a Migration",

View File

@ -622,6 +622,14 @@
"children": [], "children": [],
"disableCollapsible": false "disableCollapsible": false
}, },
{
"name": "Sync Generators",
"path": "/concepts/sync-generators",
"id": "sync-generators",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{ {
"name": "Nx and Turborepo", "name": "Nx and Turborepo",
"path": "/concepts/turbo-and-nx", "path": "/concepts/turbo-and-nx",
@ -827,6 +835,14 @@
"children": [], "children": [],
"disableCollapsible": false "disableCollapsible": false
}, },
{
"name": "Sync Generators",
"path": "/concepts/sync-generators",
"id": "sync-generators",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{ {
"name": "Nx and Turborepo", "name": "Nx and Turborepo",
"path": "/concepts/turbo-and-nx", "path": "/concepts/turbo-and-nx",
@ -5123,6 +5139,14 @@
"children": [], "children": [],
"disableCollapsible": false "disableCollapsible": false
}, },
{
"name": "Create a Sync Generator",
"path": "/extending-nx/recipes/create-sync-generator",
"id": "create-sync-generator",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{ {
"name": "Write a Migration", "name": "Write a Migration",
"path": "/extending-nx/recipes/migration-generators", "path": "/extending-nx/recipes/migration-generators",
@ -5222,6 +5246,14 @@
"children": [], "children": [],
"disableCollapsible": false "disableCollapsible": false
}, },
{
"name": "Create a Sync Generator",
"path": "/extending-nx/recipes/create-sync-generator",
"id": "create-sync-generator",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{ {
"name": "Write a Migration", "name": "Write a Migration",
"path": "/extending-nx/recipes/migration-generators", "path": "/extending-nx/recipes/migration-generators",
@ -8713,6 +8745,22 @@
"children": [], "children": [],
"disableCollapsible": false "disableCollapsible": false
}, },
{
"name": "sync",
"path": "/nx-api/nx/documents/sync",
"id": "sync",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{
"name": "sync:check",
"path": "/nx-api/nx/documents/sync-check",
"id": "sync-check",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{ {
"name": "exec", "name": "exec",
"path": "/nx-api/nx/documents/exec", "path": "/nx-api/nx/documents/exec",

View File

@ -1902,6 +1902,28 @@
"tags": [], "tags": [],
"originalFilePath": "generated/cli/repair" "originalFilePath": "generated/cli/repair"
}, },
"/nx-api/nx/documents/sync": {
"id": "sync",
"name": "sync",
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
"file": "generated/packages/nx/documents/sync",
"itemList": [],
"isExternal": false,
"path": "/nx-api/nx/documents/sync",
"tags": [],
"originalFilePath": "generated/cli/sync"
},
"/nx-api/nx/documents/sync-check": {
"id": "sync-check",
"name": "sync:check",
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
"file": "generated/packages/nx/documents/sync-check",
"itemList": [],
"isExternal": false,
"path": "/nx-api/nx/documents/sync-check",
"tags": [],
"originalFilePath": "generated/cli/sync-check"
},
"/nx-api/nx/documents/exec": { "/nx-api/nx/documents/exec": {
"id": "exec", "id": "exec",
"name": "exec", "name": "exec",

View File

@ -848,6 +848,17 @@
"path": "/concepts/nx-daemon", "path": "/concepts/nx-daemon",
"tags": [] "tags": []
}, },
{
"id": "sync-generators",
"name": "Sync Generators",
"description": "",
"mediaImage": "",
"file": "shared/concepts/sync-generators",
"itemList": [],
"isExternal": false,
"path": "/concepts/sync-generators",
"tags": []
},
{ {
"id": "turbo-and-nx", "id": "turbo-and-nx",
"name": "Nx and Turborepo", "name": "Nx and Turborepo",
@ -1130,6 +1141,17 @@
"path": "/concepts/nx-daemon", "path": "/concepts/nx-daemon",
"tags": [] "tags": []
}, },
"/concepts/sync-generators": {
"id": "sync-generators",
"name": "Sync Generators",
"description": "",
"mediaImage": "",
"file": "shared/concepts/sync-generators",
"itemList": [],
"isExternal": false,
"path": "/concepts/sync-generators",
"tags": []
},
"/concepts/turbo-and-nx": { "/concepts/turbo-and-nx": {
"id": "turbo-and-nx", "id": "turbo-and-nx",
"name": "Nx and Turborepo", "name": "Nx and Turborepo",

View File

@ -337,6 +337,13 @@
"name": "Modify Files", "name": "Modify Files",
"path": "/extending-nx/recipes/modifying-files" "path": "/extending-nx/recipes/modifying-files"
}, },
{
"description": "",
"file": "shared/recipes/generators/create-sync-generator",
"id": "create-sync-generator",
"name": "Create a Sync Generator",
"path": "/extending-nx/recipes/create-sync-generator"
},
{ {
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.", "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
"file": "generated/packages/nx/documents/generate", "file": "generated/packages/nx/documents/generate",

View File

@ -1881,6 +1881,28 @@
"tags": [], "tags": [],
"originalFilePath": "generated/cli/repair" "originalFilePath": "generated/cli/repair"
}, },
{
"id": "sync",
"name": "sync",
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
"file": "generated/packages/nx/documents/sync",
"itemList": [],
"isExternal": false,
"path": "nx/documents/sync",
"tags": [],
"originalFilePath": "generated/cli/sync"
},
{
"id": "sync-check",
"name": "sync:check",
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
"file": "generated/packages/nx/documents/sync-check",
"itemList": [],
"isExternal": false,
"path": "nx/documents/sync-check",
"tags": [],
"originalFilePath": "generated/cli/sync-check"
},
{ {
"id": "exec", "id": "exec",
"name": "exec", "name": "exec",

View File

@ -0,0 +1,24 @@
---
title: 'sync:check - CLI command'
description: 'Check that no changes are required after running all sync generators.'
---
# sync:check
Check that no changes are required after running all sync generators.
## Usage
```shell
nx sync:check
```
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
## Options
| Option | Type | Description |
| ----------- | ------- | ---------------------------------------------------------------------- |
| `--help` | boolean | Show help. |
| `--verbose` | boolean | Prints additional information about the commands (e.g., stack traces). |
| `--version` | boolean | Show version number. |

View File

@ -0,0 +1,24 @@
---
title: 'sync - CLI command'
description: 'Sync the workspace files by running all the sync generators.'
---
# sync
Sync the workspace files by running all the sync generators.
## Usage
```shell
nx sync
```
Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.
## Options
| Option | Type | Description |
| ----------- | ------- | ---------------------------------------------------------------------- |
| `--help` | boolean | Show help. |
| `--verbose` | boolean | Prints additional information about the commands (e.g., stack traces). |
| `--version` | boolean | Show version number. |

View File

@ -246,6 +246,11 @@
"id": "nx-daemon", "id": "nx-daemon",
"file": "shared/concepts/daemon" "file": "shared/concepts/daemon"
}, },
{
"name": "Sync Generators",
"id": "sync-generators",
"file": "shared/concepts/sync-generators"
},
{ {
"name": "Nx and Turborepo", "name": "Nx and Turborepo",
"id": "turbo-and-nx", "id": "turbo-and-nx",
@ -1532,6 +1537,12 @@
"tags": ["generate-code"], "tags": ["generate-code"],
"file": "shared/recipes/generators/modifying-files" "file": "shared/recipes/generators/modifying-files"
}, },
{
"name": "Create a Sync Generator",
"id": "create-sync-generator",
"tags": ["generate-code"],
"file": "shared/recipes/generators/create-sync-generator"
},
{ {
"name": "Write a Migration", "name": "Write a Migration",
"id": "migration-generators", "id": "migration-generators",
@ -2090,6 +2101,16 @@
"id": "repair", "id": "repair",
"file": "generated/cli/repair" "file": "generated/cli/repair"
}, },
{
"name": "sync",
"id": "sync",
"file": "generated/cli/sync"
},
{
"name": "sync:check",
"id": "sync-check",
"file": "generated/cli/sync-check"
},
{ {
"name": "exec", "name": "exec",
"id": "exec", "id": "exec",

View File

@ -0,0 +1,53 @@
# Sync Generators
In Nx 19.8, you can use sync generators to ensure that your repository is maintained in a correct state. One specific application is to use the project graph to update files. These can be global configuration files or scripts, or at the task level to ensure that files are in sync before a task is run.
Sync Generator Examples:
- Update a custom CI script with binning strategies based on the current project graph
- Update TypeScript config files with project references based on the current project graph
- Ensure code is formatted in a specific way before CI is run
## Task Sync Generators
Sync generators can be associated with a particular task. Nx will use the sync generator to ensure that code is correctly configured before running the task.
Nx does this in different ways, depending on whether the task is being run on a developer machine or in CI.
On a developer machine, the sync generator is run in `--dry-run` mode and if files would be changed by the generator, the user is prompted to run the generator or skip it. This prompt can be disabled by setting the `sync.applyChanges` property to `true` or `false` in the `nx.json` file.
In CI, the sync generator is run in `--dry-run` mode and if files would be changed by the generator, the task fails with an error provided by the sync generator. The sync generator can be skipped in CI by passing the `--skip-sync` flag when executing the task or you can skip an individual sync generator by adding that generator to the `sync.disabledTaskSyncGenerators` in `nx.json`.
Task sync generators can be thought of like the `dependsOn` property, but for generators instead of task dependencies.
To [register a generator](/extending-nx/recipes/create-sync-generator) as a sync generator for a particular task, add the generator to the `syncGenerators` property of the task configuration.
## Global Sync Generators
Global sync generators are not associated with a particular task and are executed only when the `nx sync` or `nx sync:check` command is explicitly run. They are [registered](/extending-nx/recipes/create-sync-generator) in the `nx.json` file with the `sync.globalGenerators` property.
## Sync the Project Graph and the File System
Nx processes the file system in order to [create the project graph](/features/explore-graph) which is used to run tasks in the correct order and determine project dependencies. Sync generators allow you to also go the other direction and use the project graph to update the file system.
{% side-by-side %}
```{% fileName="File System" %}
└─ myorg
├─ apps
│ ├─ app1
│ └─ app1
├─ libs
│ └─ lib
├─ nx.json
└─ package.json
```
{% graph title="Project Graph" height="200px" type="project" jsonFile="shared/mental-model/three-projects.json" %}
{% /graph %}
{% /side-by-side %}
The ability to update the file system from the project graph makes it possible to use the Nx project graph to change the behavior of other tools that are not part of the Nx ecosystem.
## Run `nx sync:check` in CI
Task sync generators are executed whenever their task is run, but global sync generators need to be triggered manually with `nx sync`. In order to effectively use sync generators, make sure to add `nx sync:check` to the beginning of your CI scripts so that CI can fail quickly if the code is out of sync. It is also helpful to run `nx sync` in a pre-commit or pre-push Git hook to encourage developers to commit code that is already in sync.

View File

@ -0,0 +1,135 @@
# Create a Sync Generator
Sync generators are generators that are used to ensure that your file system is in the correct state before a task is run or the CI process is started. From a technical perspective, a sync generator is no different from any other generator, but it has some additional performance considerations and needs to be registered in a particular way.
## Create a Global Sync Generator
Global sync generators are executed when the `nx sync` or `nx sync:check` command is explicitly run by a user or in a script. They are not associated with an individual task or project and typically update root-level configuration files.
Create a sync generator the same way you would [create any generator](/extending-nx/recipes/local-generators):
```shell
nx g my-sync-generator --directory=tools/my-plugin/src/generators/my-sync-generator
```
A sync generator should be able to run without any required options, so update the schema accordingly:
```jsonc {% fileName="tools/my-plugin/src/generators/my-sync-generator/schema.json" %}
{
"$schema": "https://json-schema.org/schema",
"$id": "MySyncGenerator",
"title": "",
"type": "object",
"properties": {},
"required": []
}
```
Sync generators can optionally return an `outOfSyncMessage` to display to users when the sync generator needs to be run.
```ts {% fileName="tools/my-plugin/src/generators/my-sync-generator/my-sync-generator.ts" %}
import { Tree } from '@nx/devkit';
import { SyncGeneratorResult } from 'nx/src/utils/sync-generators';
export async function mySyncGenerator(
tree: Tree
): Promise<SyncGeneratorResult> {
if (
!tree.exists('/legal-message.txt') ||
tree.read('/legal-message.txt').toString() !==
'This is an important legal message.'
) {
tree.write('/legal-message.txt', 'This is an important legal message.');
}
return {
outOfSyncMessage: 'The legal-message.txt file needs to be created',
};
}
export default mySyncGenerator;
```
### Register a Global Sync Generator
Global sync generators are registered in the `nx.json` file like this:
```jsonc {% fileName="project.json" %}
{
"sync": {
"globalGenerators": ["my-plugin:my-sync-generator"]
}
}
```
Now `my-sync-generator` will be executed any time the `nx sync` command is run.
## Create a Task Sync Generator that Uses the Project Graph
Task sync generators are run before a particular task and are used to ensure that the files are in the correct state for the task to be run. The primary use case for this is to set up configuration files based on the project graph. To read from the project graph, use the [`createProjectGraphAsync`](/nx-api/devkit/documents/createProjectGraphAsync) from the `@nx/devkit` package. Create a generator in the same way as a global sync generator and then read the project graph like this:
```ts {% fileName="tools/my-plugin/src/generators/my-sync-generator/my-sync-generator.ts" %}
import { Tree, createProjectGraphAsync } from '@nx/devkit';
import { SyncGeneratorResult } from 'nx/src/utils/sync-generators';
export async function mySyncGenerator(
tree: Tree
): Promise<SyncGeneratorResult> {
const projectGraph = await createProjectGraphAsync();
Object.values(projectGraph.nodes).forEach((project) => {
tree.write(
joinPathFragments(project.data.root, 'license.txt'),
`${project.name} uses the Acme Corp license.`
);
});
return {
outOfSyncMessage: 'Some projects are missing a license.txt file.',
};
}
export default mySyncGenerator;
```
### Register a Task Sync Generator
To register a generator as a sync generator for a particular task, add the generator to the `syncGenerators` property of the task configuration:
{% tabs %}
{% tab label="package.json" %}
```jsonc {% fileName="apps/my-app/package.json" %}
{
"targets": {
"build": {
"syncGenerators": ["my-plugin:my-sync-generator"]
}
}
}
```
{% /tab %}
{% tab label="project.json" %}
```jsonc {% fileName="apps/my-app/project.json" %}
{
"targets": {
"build": {
"syncGenerators": ["my-plugin:my-sync-generator"]
}
}
}
```
{% /tab %}
{% /tabs %}
With this configuration in place, running `nx build my-app` will first run `my-sync-generator` and then run the `build` task. The `my-sync-generator` and any other task or global sync generators will be run when `nx sync` or `nx sync:check` is run.
## Performance and DX Considerations
Task sync generators will block the execution of the task while they are running and both global and task sync generators will block the CI pipeline until the `nx sync:check` command finishes. Because of this, make sure to keep in mind the following performance tips:
- Make the generator idempotent. Running the generator multiple times in a row should have the same impact as running the generator a single time.
- Only write to the file system when a file is actually changed. Avoid reformatting files that have not been actually modified. Nx will identify the workspace as out of sync if there's any file change after the sync generator is run.
- Make sure to provide an informative `outOfSyncMessage` so that developers know what to do to unblock their tasks.
Do whatever you can to make your sync generators as fast and user-friendly as possible, because users will be running them over and over again without even realizing it.

View File

@ -98,6 +98,22 @@ nx repair
{% link-card title="nx repair" type="API Reference" url="/nx-api/nx/documents/repair" /%} {% link-card title="nx repair" type="API Reference" url="/nx-api/nx/documents/repair" /%}
{% /cards %} {% /cards %}
### sync
Run all sync generators
```shell
nx sync
nx sync:check
```
{% cards %}
{% link-card title="nx sync" type="API Reference" url="/nx-api/nx/documents/sync" /%}
{% link-card title="nx sync:check" type="API Reference" url="/nx-api/nx/documents/sync-check" /%}
{% link-card title="Sync Generators" type="Concept" url="/concepts/sync-generators" /%}
{% link-card title="Register a Sync Generator" type="Recipe" url="/extending-nx/recipes/create-sync-generator" /%}
{% /cards %}
### format ### format
Overwrite un-formatted files or check for un-formatted files Overwrite un-formatted files or check for un-formatted files

View File

@ -55,6 +55,9 @@ The following is an expanded example showing all options. Your `nx.json` will li
"projectChangelogs": true "projectChangelogs": true
} }
}, },
"sync": {
"globalGenerators": ["my-plugin:my-sync-generator"]
},
"generators": { "generators": {
"@nx/js:library": { "@nx/js:library": {
"buildable": true "buildable": true
@ -507,6 +510,32 @@ The `git` property configures the automated git operations that take place as pa
} }
``` ```
## Sync
These are global configuration options for the [`nx sync`](/reference/nx-commands#sync) command. The `nx sync` command runs all global and task-specific [sync generators](/concepts/sync-generators) to ensure that your files are in the correct state to run tasks or start the CI process.
```jsonc {% fileName="nx.json" %}
{
"sync": {
"applyChanges": true,
"globalGenerators": ["my-plugin:my-sync-generator"],
"generatorOptions": {
"my-plugin:my-sync-generator": {
"verbose": true
}
},
"disabledTaskSyncGenerators": ["other-plugin:problematic-generator"]
}
}
```
| Property | Description |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **applyChanges** | Whether to automatically apply task sync generator changes when running tasks. If not set, the user will be prompted. If set to `true`, the user will not be prompted and the changes will be applied. If set to `false`, the user will not be prompted and the changes will not be applied. |
| **globalGenerators** | Sync generators that are only run when the `nx sync` command is executed. These are not associated with a particular task. |
| **generatorOptions** | Options to be passed to sync generators |
| **disabledTaskSyncGenerators** | Globally disable specific task sync generators |
## Generators ## Generators
Default generator options can be configured in `nx.json`. For instance, the following tells Nx to always Default generator options can be configured in `nx.json`. For instance, the following tells Nx to always

View File

@ -616,6 +616,20 @@ Additionally, when using the expanded object syntax, you can specify individual
This configuration is usually not needed. Nx comes with reasonable defaults (imported in `nx.json`) which implement the This configuration is usually not needed. Nx comes with reasonable defaults (imported in `nx.json`) which implement the
configuration above. configuration above.
### Sync Generators
In the same way that `dependsOn` tells Nx to run another task before running this task, the `syncGenerator` property tells Nx to run a generator to ensure that your files are in the correct state before this task is run. [Sync generators](/concepts/sync-generators) are especially useful for keeping configuration files up to date with the project graph. Sync generators are available in Nx 19.8+.
```json
{
"targets": {
"build": {
"syncGenerators": ["some-plugin:my-sync-generator"]
}
}
}
```
### Executor/command options ### Executor/command options
To define what a task does, you must configure which command or executor will run when the task is executed. In the case of [inferred tasks](/concepts/inferred-tasks) you can provide project-specific overrides. As an example, if your repo has projects with a `build` inferred target running the `vite build` command, you can provide some extra options as follows: To define what a task does, you must configure which command or executor will run when the task is executed. In the case of [inferred tasks](/concepts/inferred-tasks) you can provide project-specific overrides. As an example, if your repo has projects with a `build` inferred target running the `vite build` command, you can provide some extra options as follows:

View File

@ -32,6 +32,7 @@
- [Executors and Configurations](/concepts/executors-and-configurations) - [Executors and Configurations](/concepts/executors-and-configurations)
- [Integrated Repos vs. Package-Based Repos vs. Standalone Apps](/concepts/integrated-vs-package-based) - [Integrated Repos vs. Package-Based Repos vs. Standalone Apps](/concepts/integrated-vs-package-based)
- [Nx Daemon](/concepts/nx-daemon) - [Nx Daemon](/concepts/nx-daemon)
- [Sync Generators](/concepts/sync-generators)
- [Nx and Turborepo](/concepts/turbo-and-nx) - [Nx and Turborepo](/concepts/turbo-and-nx)
- [Buildable and Publishable Libraries](/concepts/buildable-and-publishable-libraries) - [Buildable and Publishable Libraries](/concepts/buildable-and-publishable-libraries)
- [Module Federation](/concepts/module-federation) - [Module Federation](/concepts/module-federation)
@ -240,6 +241,7 @@
- [Provide Options for Generators](/extending-nx/recipes/generator-options) - [Provide Options for Generators](/extending-nx/recipes/generator-options)
- [Create Files](/extending-nx/recipes/creating-files) - [Create Files](/extending-nx/recipes/creating-files)
- [Modify Files](/extending-nx/recipes/modifying-files) - [Modify Files](/extending-nx/recipes/modifying-files)
- [Create a Sync Generator](/extending-nx/recipes/create-sync-generator)
- [Write a Migration](/extending-nx/recipes/migration-generators) - [Write a Migration](/extending-nx/recipes/migration-generators)
- [Write a Simple Executor](/extending-nx/recipes/local-executors) - [Write a Simple Executor](/extending-nx/recipes/local-executors)
- [Compose Executors](/extending-nx/recipes/compose-executors) - [Compose Executors](/extending-nx/recipes/compose-executors)
@ -555,6 +557,8 @@
- [connect-to-nx-cloud](/nx-api/nx/documents/connect-to-nx-cloud) - [connect-to-nx-cloud](/nx-api/nx/documents/connect-to-nx-cloud)
- [reset](/nx-api/nx/documents/reset) - [reset](/nx-api/nx/documents/reset)
- [repair](/nx-api/nx/documents/repair) - [repair](/nx-api/nx/documents/repair)
- [sync](/nx-api/nx/documents/sync)
- [sync:check](/nx-api/nx/documents/sync-check)
- [exec](/nx-api/nx/documents/exec) - [exec](/nx-api/nx/documents/exec)
- [watch](/nx-api/nx/documents/watch) - [watch](/nx-api/nx/documents/watch)
- [show](/nx-api/nx/documents/show) - [show](/nx-api/nx/documents/show)

View File

@ -10,7 +10,7 @@ export const yargsSyncCommand: CommandModule<
SyncArgs SyncArgs
> = { > = {
command: 'sync', command: 'sync',
describe: false, describe: 'Sync the workspace files by running all the sync generators.',
builder: (yargs) => withVerbose(yargs), builder: (yargs) => withVerbose(yargs),
handler: async (args) => { handler: async (args) => {
process.exit(await import('./sync').then((m) => m.syncHandler(args))); process.exit(await import('./sync').then((m) => m.syncHandler(args)));
@ -22,7 +22,8 @@ export const yargsSyncCheckCommand: CommandModule<
SyncArgs SyncArgs
> = { > = {
command: 'sync:check', command: 'sync:check',
describe: false, describe:
'Check that no changes are required after running all sync generators.',
builder: (yargs) => withVerbose(yargs), builder: (yargs) => withVerbose(yargs),
handler: async (args) => { handler: async (args) => {
process.exit( process.exit(