@nx/devkit 20.1.0-canary.20241018-f971c1b → 20.1.0-canary.20241022-e57b851

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/devkit",
3
- "version": "20.1.0-canary.20241018-f971c1b",
3
+ "version": "20.1.0-canary.20241022-e57b851",
4
4
  "private": false,
5
5
  "description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
6
6
  "repository": {
@@ -3,4 +3,10 @@ import { Tree } from 'nx/src/devkit-exports';
3
3
  * Formats all the created or updated files using Prettier
4
4
  * @param tree - the file system tree
5
5
  */
6
- export declare function formatFiles(tree: Tree): Promise<void>;
6
+ export declare function formatFiles(tree: Tree, options?: {
7
+ /**
8
+ * TODO(v21): Stop sorting tsconfig paths by default, paths are now less common/important
9
+ * in Nx workspace setups, and the sorting causes comments to be lost.
10
+ */
11
+ sortRootTsconfigPaths: boolean;
12
+ }): Promise<void>;
@@ -8,13 +8,21 @@ const devkit_internals_1 = require("nx/src/devkit-internals");
8
8
  * Formats all the created or updated files using Prettier
9
9
  * @param tree - the file system tree
10
10
  */
11
- async function formatFiles(tree) {
11
+ async function formatFiles(tree, options = {
12
+ /**
13
+ * TODO(v21): Stop sorting tsconfig paths by default, paths are now less common/important
14
+ * in Nx workspace setups, and the sorting causes comments to be lost.
15
+ */
16
+ sortRootTsconfigPaths: true,
17
+ }) {
12
18
  let prettier;
13
19
  try {
14
20
  prettier = await Promise.resolve().then(() => require('prettier'));
15
21
  }
16
22
  catch { }
17
- sortTsConfig(tree);
23
+ if (options.sortRootTsconfigPaths) {
24
+ sortTsConfig(tree);
25
+ }
18
26
  if (!prettier)
19
27
  return;
20
28
  const files = new Set(tree.listChanges().filter((file) => file.type !== 'DELETE'));