-
Notifications
You must be signed in to change notification settings - Fork 2.6k
docs(nx-dev): fix inputs syntax and document missing object formats #33298
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
31ffa73
f1656c6
ad61b6e
54f6971
2577ed7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,16 +32,28 @@ Source file inputs are defined like this: | |
| ```jsonc | ||
| // nx.json | ||
| { | ||
| "inputs": { | ||
| "{projectRoot}/**/*", // All files in a project | ||
| "{workspaceRoot}/.gitignore", // A specific file in the workspace | ||
| "{projectRoot}/**/*.ts", // A glob pattern for files | ||
| "!{projectRoot}/**/*.spec.ts", // Excluding files matching a glob pattern | ||
| "targetDefaults": { | ||
| "build": { | ||
| "inputs": [ | ||
| "{projectRoot}/**/*", // All files in a project | ||
| "{workspaceRoot}/.gitignore", // A specific file in the workspace | ||
| "{projectRoot}/**/*.ts", // A glob pattern for files | ||
| "!{projectRoot}/**/*.spec.ts" // Excluding files matching a glob pattern | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Source file inputs must be prefixed with either `{projectRoot}` or `{workspaceRoot}` to distinguish where the paths should be resolved from. `{workspaceRoot}` should only appear in the beginning of an input but `{projectRoot}` and `{projectName}` can be specified later in the input to interpolate the root or name of the project into the input location. | ||
| Source file inputs can be specified as strings with glob patterns. These patterns must be prefixed with either `{projectRoot}` or `{workspaceRoot}` to distinguish where the paths should be resolved from. `{workspaceRoot}` should only appear in the beginning of an input but `{projectRoot}` and `{projectName}` can be specified later in the input to interpolate the root or name of the project into the input location. | ||
|
|
||
| Alternatively, you can use the object format with the `fileset` property: | ||
|
|
||
| ```jsonc | ||
| { | ||
| "inputs": [{ "fileset": "{projectRoot}/**/*" }] | ||
| } | ||
| ``` | ||
|
|
||
| #### Token Behavior with Nested Projects | ||
|
|
||
|
|
@@ -155,7 +167,29 @@ The pattern will be matched with outputs of tasks which this task depends on. Se | |
|
|
||
| When a root `tsconfig.json` or `tsconfig.base.json` is present, Nx will always consider parts of the file which apply to the project of a task being run. | ||
| This includes the full `compilerOptions` section and particular path mappings in the `compilerOptions.paths` property. | ||
| This allows Nx to to not invalidate every single task when a path mapping is added or removed from the root `tsconfig.json` file | ||
| This allows Nx to not invalidate every single task when a path mapping is added or removed from the root `tsconfig.json` file | ||
|
|
||
| ### Named Inputs from Other Projects | ||
|
|
||
| You can reference named inputs from specific projects or from project dependencies using the object format with the `input` property: | ||
|
|
||
| ```jsonc | ||
| { | ||
| "inputs": [ | ||
| // Reference a named input from specific project(s) | ||
| { "input": "production", "projects": "mylib" }, | ||
| { "input": "production", "projects": ["mylib", "myapp"] }, | ||
|
|
||
| // Reference a named input from all project dependencies | ||
| { "input": "production", "dependencies": true }, | ||
|
|
||
| // Reference a named input from the current project (equivalent to just using the string) | ||
| { "input": "production" } | ||
|
||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| The `projects` property can be a string or an array of strings specifying which project(s) to reference the named input from. The `dependencies` property, when set to `true`, will reference the named input from all dependencies of the current project. | ||
|
|
||
| ## Named Inputs | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should not be removed