nx 19.0.6 → 19.0.8

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/.eslintrc.json CHANGED
@@ -100,8 +100,7 @@
100
100
  "events", // This is coming from @storybook/builder-manager since it uses the browser polyfill
101
101
  "process", // This is coming from @storybook/builder-manager since it uses the browser polyfill
102
102
  "prettier", // This is coming from @storybook/builder-manager since it uses the browser polyfill
103
- "util", // This is coming from @storybook/builder-manager since it uses the browser polyfill
104
- "js-yaml" // The rule is failing with alias dependencies
103
+ "util" // This is coming from @storybook/builder-manager since it uses the browser polyfill
105
104
  ]
106
105
  }
107
106
  ]
package/bin/init-local.js CHANGED
@@ -132,7 +132,7 @@ function handleAngularCLIFallbacks(workspace) {
132
132
  else if (process.argv[2] === 'cache') {
133
133
  console.log(`"ng cache" is not natively supported by Nx.
134
134
  To clear the cache, you can delete the ".angular/cache" directory (or the directory configured by "cli.cache.path" in the "nx.json" file).
135
- To update the cache configuration, you can directly update the relevant options in your "nx.json" file (https://angular.io/guide/workspace-config#cache-options).`);
135
+ To update the cache configuration, you can directly update the relevant options in your "nx.json" file (https://angular.dev/reference/configs/workspace-config#cache-options).`);
136
136
  }
137
137
  else {
138
138
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.0.6",
3
+ "version": "19.0.8",
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",
@@ -35,6 +39,7 @@
35
39
  "dependencies": {
36
40
  "@yarnpkg/lockfile": "^1.1.0",
37
41
  "@yarnpkg/parsers": "3.0.0-rc.46",
42
+ "@zkochan/js-yaml": "0.0.7",
38
43
  "axios": "^1.6.0",
39
44
  "chalk": "^4.1.0",
40
45
  "cli-cursor": "3.1.0",
@@ -48,7 +53,6 @@
48
53
  "fs-extra": "^11.1.0",
49
54
  "ignore": "^5.0.4",
50
55
  "jest-diff": "^29.4.1",
51
- "js-yaml": "npm:@zkochan/js-yaml@0.0.7",
52
56
  "jsonc-parser": "3.2.0",
53
57
  "lines-and-columns": "~2.0.3",
54
58
  "minimatch": "9.0.3",
@@ -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.0.6"
72
+ "@nrwl/tao": "19.0.8"
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.0.6",
84
- "@nx/nx-darwin-arm64": "19.0.6",
85
- "@nx/nx-linux-x64-gnu": "19.0.6",
86
- "@nx/nx-linux-x64-musl": "19.0.6",
87
- "@nx/nx-win32-x64-msvc": "19.0.6",
88
- "@nx/nx-linux-arm64-gnu": "19.0.6",
89
- "@nx/nx-linux-arm64-musl": "19.0.6",
90
- "@nx/nx-linux-arm-gnueabihf": "19.0.6",
91
- "@nx/nx-win32-arm64-msvc": "19.0.6",
92
- "@nx/nx-freebsd-x64": "19.0.6"
87
+ "@nx/nx-darwin-x64": "19.0.8",
88
+ "@nx/nx-darwin-arm64": "19.0.8",
89
+ "@nx/nx-linux-x64-gnu": "19.0.8",
90
+ "@nx/nx-linux-x64-musl": "19.0.8",
91
+ "@nx/nx-win32-x64-msvc": "19.0.8",
92
+ "@nx/nx-linux-arm64-gnu": "19.0.8",
93
+ "@nx/nx-linux-arm64-musl": "19.0.8",
94
+ "@nx/nx-linux-arm-gnueabihf": "19.0.8",
95
+ "@nx/nx-win32-arm64-msvc": "19.0.8",
96
+ "@nx/nx-freebsd-x64": "19.0.8"
93
97
  },
94
98
  "nx-migrations": {
95
99
  "migrations": "./migrations.json",
@@ -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 {
@@ -223,7 +223,7 @@ async function resolveGithubToken() {
223
223
  const ghCLIPath = (0, path_1.joinPathFragments)(process.env.XDG_CONFIG_HOME || (0, path_1.joinPathFragments)((0, node_os_1.homedir)(), '.config'), 'gh', 'hosts.yml');
224
224
  if ((0, node_fs_1.existsSync)(ghCLIPath)) {
225
225
  const yamlContents = await node_fs_1.promises.readFile(ghCLIPath, 'utf8');
226
- const { load } = require('js-yaml');
226
+ const { load } = require('@zkochan/js-yaml');
227
227
  const ghCLIConfig = load(yamlContents);
228
228
  if (ghCLIConfig['github.com']) {
229
229
  // Web based session (the token is already embedded in the config)
@@ -14,7 +14,7 @@ async function resetHandler() {
14
14
  await client_1.daemonClient.stop();
15
15
  output_1.output.log({ title: 'Daemon Server - Stopped' });
16
16
  try {
17
- (0, fs_extra_1.rmSync)(native_file_cache_location_1.nativeFileCacheLocation, { recursive: true, force: true });
17
+ (0, fs_extra_1.rmSync)((0, native_file_cache_location_1.getNativeFileCacheLocation)(), { recursive: true, force: true });
18
18
  }
19
19
  catch (e) {
20
20
  // ignore, deleting the native file cache is not critical and can fail if another process is locking the file