nx 19.7.0-canary.20240821-2065033 → 19.7.0-canary.20240822-d6a0cfb

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.
Files changed (67) hide show
  1. package/package.json +12 -12
  2. package/src/command-line/add/add.js +1 -5
  3. package/src/command-line/add/command-object.js +1 -5
  4. package/src/command-line/affected/affected.js +0 -3
  5. package/src/command-line/exec/exec.js +0 -3
  6. package/src/command-line/generate/command-object.js +2 -5
  7. package/src/command-line/generate/generate.js +4 -8
  8. package/src/command-line/import/command-object.js +1 -1
  9. package/src/command-line/migrate/command-object.js +3 -2
  10. package/src/command-line/migrate/migrate.js +0 -3
  11. package/src/command-line/release/changelog.js +0 -3
  12. package/src/command-line/release/command-object.js +1 -5
  13. package/src/command-line/release/plan-check.js +0 -3
  14. package/src/command-line/release/plan.js +0 -3
  15. package/src/command-line/release/publish.js +0 -6
  16. package/src/command-line/release/release.js +0 -3
  17. package/src/command-line/release/version.js +0 -3
  18. package/src/command-line/repair/command-object.js +2 -4
  19. package/src/command-line/repair/repair.js +2 -6
  20. package/src/command-line/run/run-one.js +0 -3
  21. package/src/command-line/show/command-object.js +2 -2
  22. package/src/command-line/sync/command-object.js +3 -8
  23. package/src/command-line/sync/sync.js +1 -5
  24. package/src/command-line/watch/command-object.js +1 -1
  25. package/src/command-line/watch/watch.js +0 -3
  26. package/src/command-line/yargs-utils/shared-options.js +3 -3
  27. package/src/daemon/client/client.d.ts +3 -6
  28. package/src/daemon/client/client.js +5 -4
  29. package/src/daemon/message-types/task-history.d.ts +9 -9
  30. package/src/daemon/message-types/task-history.js +7 -7
  31. package/src/daemon/server/handle-task-history.d.ts +9 -0
  32. package/src/daemon/server/handle-task-history.js +28 -0
  33. package/src/daemon/server/server.js +4 -5
  34. package/src/hasher/hash-task.js +36 -1
  35. package/src/native/assert-supported-platform.js +1 -1
  36. package/src/native/index.d.ts +45 -4
  37. package/src/native/native-bindings.js +4 -0
  38. package/src/native/nx.wasi-browser.js +50 -36
  39. package/src/native/nx.wasi.cjs +48 -36
  40. package/src/native/nx.wasm32-wasi.wasm +0 -0
  41. package/src/nx-cloud/update-manager.d.ts +2 -0
  42. package/src/nx-cloud/utilities/url-shorten.js +1 -1
  43. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +11 -6
  44. package/src/tasks-runner/cache.d.ts +21 -2
  45. package/src/tasks-runner/cache.js +118 -26
  46. package/src/tasks-runner/default-tasks-runner.d.ts +6 -0
  47. package/src/tasks-runner/default-tasks-runner.js +34 -1
  48. package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +9 -0
  49. package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +54 -0
  50. package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +1 -0
  51. package/src/tasks-runner/life-cycles/task-history-life-cycle.js +19 -21
  52. package/src/tasks-runner/run-command.js +3 -1
  53. package/src/tasks-runner/task-orchestrator.js +10 -1
  54. package/src/utils/cache-directory.d.ts +1 -0
  55. package/src/utils/cache-directory.js +7 -3
  56. package/src/utils/db-connection.d.ts +2 -0
  57. package/src/utils/db-connection.js +11 -0
  58. package/src/utils/legacy-task-history.d.ts +8 -0
  59. package/src/utils/legacy-task-history.js +87 -0
  60. package/src/utils/logger.js +1 -1
  61. package/src/utils/task-history.d.ts +6 -8
  62. package/src/utils/task-history.js +16 -88
  63. package/src/utils/workspace-context.js +1 -1
  64. package/src/daemon/server/handle-get-task-history.d.ts +0 -4
  65. package/src/daemon/server/handle-get-task-history.js +0 -11
  66. package/src/daemon/server/handle-write-task-runs-to-history.d.ts +0 -5
  67. package/src/daemon/server/handle-write-task-runs-to-history.js +0 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.7.0-canary.20240821-2065033",
3
+ "version": "19.7.0-canary.20240822-d6a0cfb",
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.7.0-canary.20240821-2065033"
74
+ "@nrwl/tao": "19.7.0-canary.20240822-d6a0cfb"
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.7.0-canary.20240821-2065033",
90
- "@nx/nx-darwin-arm64": "19.7.0-canary.20240821-2065033",
91
- "@nx/nx-linux-x64-gnu": "19.7.0-canary.20240821-2065033",
92
- "@nx/nx-linux-x64-musl": "19.7.0-canary.20240821-2065033",
93
- "@nx/nx-win32-x64-msvc": "19.7.0-canary.20240821-2065033",
94
- "@nx/nx-linux-arm64-gnu": "19.7.0-canary.20240821-2065033",
95
- "@nx/nx-linux-arm64-musl": "19.7.0-canary.20240821-2065033",
96
- "@nx/nx-linux-arm-gnueabihf": "19.7.0-canary.20240821-2065033",
97
- "@nx/nx-win32-arm64-msvc": "19.7.0-canary.20240821-2065033",
98
- "@nx/nx-freebsd-x64": "19.7.0-canary.20240821-2065033"
89
+ "@nx/nx-darwin-x64": "19.7.0-canary.20240822-d6a0cfb",
90
+ "@nx/nx-darwin-arm64": "19.7.0-canary.20240822-d6a0cfb",
91
+ "@nx/nx-linux-x64-gnu": "19.7.0-canary.20240822-d6a0cfb",
92
+ "@nx/nx-linux-x64-musl": "19.7.0-canary.20240822-d6a0cfb",
93
+ "@nx/nx-win32-x64-msvc": "19.7.0-canary.20240822-d6a0cfb",
94
+ "@nx/nx-linux-arm64-gnu": "19.7.0-canary.20240822-d6a0cfb",
95
+ "@nx/nx-linux-arm64-musl": "19.7.0-canary.20240822-d6a0cfb",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.7.0-canary.20240822-d6a0cfb",
97
+ "@nx/nx-win32-arm64-msvc": "19.7.0-canary.20240822-d6a0cfb",
98
+ "@nx/nx-freebsd-x64": "19.7.0-canary.20240822-d6a0cfb"
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);
@@ -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) {
@@ -3,8 +3,7 @@ import { FileData, ProjectGraph } from '../../config/project-graph';
3
3
  import { Hash } from '../../hasher/task-hasher';
4
4
  import { Task, TaskGraph } from '../../config/task-graph';
5
5
  import { ConfigurationSourceMaps } from '../../project-graph/utils/project-configuration-utils';
6
- import { NxWorkspaceFiles } from '../../native';
7
- import { TaskRun } from '../../utils/task-history';
6
+ import { NxWorkspaceFiles, TaskRun } from '../../native';
8
7
  import type { SyncGeneratorChangesResult } from '../../utils/sync-generators';
9
8
  export type UnregisterCallback = () => void;
10
9
  export type ChangedFile = {
@@ -51,10 +50,8 @@ export declare class DaemonClient {
51
50
  getWorkspaceFiles(projectRootMap: Record<string, string>): Promise<NxWorkspaceFiles>;
52
51
  getFilesInDirectory(dir: string): Promise<string[]>;
53
52
  hashGlob(globs: string[], exclude?: string[]): Promise<string>;
54
- getTaskHistoryForHashes(hashes: string[]): Promise<{
55
- [hash: string]: TaskRun[];
56
- }>;
57
- writeTaskRunsToHistory(taskRuns: TaskRun[]): Promise<void>;
53
+ getFlakyTasks(hashes: string[]): Promise<string[]>;
54
+ recordTaskRuns(taskRuns: TaskRun[]): Promise<void>;
58
55
  getSyncGeneratorChanges(generators: string[]): Promise<SyncGeneratorChangesResult[]>;
59
56
  flushSyncGeneratorChangesToDisk(generators: string[]): Promise<void>;
60
57
  getRegisteredSyncGenerators(): Promise<string[]>;
@@ -25,6 +25,7 @@ const get_nx_workspace_files_1 = require("../message-types/get-nx-workspace-file
25
25
  const get_context_file_data_1 = require("../message-types/get-context-file-data");
26
26
  const get_files_in_directory_1 = require("../message-types/get-files-in-directory");
27
27
  const hash_glob_1 = require("../message-types/hash-glob");
28
+ const task_history_1 = require("../message-types/task-history");
28
29
  const force_shutdown_1 = require("../message-types/force-shutdown");
29
30
  const get_sync_generator_changes_1 = require("../message-types/get-sync-generator-changes");
30
31
  const get_registered_sync_generators_1 = require("../message-types/get-registered-sync-generators");
@@ -235,16 +236,16 @@ class DaemonClient {
235
236
  };
236
237
  return this.sendToDaemonViaQueue(message);
237
238
  }
238
- getTaskHistoryForHashes(hashes) {
239
+ getFlakyTasks(hashes) {
239
240
  const message = {
240
- type: 'GET_TASK_HISTORY_FOR_HASHES',
241
+ type: task_history_1.GET_FLAKY_TASKS,
241
242
  hashes,
242
243
  };
243
244
  return this.sendToDaemonViaQueue(message);
244
245
  }
245
- writeTaskRunsToHistory(taskRuns) {
246
+ recordTaskRuns(taskRuns) {
246
247
  const message = {
247
- type: 'WRITE_TASK_RUNS_TO_HISTORY',
248
+ type: task_history_1.RECORD_TASK_RUNS,
248
249
  taskRuns,
249
250
  };
250
251
  return this.sendMessageToDaemon(message);
@@ -1,13 +1,13 @@
1
- import { TaskRun } from '../../utils/task-history';
2
- export declare const GET_TASK_HISTORY_FOR_HASHES: "GET_TASK_HISTORY_FOR_HASHES";
3
- export type HandleGetTaskHistoryForHashesMessage = {
4
- type: typeof GET_TASK_HISTORY_FOR_HASHES;
1
+ import type { TaskRun } from '../../native';
2
+ export declare const GET_FLAKY_TASKS: "GET_FLAKY_TASKS";
3
+ export type HandleGetFlakyTasks = {
4
+ type: typeof GET_FLAKY_TASKS;
5
5
  hashes: string[];
6
6
  };
7
- export declare function isHandleGetTaskHistoryForHashesMessage(message: unknown): message is HandleGetTaskHistoryForHashesMessage;
8
- export declare const WRITE_TASK_RUNS_TO_HISTORY: "WRITE_TASK_RUNS_TO_HISTORY";
9
- export type HandleWriteTaskRunsToHistoryMessage = {
10
- type: typeof WRITE_TASK_RUNS_TO_HISTORY;
7
+ export declare function isHandleGetFlakyTasksMessage(message: unknown): message is HandleGetFlakyTasks;
8
+ export declare const RECORD_TASK_RUNS: "RECORD_TASK_RUNS";
9
+ export type HandleRecordTaskRunsMessage = {
10
+ type: typeof RECORD_TASK_RUNS;
11
11
  taskRuns: TaskRun[];
12
12
  };
13
- export declare function isHandleWriteTaskRunsToHistoryMessage(message: unknown): message is HandleWriteTaskRunsToHistoryMessage;
13
+ export declare function isHandleWriteTaskRunsToHistoryMessage(message: unknown): message is HandleRecordTaskRunsMessage;
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WRITE_TASK_RUNS_TO_HISTORY = exports.GET_TASK_HISTORY_FOR_HASHES = void 0;
4
- exports.isHandleGetTaskHistoryForHashesMessage = isHandleGetTaskHistoryForHashesMessage;
3
+ exports.RECORD_TASK_RUNS = exports.GET_FLAKY_TASKS = void 0;
4
+ exports.isHandleGetFlakyTasksMessage = isHandleGetFlakyTasksMessage;
5
5
  exports.isHandleWriteTaskRunsToHistoryMessage = isHandleWriteTaskRunsToHistoryMessage;
6
- exports.GET_TASK_HISTORY_FOR_HASHES = 'GET_TASK_HISTORY_FOR_HASHES';
7
- function isHandleGetTaskHistoryForHashesMessage(message) {
6
+ exports.GET_FLAKY_TASKS = 'GET_FLAKY_TASKS';
7
+ function isHandleGetFlakyTasksMessage(message) {
8
8
  return (typeof message === 'object' &&
9
9
  message !== null &&
10
10
  'type' in message &&
11
- message['type'] === exports.GET_TASK_HISTORY_FOR_HASHES);
11
+ message['type'] === exports.GET_FLAKY_TASKS);
12
12
  }
13
- exports.WRITE_TASK_RUNS_TO_HISTORY = 'WRITE_TASK_RUNS_TO_HISTORY';
13
+ exports.RECORD_TASK_RUNS = 'RECORD_TASK_RUNS';
14
14
  function isHandleWriteTaskRunsToHistoryMessage(message) {
15
15
  return (typeof message === 'object' &&
16
16
  message !== null &&
17
17
  'type' in message &&
18
- message['type'] === exports.WRITE_TASK_RUNS_TO_HISTORY);
18
+ message['type'] === exports.RECORD_TASK_RUNS);
19
19
  }
@@ -0,0 +1,9 @@
1
+ import { TaskRun } from '../../native';
2
+ export declare function handleRecordTaskRuns(taskRuns: TaskRun[]): Promise<{
3
+ response: string;
4
+ description: string;
5
+ }>;
6
+ export declare function handleGetFlakyTasks(hashes: string[]): Promise<{
7
+ response: string;
8
+ description: string;
9
+ }>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleRecordTaskRuns = handleRecordTaskRuns;
4
+ exports.handleGetFlakyTasks = handleGetFlakyTasks;
5
+ const task_history_1 = require("../../utils/task-history");
6
+ let taskHistory;
7
+ function getTaskHistory() {
8
+ if (!taskHistory) {
9
+ taskHistory = new task_history_1.TaskHistory();
10
+ }
11
+ return taskHistory;
12
+ }
13
+ async function handleRecordTaskRuns(taskRuns) {
14
+ const taskHistory = getTaskHistory();
15
+ await taskHistory.recordTaskRuns(taskRuns);
16
+ return {
17
+ response: 'true',
18
+ description: 'handleRecordTaskRuns',
19
+ };
20
+ }
21
+ async function handleGetFlakyTasks(hashes) {
22
+ const taskHistory = getTaskHistory();
23
+ const history = await taskHistory.getFlakyTasks(hashes);
24
+ return {
25
+ response: JSON.stringify(history),
26
+ description: 'handleGetFlakyTasks',
27
+ };
28
+ }