nx 19.0.7 → 19.1.0-beta.1

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/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.dev/reference/configs/workspace-config#cache-options).`);
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).`);
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.7",
3
+ "version": "19.1.0-beta.1",
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,11 +20,7 @@
20
20
  "Nest",
21
21
  "Jest",
22
22
  "Cypress",
23
- "CLI",
24
- "Testing",
25
- "Front-end",
26
- "Backend",
27
- "Mobile"
23
+ "CLI"
28
24
  ],
29
25
  "bin": {
30
26
  "nx": "./bin/nx.js",
@@ -69,7 +65,7 @@
69
65
  "yargs-parser": "21.1.1",
70
66
  "node-machine-id": "1.1.12",
71
67
  "ora": "5.3.0",
72
- "@nrwl/tao": "19.0.7"
68
+ "@nrwl/tao": "19.1.0-beta.1"
73
69
  },
74
70
  "peerDependencies": {
75
71
  "@swc-node/register": "^1.8.0",
@@ -84,16 +80,16 @@
84
80
  }
85
81
  },
86
82
  "optionalDependencies": {
87
- "@nx/nx-darwin-x64": "19.0.7",
88
- "@nx/nx-darwin-arm64": "19.0.7",
89
- "@nx/nx-linux-x64-gnu": "19.0.7",
90
- "@nx/nx-linux-x64-musl": "19.0.7",
91
- "@nx/nx-win32-x64-msvc": "19.0.7",
92
- "@nx/nx-linux-arm64-gnu": "19.0.7",
93
- "@nx/nx-linux-arm64-musl": "19.0.7",
94
- "@nx/nx-linux-arm-gnueabihf": "19.0.7",
95
- "@nx/nx-win32-arm64-msvc": "19.0.7",
96
- "@nx/nx-freebsd-x64": "19.0.7"
83
+ "@nx/nx-darwin-x64": "19.1.0-beta.1",
84
+ "@nx/nx-darwin-arm64": "19.1.0-beta.1",
85
+ "@nx/nx-linux-x64-gnu": "19.1.0-beta.1",
86
+ "@nx/nx-linux-x64-musl": "19.1.0-beta.1",
87
+ "@nx/nx-win32-x64-msvc": "19.1.0-beta.1",
88
+ "@nx/nx-linux-arm64-gnu": "19.1.0-beta.1",
89
+ "@nx/nx-linux-arm64-musl": "19.1.0-beta.1",
90
+ "@nx/nx-linux-arm-gnueabihf": "19.1.0-beta.1",
91
+ "@nx/nx-win32-arm64-msvc": "19.1.0-beta.1",
92
+ "@nx/nx-freebsd-x64": "19.1.0-beta.1"
97
93
  },
98
94
  "nx-migrations": {
99
95
  "migrations": "./migrations.json",
@@ -257,6 +257,10 @@ exports.examples = {
257
257
  },
258
258
  {
259
259
  command: 'show project my-app',
260
+ description: 'If in an interactive terminal, opens the project detail view. If not in an interactive terminal, defaults to JSON.',
261
+ },
262
+ {
263
+ command: 'show project my-app --json',
260
264
  description: 'Show detailed information about "my-app" in a json format.',
261
265
  },
262
266
  {
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.format = void 0;
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");
4
+ const child_process_1 = require("child_process");
5
+ const path = require("path");
7
6
  const command_line_utils_1 = require("../../utils/command-line-utils");
8
- const fileutils_1 = require("../../utils/fileutils");
9
7
  const ignore_1 = require("../../utils/ignore");
8
+ const fileutils_1 = require("../../utils/fileutils");
9
+ const file_utils_1 = require("../../project-graph/file-utils");
10
10
  const prettier = require("prettier");
11
- const configuration_1 = require("../../config/configuration");
11
+ const object_sort_1 = require("../../utils/object-sort");
12
+ const package_json_1 = require("../../utils/package-json");
12
13
  const typescript_1 = require("../../plugins/js/utils/typescript");
13
- const affected_project_graph_1 = require("../../project-graph/affected/affected-project-graph");
14
14
  const project_graph_1 = require("../../project-graph/project-graph");
15
- const all_file_data_1 = require("../../utils/all-file-data");
15
+ const affected_project_graph_1 = require("../../project-graph/affected/affected-project-graph");
16
+ const configuration_1 = require("../../config/configuration");
16
17
  const chunkify_1 = require("../../utils/chunkify");
17
- const object_sort_1 = require("../../utils/object-sort");
18
- const output_1 = require("../../utils/output");
19
- const package_json_1 = require("../../utils/package-json");
18
+ const all_file_data_1 = require("../../utils/all-file-data");
20
19
  const workspace_root_1 = require("../../utils/workspace-root");
20
+ const output_1 = require("../../utils/output");
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,31 +33,12 @@ 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 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
- }
36
+ case 'check':
37
+ const pass = chunkList.reduce((pass, chunk) => check(chunk) && pass, true);
38
+ if (!pass) {
57
39
  process.exit(1);
58
40
  }
59
41
  break;
60
- }
61
42
  }
62
43
  }
63
44
  exports.format = format;
@@ -132,32 +113,29 @@ function write(patterns) {
132
113
  result[pattern.includes('.swcrc') ? 0 : 1].push(pattern);
133
114
  return result;
134
115
  }, [[], []]);
135
- (0, node_child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${regularPatterns.join(' ')}`, {
116
+ (0, child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${regularPatterns.join(' ')}`, {
136
117
  stdio: [0, 1, 2],
137
118
  });
138
119
  if (swcrcPatterns.length > 0) {
139
- (0, node_child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${swcrcPatterns.join(' ')} --parser json`, {
120
+ (0, child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${swcrcPatterns.join(' ')} --parser json`, {
140
121
  stdio: [0, 1, 2],
141
122
  });
142
123
  }
143
124
  }
144
125
  }
145
- async function check(patterns) {
126
+ function check(patterns) {
146
127
  if (patterns.length === 0) {
147
- return [];
128
+ return true;
148
129
  }
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
- }
130
+ try {
131
+ (0, child_process_1.execSync)(`node "${PRETTIER_PATH}" --list-different ${patterns.join(' ')}`, {
132
+ stdio: [0, 1, 2],
159
133
  });
160
- });
134
+ return true;
135
+ }
136
+ catch {
137
+ return false;
138
+ }
161
139
  }
162
140
  function sortTsConfig() {
163
141
  try {
@@ -81,10 +81,9 @@ const showProjectCommand = {
81
81
  alias: 'p',
82
82
  description: 'Which project should be viewed?',
83
83
  })
84
- .default('json', true)
85
84
  .option('web', {
86
85
  type: 'boolean',
87
- description: 'Show project details in the browser',
86
+ description: 'Show project details in the browser. (default when interactive)',
88
87
  })
89
88
  .option('open', {
90
89
  type: 'boolean',
@@ -92,8 +91,15 @@ const showProjectCommand = {
92
91
  implies: 'web',
93
92
  })
94
93
  .check((argv) => {
95
- if (argv.web) {
96
- argv.json = false;
94
+ // If TTY is enabled, default to web. Otherwise, default to JSON.
95
+ const alreadySpecified = argv.web !== undefined || argv.json !== undefined;
96
+ if (!alreadySpecified) {
97
+ if (process.stdout.isTTY) {
98
+ argv.web = true;
99
+ }
100
+ else {
101
+ argv.json = true;
102
+ }
97
103
  }
98
104
  return true;
99
105
  })