You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(core): allow opting out of sorting root tsconfig path mappings with an env var (#31763)
## Current Behavior
Currently, users can opt out of sorting the root tsconfig file path
mappings by providing `--sort-root-tsconfig-paths=false` to the `nx
format` commands, or by providing `{ sortRootTsconfigPaths: false }` to
the `formatFiles` function when invoked programmatically. Still, Nx
generators sort the root tsconfig file path mappings by default, and the
only way to bypass that is to run two different commands:
```bash
nx g component path/to/component --skip-format
nx format:write --sort-root-tsconfig-paths=false
```
## Expected Behavior
Users should be able to easily opt out of sorting the root tsconfig file
path mappings by setting the `NX_FORMAT_SORT_TSCONFIG_PATHS` environment
variable to `false`. With that set, all the relevant commands, including
`nx generate` will respect it.
## Related Issue(s)
Fixes#29043
|`--base`| string | Base of the current branch (usually main). |
24
-
|`--exclude`| string | Exclude certain projects from being processed. |
25
-
|`--files`| string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26
-
|`--head`| string | Latest commit of the current branch (usually HEAD). |
27
-
|`--help`| boolean | Show help. |
28
-
|`--libs-and-apps`| boolean | Format only libraries and applications files. |
29
-
|`--projects`| string | Projects to format (comma/space delimited). |
30
-
|`--sort-root-tsconfig-paths`| boolean | Ensure the workspace's tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. (Default: `true`)|
|`--base`| string | Base of the current branch (usually main). |
24
+
|`--exclude`| string | Exclude certain projects from being processed. |
25
+
|`--files`| string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26
+
|`--head`| string | Latest commit of the current branch (usually HEAD). |
27
+
|`--help`| boolean | Show help. |
28
+
|`--libs-and-apps`| boolean | Format only libraries and applications files. |
29
+
|`--projects`| string | Projects to format (comma/space delimited). |
30
+
|`--sort-root-tsconfig-paths`| boolean | Ensure the workspace's tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. The default value is "true" unless NX_FORMAT_SORT_TSCONFIG_PATHS is set to "false".|
|`--base`| string | Base of the current branch (usually main). |
24
-
|`--exclude`| string | Exclude certain projects from being processed. |
25
-
|`--files`| string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26
-
|`--head`| string | Latest commit of the current branch (usually HEAD). |
27
-
|`--help`| boolean | Show help. |
28
-
|`--libs-and-apps`| boolean | Format only libraries and applications files. |
29
-
|`--projects`| string | Projects to format (comma/space delimited). |
30
-
|`--sort-root-tsconfig-paths`| boolean | Ensure the workspace's tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. (Default: `true`)|
|`--base`| string | Base of the current branch (usually main). |
24
+
|`--exclude`| string | Exclude certain projects from being processed. |
25
+
|`--files`| string | Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces. |
26
+
|`--head`| string | Latest commit of the current branch (usually HEAD). |
27
+
|`--help`| boolean | Show help. |
28
+
|`--libs-and-apps`| boolean | Format only libraries and applications files. |
29
+
|`--projects`| string | Projects to format (comma/space delimited). |
30
+
|`--sort-root-tsconfig-paths`| boolean | Ensure the workspace's tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. The default value is "true" unless NX_FORMAT_SORT_TSCONFIG_PATHS is set to "false".|
|`tree`|[`Tree`](/reference/core-api/devkit/documents/Tree)| the file system tree|
12
-
|`options?`|`Object`|- |
13
-
|`options.sortRootTsconfigPaths`|`boolean`|TODO(v21): Stop sorting tsconfig paths by default, paths are now less common/important in Nx workspace setups, and the sorting causes comments to be lost.|
0 commit comments