nx 19.1.0-canary.20240522-89fdd42 → 19.1.0-canary.20240523-261b0ff

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",
3
- "version": "19.1.0-canary.20240522-89fdd42",
3
+ "version": "19.1.0-canary.20240523-261b0ff",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -20,7 +20,11 @@
20
20
  "Nest",
21
21
  "Jest",
22
22
  "Cypress",
23
- "CLI"
23
+ "CLI",
24
+ "Testing",
25
+ "Front-end",
26
+ "Backend",
27
+ "Mobile"
24
28
  ],
25
29
  "bin": {
26
30
  "nx": "./bin/nx.js",
@@ -65,7 +69,7 @@
65
69
  "yargs-parser": "21.1.1",
66
70
  "node-machine-id": "1.1.12",
67
71
  "ora": "5.3.0",
68
- "@nrwl/tao": "19.1.0-canary.20240522-89fdd42"
72
+ "@nrwl/tao": "19.1.0-canary.20240523-261b0ff"
69
73
  },
70
74
  "peerDependencies": {
71
75
  "@swc-node/register": "^1.8.0",
@@ -80,16 +84,16 @@
80
84
  }
81
85
  },
82
86
  "optionalDependencies": {
83
- "@nx/nx-darwin-x64": "19.1.0-canary.20240522-89fdd42",
84
- "@nx/nx-darwin-arm64": "19.1.0-canary.20240522-89fdd42",
85
- "@nx/nx-linux-x64-gnu": "19.1.0-canary.20240522-89fdd42",
86
- "@nx/nx-linux-x64-musl": "19.1.0-canary.20240522-89fdd42",
87
- "@nx/nx-win32-x64-msvc": "19.1.0-canary.20240522-89fdd42",
88
- "@nx/nx-linux-arm64-gnu": "19.1.0-canary.20240522-89fdd42",
89
- "@nx/nx-linux-arm64-musl": "19.1.0-canary.20240522-89fdd42",
90
- "@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.20240522-89fdd42",
91
- "@nx/nx-win32-arm64-msvc": "19.1.0-canary.20240522-89fdd42",
92
- "@nx/nx-freebsd-x64": "19.1.0-canary.20240522-89fdd42"
87
+ "@nx/nx-darwin-x64": "19.1.0-canary.20240523-261b0ff",
88
+ "@nx/nx-darwin-arm64": "19.1.0-canary.20240523-261b0ff",
89
+ "@nx/nx-linux-x64-gnu": "19.1.0-canary.20240523-261b0ff",
90
+ "@nx/nx-linux-x64-musl": "19.1.0-canary.20240523-261b0ff",
91
+ "@nx/nx-win32-x64-msvc": "19.1.0-canary.20240523-261b0ff",
92
+ "@nx/nx-linux-arm64-gnu": "19.1.0-canary.20240523-261b0ff",
93
+ "@nx/nx-linux-arm64-musl": "19.1.0-canary.20240523-261b0ff",
94
+ "@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.20240523-261b0ff",
95
+ "@nx/nx-win32-arm64-msvc": "19.1.0-canary.20240523-261b0ff",
96
+ "@nx/nx-freebsd-x64": "19.1.0-canary.20240523-261b0ff"
93
97
  },
94
98
  "nx-migrations": {
95
99
  "migrations": "./migrations.json",
@@ -366,7 +366,7 @@
366
366
  "packageManager": {
367
367
  "type": "string",
368
368
  "description": "The default package manager to use.",
369
- "enum": ["yarn", "pnpm", "npm"]
369
+ "enum": ["yarn", "pnpm", "npm", "bun"]
370
370
  }
371
371
  }
372
372
  },
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.format = void 0;
4
- const child_process_1 = require("child_process");
5
- const path = require("path");
4
+ const node_child_process_1 = require("node:child_process");
5
+ const path = require("node:path");
6
+ const file_utils_1 = require("../../project-graph/file-utils");
6
7
  const command_line_utils_1 = require("../../utils/command-line-utils");
7
- const ignore_1 = require("../../utils/ignore");
8
8
  const fileutils_1 = require("../../utils/fileutils");
9
- const file_utils_1 = require("../../project-graph/file-utils");
9
+ const ignore_1 = require("../../utils/ignore");
10
10
  const prettier = require("prettier");
11
- const object_sort_1 = require("../../utils/object-sort");
12
- const package_json_1 = require("../../utils/package-json");
11
+ const configuration_1 = require("../../config/configuration");
13
12
  const typescript_1 = require("../../plugins/js/utils/typescript");
14
- const project_graph_1 = require("../../project-graph/project-graph");
15
13
  const affected_project_graph_1 = require("../../project-graph/affected/affected-project-graph");
16
- const configuration_1 = require("../../config/configuration");
17
- const chunkify_1 = require("../../utils/chunkify");
14
+ const project_graph_1 = require("../../project-graph/project-graph");
18
15
  const all_file_data_1 = require("../../utils/all-file-data");
19
- const workspace_root_1 = require("../../utils/workspace-root");
16
+ const chunkify_1 = require("../../utils/chunkify");
17
+ const object_sort_1 = require("../../utils/object-sort");
20
18
  const output_1 = require("../../utils/output");
19
+ const package_json_1 = require("../../utils/package-json");
20
+ const workspace_root_1 = require("../../utils/workspace-root");
21
21
  const PRETTIER_PATH = getPrettierPath();
22
22
  async function format(command, args) {
23
23
  const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
@@ -33,12 +33,31 @@ async function format(command, args) {
33
33
  addRootConfigFiles(chunkList, nxArgs);
34
34
  chunkList.forEach((chunk) => write(chunk));
35
35
  break;
36
- case 'check':
37
- const pass = chunkList.reduce((pass, chunk) => check(chunk) && pass, true);
38
- if (!pass) {
36
+ case 'check': {
37
+ const filesWithDifferentFormatting = [];
38
+ for (const chunk of chunkList) {
39
+ const files = await check(chunk);
40
+ filesWithDifferentFormatting.push(...files);
41
+ }
42
+ if (filesWithDifferentFormatting.length > 0) {
43
+ if (nxArgs.verbose) {
44
+ output_1.output.error({
45
+ title: 'The following files are not formatted correctly based on your Prettier configuration',
46
+ bodyLines: [
47
+ '- Run "nx format:write" and commit the resulting diff to fix these files.',
48
+ '- Please note, Prettier does not support a native way to diff the output of its check logic (https://github.com/prettier/prettier/issues/6885).',
49
+ '',
50
+ ...filesWithDifferentFormatting,
51
+ ],
52
+ });
53
+ }
54
+ else {
55
+ console.log(filesWithDifferentFormatting.join('\n'));
56
+ }
39
57
  process.exit(1);
40
58
  }
41
59
  break;
60
+ }
42
61
  }
43
62
  }
44
63
  exports.format = format;
@@ -113,29 +132,32 @@ function write(patterns) {
113
132
  result[pattern.includes('.swcrc') ? 0 : 1].push(pattern);
114
133
  return result;
115
134
  }, [[], []]);
116
- (0, child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${regularPatterns.join(' ')}`, {
135
+ (0, node_child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${regularPatterns.join(' ')}`, {
117
136
  stdio: [0, 1, 2],
118
137
  });
119
138
  if (swcrcPatterns.length > 0) {
120
- (0, child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${swcrcPatterns.join(' ')} --parser json`, {
139
+ (0, node_child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${swcrcPatterns.join(' ')} --parser json`, {
121
140
  stdio: [0, 1, 2],
122
141
  });
123
142
  }
124
143
  }
125
144
  }
126
- function check(patterns) {
145
+ async function check(patterns) {
127
146
  if (patterns.length === 0) {
128
- return true;
147
+ return [];
129
148
  }
130
- try {
131
- (0, child_process_1.execSync)(`node "${PRETTIER_PATH}" --list-different ${patterns.join(' ')}`, {
132
- stdio: [0, 1, 2],
149
+ return new Promise((resolve) => {
150
+ (0, node_child_process_1.exec)(`node "${PRETTIER_PATH}" --list-different ${patterns.join(' ')}`, { encoding: 'utf-8' }, (error, stdout) => {
151
+ if (error) {
152
+ // The command failed so there are files with different formatting. Prettier writes them to stdout, newline separated.
153
+ resolve(stdout.trim().split('\n'));
154
+ }
155
+ else {
156
+ // The command succeeded so there are no files with different formatting
157
+ resolve([]);
158
+ }
133
159
  });
134
- return true;
135
- }
136
- catch {
137
- return false;
138
- }
160
+ });
139
161
  }
140
162
  function sortTsConfig() {
141
163
  try {
@@ -155,6 +155,7 @@ function moveFilesToTempWorkspace(options) {
155
155
  options.packageManager === 'yarn' ? 'yarn.lock' : null,
156
156
  options.packageManager === 'pnpm' ? 'pnpm-lock.yaml' : null,
157
157
  options.packageManager === 'npm' ? 'package-lock.json' : null,
158
+ options.packageManager === 'bun' ? 'bun.lockb' : null,
158
159
  ];
159
160
  const optionalCraFiles = ['README.md'];
160
161
  const filesToMove = [...requiredCraFiles, ...optionalCraFiles].filter(Boolean);