@nx/devkit 22.5.0 → 22.6.0-beta.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2025 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2026 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/devkit",
3
- "version": "22.5.0",
3
+ "version": "22.6.0-beta.0",
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": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "jest": "^30.0.2",
41
- "nx": "22.5.0"
41
+ "nx": "22.6.0-beta.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "nx": ">= 21 <= 23 || ^22.0.0-0"
@@ -3,6 +3,15 @@ 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
  * @param options - options for the formatFiles function
6
+ *
7
+ * @remarks
8
+ * Set the environment variable `NX_SKIP_FORMAT` to `true` to skip Prettier
9
+ * formatting. This is useful for repositories that use alternative formatters
10
+ * like Biome, dprint, or have custom formatting requirements.
11
+ *
12
+ * Note: `NX_SKIP_FORMAT` only skips Prettier formatting. TSConfig path sorting
13
+ * (controlled by `sortRootTsconfigPaths` option or `NX_FORMAT_SORT_TSCONFIG_PATHS`)
14
+ * will still occur.
6
15
  */
7
16
  export declare function formatFiles(tree: Tree, options?: {
8
17
  sortRootTsconfigPaths?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"format-files.d.ts","sourceRoot":"","sources":["../../../../../packages/devkit/src/generators/format-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,IAAI,EAAa,MAAM,uBAAuB,CAAC;AAQlE;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,EACV,OAAO,GAAE;IACP,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAC5B,GACL,OAAO,CAAC,IAAI,CAAC,CA6Df"}
1
+ {"version":3,"file":"format-files.d.ts","sourceRoot":"","sources":["../../../../../packages/devkit/src/generators/format-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,IAAI,EAAa,MAAM,uBAAuB,CAAC;AAQlE;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,EACV,OAAO,GAAE;IACP,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAC5B,GACL,OAAO,CAAC,IAAI,CAAC,CAmEf"}
@@ -8,8 +8,27 @@ const path = require("path");
8
8
  * Formats all the created or updated files using Prettier
9
9
  * @param tree - the file system tree
10
10
  * @param options - options for the formatFiles function
11
+ *
12
+ * @remarks
13
+ * Set the environment variable `NX_SKIP_FORMAT` to `true` to skip Prettier
14
+ * formatting. This is useful for repositories that use alternative formatters
15
+ * like Biome, dprint, or have custom formatting requirements.
16
+ *
17
+ * Note: `NX_SKIP_FORMAT` only skips Prettier formatting. TSConfig path sorting
18
+ * (controlled by `sortRootTsconfigPaths` option or `NX_FORMAT_SORT_TSCONFIG_PATHS`)
19
+ * will still occur.
11
20
  */
12
21
  async function formatFiles(tree, options = {}) {
22
+ options.sortRootTsconfigPaths ??=
23
+ process.env.NX_FORMAT_SORT_TSCONFIG_PATHS === 'true';
24
+ if (options.sortRootTsconfigPaths) {
25
+ sortTsConfig(tree);
26
+ }
27
+ // Skip Prettier formatting if NX_SKIP_FORMAT is set
28
+ // This is checked after tsconfig sorting since sorting is a separate concern
29
+ if (process.env.NX_SKIP_FORMAT === 'true') {
30
+ return;
31
+ }
13
32
  let prettier;
14
33
  try {
15
34
  prettier = await Promise.resolve().then(() => require('prettier'));
@@ -22,11 +41,6 @@ async function formatFiles(tree, options = {}) {
22
41
  }
23
42
  }
24
43
  catch { }
25
- options.sortRootTsconfigPaths ??=
26
- process.env.NX_FORMAT_SORT_TSCONFIG_PATHS === 'true';
27
- if (options.sortRootTsconfigPaths) {
28
- sortTsConfig(tree);
29
- }
30
44
  if (!prettier)
31
45
  return;
32
46
  const files = new Set(tree.listChanges().filter((file) => file.type !== 'DELETE'));