nx 19.6.1 → 19.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/package.json +12 -12
  3. package/src/command-line/add/add.js +1 -5
  4. package/src/command-line/add/command-object.js +1 -5
  5. package/src/command-line/affected/affected.js +0 -3
  6. package/src/command-line/exec/exec.js +0 -3
  7. package/src/command-line/generate/command-object.js +2 -5
  8. package/src/command-line/generate/generate.js +4 -8
  9. package/src/command-line/import/command-object.js +1 -1
  10. package/src/command-line/import/utils/prepare-source-repo.js +2 -2
  11. package/src/command-line/migrate/command-object.js +3 -2
  12. package/src/command-line/migrate/migrate.js +0 -3
  13. package/src/command-line/release/changelog.js +0 -3
  14. package/src/command-line/release/command-object.js +1 -5
  15. package/src/command-line/release/plan-check.js +0 -3
  16. package/src/command-line/release/plan.js +0 -3
  17. package/src/command-line/release/publish.js +0 -6
  18. package/src/command-line/release/release.js +0 -3
  19. package/src/command-line/release/version.js +0 -3
  20. package/src/command-line/repair/command-object.js +2 -4
  21. package/src/command-line/repair/repair.js +2 -6
  22. package/src/command-line/run/run-one.js +0 -3
  23. package/src/command-line/show/command-object.js +2 -2
  24. package/src/command-line/sync/command-object.js +3 -8
  25. package/src/command-line/sync/sync.js +1 -5
  26. package/src/command-line/watch/command-object.js +1 -1
  27. package/src/command-line/watch/watch.js +0 -3
  28. package/src/command-line/yargs-utils/shared-options.js +3 -3
  29. package/src/core/graph/main.js +1 -1
  30. package/src/native/assert-supported-platform.js +1 -1
  31. package/src/native/nx.wasm32-wasi.wasm +0 -0
  32. package/src/nx-cloud/utilities/url-shorten.js +1 -1
  33. package/src/plugins/js/package-json/create-package-json.d.ts +1 -0
  34. package/src/plugins/js/package-json/create-package-json.js +1 -1
  35. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +11 -6
  36. package/src/tasks-runner/cache.js +1 -1
  37. package/src/utils/git-utils.js +1 -1
  38. package/src/utils/logger.js +1 -1
package/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # Nx: Smart Monorepos · Fast CI
24
24
 
25
- Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
25
+ Nx is a build system, optimized for monorepos, with plugins for popular frameworks and tools and advanced CI capabilities including caching and distribution.
26
26
 
27
27
  ## Getting Started
28
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.6.1",
3
+ "version": "19.6.2",
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": {
@@ -71,7 +71,7 @@
71
71
  "yargs-parser": "21.1.1",
72
72
  "node-machine-id": "1.1.12",
73
73
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.6.1"
74
+ "@nrwl/tao": "19.6.2"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@swc-node/register": "^1.8.0",
@@ -86,16 +86,16 @@
86
86
  }
87
87
  },
88
88
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.6.1",
90
- "@nx/nx-darwin-arm64": "19.6.1",
91
- "@nx/nx-linux-x64-gnu": "19.6.1",
92
- "@nx/nx-linux-x64-musl": "19.6.1",
93
- "@nx/nx-win32-x64-msvc": "19.6.1",
94
- "@nx/nx-linux-arm64-gnu": "19.6.1",
95
- "@nx/nx-linux-arm64-musl": "19.6.1",
96
- "@nx/nx-linux-arm-gnueabihf": "19.6.1",
97
- "@nx/nx-win32-arm64-msvc": "19.6.1",
98
- "@nx/nx-freebsd-x64": "19.6.1"
89
+ "@nx/nx-darwin-x64": "19.6.2",
90
+ "@nx/nx-darwin-arm64": "19.6.2",
91
+ "@nx/nx-linux-x64-gnu": "19.6.2",
92
+ "@nx/nx-linux-x64-musl": "19.6.2",
93
+ "@nx/nx-win32-x64-msvc": "19.6.2",
94
+ "@nx/nx-linux-arm64-gnu": "19.6.2",
95
+ "@nx/nx-linux-arm64-musl": "19.6.2",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.6.2",
97
+ "@nx/nx-win32-arm64-msvc": "19.6.2",
98
+ "@nx/nx-freebsd-x64": "19.6.2"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -18,11 +18,7 @@ const versions_1 = require("../../utils/versions");
18
18
  const workspace_root_1 = require("../../utils/workspace-root");
19
19
  const add_nx_scripts_1 = require("../init/implementation/dot-nx/add-nx-scripts");
20
20
  function addHandler(options) {
21
- if (options.verbose) {
22
- process.env.NX_VERBOSE_LOGGING = 'true';
23
- }
24
- const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
25
- return (0, params_1.handleErrors)(isVerbose, async () => {
21
+ return (0, params_1.handleErrors)(options.verbose, async () => {
26
22
  output_1.output.addNewline();
27
23
  const [pkgName, version] = parsePackageSpecifier(options.packageSpecifier);
28
24
  const nxJson = (0, nx_json_1.readNxJson)();
@@ -5,7 +5,7 @@ const shared_options_1 = require("../yargs-utils/shared-options");
5
5
  exports.yargsAddCommand = {
6
6
  command: 'add <packageSpecifier>',
7
7
  describe: 'Install a plugin and initialize it.',
8
- builder: (yargs) => yargs
8
+ builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
9
9
  .parserConfiguration({
10
10
  'strip-dashed': true,
11
11
  'unknown-options-as-args': true,
@@ -17,10 +17,6 @@ exports.yargsAddCommand = {
17
17
  .option('updatePackageScripts', {
18
18
  type: 'boolean',
19
19
  description: 'Update `package.json` scripts with inferred targets. Defaults to `true` when the package is a core Nx plugin',
20
- })
21
- .option('verbose', {
22
- type: 'boolean',
23
- description: 'Prints additional information about the commands (e.g., stack traces)',
24
20
  })
25
21
  .example('$0 add @nx/react', 'Install the latest version of the `@nx/react` package and run its `@nx/react:init` generator')
26
22
  .example('$0 add non-core-nx-plugin', 'Install the latest version of the `non-core-nx-plugin` package and run its `non-core-nx-plugin:init` generator if available')
@@ -27,9 +27,6 @@ async function affected(command, args, extraTargetDependencies = {}, extraOption
27
27
  const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', {
28
28
  printWarnings: command !== 'print-affected' && !args.plain && args.graph !== 'stdout',
29
29
  }, nxJson);
30
- if (nxArgs.verbose) {
31
- process.env.NX_VERBOSE_LOGGING = 'true';
32
- }
33
30
  await (0, connect_to_nx_cloud_1.connectToNxCloudIfExplicitlyAsked)(nxArgs);
34
31
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
35
32
  const projects = await getAffectedGraphNodes(nxArgs, projectGraph);
@@ -20,9 +20,6 @@ const get_command_projects_1 = require("../../commands-runner/get-command-projec
20
20
  async function nxExecCommand(args) {
21
21
  const nxJson = (0, configuration_1.readNxJson)();
22
22
  const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'run-many', { printWarnings: args.graph !== 'stdout' }, nxJson);
23
- if (nxArgs.verbose) {
24
- process.env.NX_VERBOSE_LOGGING = 'true';
25
- }
26
23
  const scriptArgV = readScriptArgV(overrides);
27
24
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
28
25
  // NX is already running
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yargsGenerateCommand = void 0;
4
4
  const path_1 = require("../../utils/path");
5
+ const shared_options_1 = require("../yargs-utils/shared-options");
5
6
  exports.yargsGenerateCommand = {
6
7
  command: 'generate <generator> [_..]',
7
8
  describe: 'Generate or update source code (e.g., nx generate @nx/js:lib mylib).',
@@ -15,7 +16,7 @@ exports.yargsGenerateCommand = {
15
16
  };
16
17
  function withGenerateOptions(yargs) {
17
18
  const generatorWillShowHelp = process.argv[3] && !process.argv[3].startsWith('-');
18
- const res = yargs
19
+ const res = (0, shared_options_1.withVerbose)(yargs)
19
20
  .positional('generator', {
20
21
  describe: 'Name of the generator (e.g., @nx/js:library, library)',
21
22
  type: 'string',
@@ -31,10 +32,6 @@ function withGenerateOptions(yargs) {
31
32
  describe: 'When false disables interactive input prompts for options',
32
33
  type: 'boolean',
33
34
  default: true,
34
- })
35
- .option('verbose', {
36
- describe: 'Prints additional information about the commands (e.g., stack traces)',
37
- type: 'boolean',
38
35
  })
39
36
  .option('quiet', {
40
37
  describe: 'Hides logs from tree operations (e.g. `CREATE package.json`)',
@@ -206,11 +206,7 @@ function printGenHelp(opts, schema, normalizedGeneratorName, aliases) {
206
206
  });
207
207
  }
208
208
  async function generate(cwd, args) {
209
- if (args['verbose']) {
210
- process.env.NX_VERBOSE_LOGGING = 'true';
211
- }
212
- const verbose = process.env.NX_VERBOSE_LOGGING === 'true';
213
- return (0, params_1.handleErrors)(verbose, async () => {
209
+ return (0, params_1.handleErrors)(args.verbose, async () => {
214
210
  const nxJsonConfiguration = (0, configuration_1.readNxJson)();
215
211
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
216
212
  const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
@@ -229,9 +225,9 @@ async function generate(cwd, args) {
229
225
  printGenHelp(opts, schema, normalizedGeneratorName, aliases);
230
226
  return 0;
231
227
  }
232
- const combinedOpts = await (0, params_1.combineOptionsForGenerator)(opts.generatorOptions, opts.collectionName, normalizedGeneratorName, projectsConfigurations, nxJsonConfiguration, schema, opts.interactive, (0, calculate_default_project_name_1.calculateDefaultProjectName)(cwd, workspace_root_1.workspaceRoot, projectsConfigurations, nxJsonConfiguration), (0, path_1.relative)(workspace_root_1.workspaceRoot, cwd), verbose);
228
+ const combinedOpts = await (0, params_1.combineOptionsForGenerator)(opts.generatorOptions, opts.collectionName, normalizedGeneratorName, projectsConfigurations, nxJsonConfiguration, schema, opts.interactive, (0, calculate_default_project_name_1.calculateDefaultProjectName)(cwd, workspace_root_1.workspaceRoot, projectsConfigurations, nxJsonConfiguration), (0, path_1.relative)(workspace_root_1.workspaceRoot, cwd), args.verbose);
233
229
  if ((0, generator_utils_1.getGeneratorInformation)(opts.collectionName, normalizedGeneratorName, workspace_root_1.workspaceRoot, projectsConfigurations.projects).isNxGenerator) {
234
- const host = new tree_1.FsTree(workspace_root_1.workspaceRoot, verbose, `generating (${opts.collectionName}:${normalizedGeneratorName})`);
230
+ const host = new tree_1.FsTree(workspace_root_1.workspaceRoot, args.verbose, `generating (${opts.collectionName}:${normalizedGeneratorName})`);
235
231
  const implementation = implementationFactory();
236
232
  // @todo(v17): Remove this, isStandalonePreset property is defunct.
237
233
  if (normalizedGeneratorName === 'preset' && !isStandalonePreset) {
@@ -259,7 +255,7 @@ async function generate(cwd, args) {
259
255
  return (await Promise.resolve().then(() => require('../../adapter/ngcli-adapter'))).generate(workspace_root_1.workspaceRoot, {
260
256
  ...opts,
261
257
  generatorOptions: combinedOpts,
262
- }, projectsConfigurations.projects, verbose);
258
+ }, projectsConfigurations.projects, args.verbose);
263
259
  }
264
260
  });
265
261
  }
@@ -30,7 +30,7 @@ exports.yargsImportCommand = {
30
30
  default: true,
31
31
  })), 'import'),
32
32
  handler: async (args) => {
33
- const exitCode = await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
33
+ const exitCode = await (0, params_1.handleErrors)(args.verbose, async () => {
34
34
  return (await Promise.resolve().then(() => require('./import'))).importHandler(args);
35
35
  });
36
36
  process.exit(exitCode);
@@ -61,7 +61,7 @@ async function prepareSourceRepo(gitClient, ref, source, relativeDestination, te
61
61
  await (0, promises_1.rm)(destinationInSource, {
62
62
  recursive: true,
63
63
  });
64
- await gitClient.commit('chore(repo): prepare for import');
64
+ await gitClient.commit(`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`);
65
65
  needsSquash = true;
66
66
  }
67
67
  catch { }
@@ -92,7 +92,7 @@ async function prepareSourceRepo(gitClient, ref, source, relativeDestination, te
92
92
  });
93
93
  }
94
94
  }
95
- await gitClient.commit('chore(repo): prepare for import 2');
95
+ await gitClient.commit(`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`);
96
96
  if (needsSquash) {
97
97
  await gitClient.squashLastTwoCommits();
98
98
  }
@@ -8,6 +8,7 @@ const child_process_2 = require("child_process");
8
8
  const package_manager_1 = require("../../utils/package-manager");
9
9
  const fileutils_1 = require("../../utils/fileutils");
10
10
  const workspace_root_1 = require("../../utils/workspace-root");
11
+ const shared_options_1 = require("../yargs-utils/shared-options");
11
12
  exports.yargsMigrateCommand = {
12
13
  command: 'migrate [packageAndVersion]',
13
14
  describe: `Creates a migrations file or runs migrations from the migrations file.
@@ -27,7 +28,7 @@ exports.yargsInternalMigrateCommand = {
27
28
  };
28
29
  function withMigrationOptions(yargs) {
29
30
  const defaultCommitPrefix = 'chore: [nx migration] ';
30
- return yargs
31
+ return (0, shared_options_1.withVerbose)(yargs)
31
32
  .positional('packageAndVersion', {
32
33
  describe: `The target package and version (e.g, @nx/workspace@16.0.0)`,
33
34
  type: 'string',
@@ -146,7 +147,7 @@ function nxCliPath() {
146
147
  }
147
148
  catch (e) {
148
149
  console.error(`Failed to install the ${version} version of the migration script. Using the current version.`);
149
- if (process.env.NX_VERBOSE_LOGGING) {
150
+ if (process.env.NX_VERBOSE_LOGGING === 'true') {
150
151
  console.error(e);
151
152
  }
152
153
  return null;
@@ -1040,9 +1040,6 @@ async function runNxMigration(root, collectionPath, collection, name) {
1040
1040
  return changes;
1041
1041
  }
1042
1042
  async function migrate(root, args, rawArgs) {
1043
- if (args['verbose']) {
1044
- process.env.NX_VERBOSE_LOGGING = 'true';
1045
- }
1046
1043
  await client_1.daemonClient.stop();
1047
1044
  return (0, params_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
1048
1045
  const opts = await parseMigrationsOptions(args);
@@ -44,9 +44,6 @@ function createAPI(overrideReleaseConfig) {
44
44
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
45
45
  const nxJson = (0, nx_json_1.readNxJson)();
46
46
  const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
47
- if (args.verbose) {
48
- process.env.NX_VERBOSE_LOGGING = 'true';
49
- }
50
47
  // Apply default configuration to any optional user configuration
51
48
  const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
52
49
  if (configError) {
@@ -9,7 +9,7 @@ const shared_options_1 = require("../yargs-utils/shared-options");
9
9
  exports.yargsReleaseCommand = {
10
10
  command: 'release',
11
11
  describe: 'Orchestrate versioning and publishing of applications and libraries',
12
- builder: (yargs) => yargs
12
+ builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
13
13
  .command(releaseCommand)
14
14
  .command(versionCommand)
15
15
  .command(changelogCommand)
@@ -36,10 +36,6 @@ exports.yargsReleaseCommand = {
36
36
  alias: 'd',
37
37
  type: 'boolean',
38
38
  default: false,
39
- })
40
- .option('verbose', {
41
- type: 'boolean',
42
- describe: 'Prints additional information about the commands (e.g., stack traces)',
43
39
  })
44
40
  // NOTE: The camel case format is required for the coerce() function to be called correctly. It still supports --print-config casing.
45
41
  .option('printConfig', {
@@ -24,9 +24,6 @@ function createAPI(overrideReleaseConfig) {
24
24
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
25
25
  const nxJson = (0, nx_json_1.readNxJson)();
26
26
  const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
27
- if (args.verbose) {
28
- process.env.NX_VERBOSE_LOGGING = 'true';
29
- }
30
27
  // Apply default configuration to any optional user configuration
31
28
  const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
32
29
  if (configError) {
@@ -27,9 +27,6 @@ function createAPI(overrideReleaseConfig) {
27
27
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
28
28
  const nxJson = (0, nx_json_1.readNxJson)();
29
29
  const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
30
- if (args.verbose) {
31
- process.env.NX_VERBOSE_LOGGING = 'true';
32
- }
33
30
  // Apply default configuration to any optional user configuration
34
31
  const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
35
32
  if (configError) {
@@ -35,9 +35,6 @@ function createAPI(overrideReleaseConfig) {
35
35
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
36
36
  const nxJson = (0, nx_json_1.readNxJson)();
37
37
  const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
38
- if (_args.verbose) {
39
- process.env.NX_VERBOSE_LOGGING = 'true';
40
- }
41
38
  // Apply default configuration to any optional user configuration
42
39
  const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
43
40
  if (configError) {
@@ -114,9 +111,6 @@ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, is
114
111
  */
115
112
  process.env.NX_DRY_RUN = 'true';
116
113
  }
117
- if (args.verbose) {
118
- process.env.NX_VERBOSE_LOGGING = 'true';
119
- }
120
114
  if (args.firstRelease) {
121
115
  overrides.firstRelease = args.firstRelease;
122
116
  }
@@ -31,9 +31,6 @@ function createAPI(overrideReleaseConfig) {
31
31
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
32
32
  const nxJson = (0, nx_json_1.readNxJson)();
33
33
  const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
34
- if (args.verbose) {
35
- process.env.NX_VERBOSE_LOGGING = 'true';
36
- }
37
34
  const hasVersionGitConfig = Object.keys(userProvidedReleaseConfig.version?.git ?? {}).length > 0;
38
35
  const hasChangelogGitConfig = Object.keys(userProvidedReleaseConfig.changelog?.git ?? {}).length > 0;
39
36
  if (hasVersionGitConfig || hasChangelogGitConfig) {
@@ -44,9 +44,6 @@ function createAPI(overrideReleaseConfig) {
44
44
  const { projects } = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
45
45
  const nxJson = (0, nx_json_1.readNxJson)();
46
46
  const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
47
- if (args.verbose) {
48
- process.env.NX_VERBOSE_LOGGING = 'true';
49
- }
50
47
  // Apply default configuration to any optional user configuration
51
48
  const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
52
49
  if (configError) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yargsRepairCommand = void 0;
4
4
  const documentation_1 = require("../yargs-utils/documentation");
5
+ const shared_options_1 = require("../yargs-utils/shared-options");
5
6
  exports.yargsRepairCommand = {
6
7
  command: 'repair',
7
8
  describe: `Repair any configuration that is no longer supported by Nx.
@@ -14,9 +15,6 @@ exports.yargsRepairCommand = {
14
15
  If your repository has only ever updated to newer versions of Nx with
15
16
  \`nx migrate\`, running \`nx repair\` should do nothing.
16
17
  `,
17
- builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(yargs, 'repair').option('verbose', {
18
- type: 'boolean',
19
- describe: 'Prints additional information about the commands (e.g., stack traces)',
20
- }),
18
+ builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withVerbose)(yargs), 'repair'),
21
19
  handler: async (args) => process.exit(await (await Promise.resolve().then(() => require('./repair'))).repair(args)),
22
20
  };
@@ -6,11 +6,7 @@ const migrationsJson = require("../../../migrations.json");
6
6
  const migrate_1 = require("../migrate/migrate");
7
7
  const output_1 = require("../../utils/output");
8
8
  async function repair(args, extraMigrations = []) {
9
- if (args['verbose']) {
10
- process.env.NX_VERBOSE_LOGGING = 'true';
11
- }
12
- const verbose = process.env.NX_VERBOSE_LOGGING === 'true';
13
- return (0, params_1.handleErrors)(verbose, async () => {
9
+ return (0, params_1.handleErrors)(args.verbose, async () => {
14
10
  const nxMigrations = Object.entries(migrationsJson.generators).reduce((agg, [name, migration]) => {
15
11
  const skip = migration['x-repair-skip'];
16
12
  if (!skip) {
@@ -25,7 +21,7 @@ async function repair(args, extraMigrations = []) {
25
21
  return agg;
26
22
  }, []);
27
23
  const migrations = [...nxMigrations, ...extraMigrations];
28
- const migrationsThatMadeNoChanges = await (0, migrate_1.executeMigrations)(process.cwd(), migrations, verbose, false, '');
24
+ const migrationsThatMadeNoChanges = await (0, migrate_1.executeMigrations)(process.cwd(), migrations, args.verbose, false, '');
29
25
  if (migrationsThatMadeNoChanges.length < migrations.length) {
30
26
  output_1.output.success({
31
27
  title: `Successfully repaired your configuration. This workspace is up to date!`,
@@ -28,9 +28,6 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
28
28
  configuration: opts.configuration,
29
29
  targets: [opts.target],
30
30
  }, 'run-one', { printWarnings: args.graph !== 'stdout' }, nxJson);
31
- if (nxArgs.verbose) {
32
- process.env.NX_VERBOSE_LOGGING = 'true';
33
- }
34
31
  if (nxArgs.help) {
35
32
  await (await Promise.resolve().then(() => require('./run'))).printTargetRunHelp(opts, workspace_root_1.workspaceRoot);
36
33
  process.exit(0);
@@ -65,7 +65,7 @@ const showProjectsCommand = {
65
65
  .example('$0 show projects --type app --affected', 'Show affected apps in the workspace')
66
66
  .example('$0 show projects --affected --exclude=*-e2e', 'Show affected projects in the workspace, excluding end-to-end projects'),
67
67
  handler: async (args) => {
68
- const exitCode = await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
68
+ const exitCode = await (0, params_1.handleErrors)(args.verbose, async () => {
69
69
  const { showProjectsHandler } = await Promise.resolve().then(() => require('./projects'));
70
70
  await showProjectsHandler(args);
71
71
  });
@@ -106,7 +106,7 @@ const showProjectCommand = {
106
106
  .example('$0 show project my-app', 'View project information for my-app in JSON format')
107
107
  .example('$0 show project my-app --web', 'View project information for my-app in the browser'),
108
108
  handler: async (args) => {
109
- const exitCode = await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
109
+ const exitCode = await (0, params_1.handleErrors)(args.verbose, async () => {
110
110
  const { showProjectHandler } = await Promise.resolve().then(() => require('./project'));
111
111
  await showProjectHandler(args);
112
112
  });
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yargsSyncCheckCommand = exports.yargsSyncCommand = void 0;
4
+ const shared_options_1 = require("../yargs-utils/shared-options");
4
5
  exports.yargsSyncCommand = {
5
6
  command: 'sync',
6
7
  describe: false,
7
- builder: (yargs) => yargs.option('verbose', {
8
- type: 'boolean',
9
- description: 'Prints additional information about the commands (e.g., stack traces)',
10
- }),
8
+ builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),
11
9
  handler: async (args) => {
12
10
  process.exit(await Promise.resolve().then(() => require('./sync')).then((m) => m.syncHandler(args)));
13
11
  },
@@ -15,10 +13,7 @@ exports.yargsSyncCommand = {
15
13
  exports.yargsSyncCheckCommand = {
16
14
  command: 'sync:check',
17
15
  describe: false,
18
- builder: (yargs) => yargs.option('verbose', {
19
- type: 'boolean',
20
- description: 'Prints additional information about the commands (e.g., stack traces)',
21
- }),
16
+ builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),
22
17
  handler: async (args) => {
23
18
  process.exit(await Promise.resolve().then(() => require('./sync')).then((m) => m.syncHandler({ ...args, check: true })));
24
19
  },
@@ -8,11 +8,7 @@ const params_1 = require("../../utils/params");
8
8
  const sync_generators_1 = require("../../utils/sync-generators");
9
9
  const chalk = require("chalk");
10
10
  function syncHandler(options) {
11
- if (options.verbose) {
12
- process.env.NX_VERBOSE_LOGGING = 'true';
13
- }
14
- const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
15
- return (0, params_1.handleErrors)(isVerbose, async () => {
11
+ return (0, params_1.handleErrors)(options.verbose, async () => {
16
12
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
17
13
  const syncGenerators = await (0, sync_generators_1.collectAllRegisteredSyncGenerators)(projectGraph);
18
14
  const results = await (0, sync_generators_1.getSyncGeneratorChanges)(syncGenerators);
@@ -12,7 +12,7 @@ exports.yargsWatchCommand = {
12
12
  },
13
13
  };
14
14
  function withWatchOptions(yargs) {
15
- return yargs
15
+ return (0, shared_options_1.withVerbose)(yargs)
16
16
  .parserConfiguration({
17
17
  'strip-dashed': true,
18
18
  'populate--': true,
@@ -114,9 +114,6 @@ class BatchCommandRunner extends BatchFunctionRunner {
114
114
  }
115
115
  async function watch(args) {
116
116
  const projectReplacementRegex = new RegExp(args.projectNameEnvName ?? DEFAULT_PROJECT_NAME_ENV, 'g');
117
- if (args.verbose) {
118
- process.env.NX_VERBOSE_LOGGING = 'true';
119
- }
120
117
  if (!client_1.daemonClient.enabled()) {
121
118
  output_1.output.error({
122
119
  title: 'Daemon is not running. The watch command is not supported without the Nx Daemon.',
@@ -111,9 +111,9 @@ function withVerbose(yargs) {
111
111
  type: 'boolean',
112
112
  })
113
113
  .middleware((args) => {
114
- if (args.verbose) {
115
- process.env.NX_VERBOSE_LOGGING = 'true';
116
- }
114
+ args.verbose ??= process.env.NX_VERBOSE_LOGGING === 'true';
115
+ // If NX_VERBOSE_LOGGING=false and --verbose is passed, we want to set it to true favoring the arg
116
+ process.env.NX_VERBOSE_LOGGING = args.verbose.toString();
117
117
  });
118
118
  }
119
119
  function withBatch(yargs) {