Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nrwl/nx/llms.txt
Use this file to discover all available pages before exploring further.
nx g
nx generate runs a generator to create, modify, or delete files in your workspace. Generators are provided by Nx plugins (e.g., @nx/react, @nx/js) and can also be defined locally in your workspace.
Arguments
The generator to run, in the format
collection:generator (e.g., @nx/react:application) or just generator if the collection can be inferred.Options
Preview the file changes that would be made without actually writing them to disk. Alias:
-d. Also enabled by setting NX_DRY_RUN=true.When
false, disables interactive input prompts for generator options. All required options must be provided as flags. Also controlled by NX_INTERACTIVE=false.Hides logs from file system operations (e.g.,
CREATE package.json). Cannot be used together with --verbose.Prints additional information about the generation process, including stack traces on error. Cannot be used together with
--quiet.Listing available generators
Usenx list to discover generators from installed plugins:
--help after the generator name:
Examples
Generator options vary by plugin and generator. Always check the generator’s schema with
--help before running.Workspace generators
You can define your own generators locally intools/generators. Run them by their name without a collection prefix:
